src/occ_405/wof/wof.c
/**
 * prevent_over_current
 *
 * Description: Determines whether ceff_ratio_vdd will cause an over-current
 *              and clips it to a ratio of 1.0 if necessary.
 *
 * Param: Calculated ceff_ratio before clipping at 1.0
 *
 * Return: Clipped ceff_ratio
 */
prevent_over_current
Description: Determines whether ceff_ratio_vdd will cause an over-current
and clips it to a ratio of 1.0 if necessary.

Calculated ceff_ratio before clipping at 1.0


prevent_over_current Description : Determines whether ceff_ratio_vdd will cause an over - current and clips it to a ratio of 1 . 0 if necessary . Calculated ceff_ratio before clipping at 1 . 0
uint32_t prevent_over_current( uint32_t i_ceff_ratio )
{
    static uint8_t L_oc_prevention_timer = 0;
    uint32_t l_clipped_ratio = i_ceff_ratio;
    if( i_ceff_ratio > MAX_CEFF_RATIO ) 
    {
        INCREMENT_ERR_HISTORY( ERRH_CEFF_RATIO_VDD_EXCURSION );
        l_clipped_ratio = MAX_CEFF_RATIO;
        if( L_oc_prevention_timer == 0 )
        {
            L_oc_prevention_timer = 10; 
        }
        else
        {
            L_oc_prevention_timer--;
        }
    }
    else if( L_oc_prevention_timer != 0 ) 
    {
        l_clipped_ratio = MAX_CEFF_RATIO;
        L_oc_prevention_timer--;
    }
    return l_clipped_ratio;
}
uint32_t prevent_over_current ( uint32_t i_ceff_ratio ) { static uint8_t L_oc_prevention_timer = 0 ; uint32_t l_clipped_ratio = i_ceff_ratio ; if ( i_ceff_ratio > MAX_CEFF_RATIO ) { INCREMENT_ERR_HISTORY ( ERRH_CEFF_RATIO_VDD_EXCURSION ) ; l_clipped_ratio = MAX_CEFF_RATIO ; if ( L_oc_prevention_timer == 0 ) { L_oc_prevention_timer = 10 ; } else { L_oc_prevention_timer -- ; } } else if ( L_oc_prevention_timer != 0 ) { l_clipped_ratio = MAX_CEFF_RATIO ; L_oc_prevention_timer -- ; } return l_clipped_ratio ; }
prevent_over_current
 Description: Determines whether ceff_ratio_vdd will cause an over-current
              and clips it to a ratio of 1.0 if necessary.
prevent_over_current Description : Determines whether ceff_ratio_vdd will cause an over - current and clips it to a ratio of 1 . 0 if necessary .
// 10000 = 1.0 ratio // If over current timer not started, start it. // 10 WOF iterations // Timer is running