Every time this function is called, the system time will be incremented. If the system time is divisible by specified numbers, flags bits in mg_u8Ticks are set. This mechanism allows to execute actions at distinct intervals. Furthermore, this timer ISR is used to multiplex the LED displays and to activate the buzzer in case of an error or warning condition.
Definition at line 106 of file timer.c. References COND_CURR_ERR, COND_CURR_WARN, COND_TEMP_ERR, COND_TEMP_WARN, leds_ShowCurrent(), leds_ShowVoltage(), LOCAL_STATIC, mg_u32SystemTime, mg_u8Ticks, safety_GetCondition(), speaker_Buzz(), speaker_Off(), TICK1024, TICK128, TICK256, and TICK512. { LOCAL_STATIC UINT8 u8Toggle = 0U; mg_u32SystemTime++; /* multiplexing the LEDs */ u8Toggle++; if((u8Toggle & 0x01) != 0U) { leds_ShowVoltage(); } else { leds_ShowCurrent(); } if(0UL == (mg_u32SystemTime & 1023UL)) { mg_u8Ticks |= (TICK128 | TICK256 | TICK512 |TICK1024); } else if(0UL == (mg_u32SystemTime & 511UL)) { mg_u8Ticks |= (TICK128 | TICK256 | TICK512); } else if(0UL == (mg_u32SystemTime & 255UL)) { mg_u8Ticks |= (TICK128 | TICK256); } else if(0UL == (mg_u32SystemTime & 63UL)) { mg_u8Ticks |= (TICK128); } /* activate the speaker in case of a warning condition */ if( (safety_GetCondition() & (COND_CURR_WARN |COND_TEMP_WARN |COND_CURR_ERR |COND_TEMP_ERR)) != 0U ) { if((mg_u32SystemTime & 256UL) == 0UL) { speaker_Buzz(); } } else { speaker_Off(); } }
Here is the call graph for this function:
![]() |