AnsweredAssumed Answered

Problem With Virtual Timer

Question asked by vanima.nooshin on Feb 9, 2015
Latest reply on Feb 10, 2015 by Giovanni Di Sirio

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);
       }



}

Outcomes