2015-02-08 10:45 PM
Hi
I Want to use a virtual timer in my program , i think the code is ok but when i debug it the program all is in this function : static void tmrfunc(void *p) please see the code and say to me what wrong in my program .#include ''components.h''
static virtual_timer_t tmr; uint8_t Timer_Flag= 0;/*
* @brief Timer callback function. * * @param[in] p NULL * * @notapi */ static void tmrfunc(void *p) { (void)p;osalSysLockFromISR();
vtSetI(&tmr, OSAL_MS2ST(500), tmrfunc, NULL); osalSysUnlockFromISR();Timer_Flag= 1;
}/*
* Application entry point. */ int main(void) {/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/ componentsInit();/* Interrupts are enabled and the system is ready.*/
osalIsrEnable(); vtSet(&tmr, OSAL_MS2ST(500), tmrfunc, NULL); while (1) { if (Timer_Flag== 1) { palTogglePad(PORT_C, PC_LED7); } }Solved! Go to Solution.
2015-02-10 09:51 AM
Hi,
You set Timer_Flag only to 1 and never to 0. Try toggling the LED directly inside the callback. giovanni2015-02-10 09:51 AM
Hi,
You set Timer_Flag only to 1 and never to 0. Try toggling the LED directly inside the callback. giovanni