src/fw_tim.c
/**
 * Calculate the initial value of Timer0 & Timer1 counter
 * - If the frequency is too high, it will return the value of `limit`, so the timer
 *   will run in the highest frequency
 * - If the frequency is too low, it will return 0, so the timer will run in the 
 *   lowest possible frequency
*/
Calculate the initial value of Timer0 & Timer1 counter
- If the frequency is too high, it will return the value of `limit`, so the timer
will run in the highest frequency
- If the frequency is too low, it will return 0, so the timer will run in the
lowest possible frequency
Calculate the initial value of Timer0 & Timer1 counter - If the frequency is too high it will return the value of ` limit ` so the timer will run in the highest frequency - If the frequency is too low it will return 0 so the timer will run in the lowest possible frequency
int16_t TIM_Timer0n1_CalculateInitValue(uint16_t frequency, HAL_State_t freq1t, uint16_t limit)
{
    uint32_t value = SYS_GetSysClock();
    if (!freq1t)
        value = value / 12;
    value = value / frequency;
    if (value > limit)
        return 0;
    else
        return limit - value;
}
int16_t TIM_Timer0n1_CalculateInitValue ( uint16_t frequency , HAL_State_t freq1t , uint16_t limit ) { uint32_t value = SYS_GetSysClock ( ) ; if ( ! freq1t ) value = value / 12 ; value = value / frequency ; if ( value > limit ) return 0 ; else return limit - value ; }
Calculate the initial value of Timer0 & Timer1 counter
 - If the frequency is too high, it will return the value of `limit`, so the timer
   will run in the highest frequency
 - If the frequency is too low, it will return 0, so the timer will run in the
   lowest possible frequency
Calculate the initial value of Timer0 & Timer1 counter - If the frequency is too high it will return the value of ` limit ` so the timer will run in the highest frequency - If the frequency is too low it will return 0 so the timer will run in the lowest possible frequency