TimerHandle_t xTTimerHd1;
TimerHandle_t xTTimerHd2;
void vTimerCallback(void)
{
static u32 a = 1;
u32 b = 0;
printf(“fast:%d\r\n”,a++);
//xTimerReset( xTTimerHd2, 0 );
if(a==5)
xTimerStop(xTTimerHd2,0);
b = xTimerIsTimerActive(xTTimerHd2);
printf(“b is:%d\r\n”,b);
b = xTimerIsTimerActive(xTTimerHd1);
}
void vTimerCallback2(void)
{
static u8 a = 1;
printf(“slow:%d\r\n”,a++);
}
xTTimerHd1 = xTimerCreate( /* Just a text name, not used by the RTOS kernel. /
“Timer1”,
/ The timer period in ticks, must be greater than 0. /
1000/portTICK_PERIOD_MS,
/ The timers will auto-reload themselves when they
expire. /
pdTRUE,
/ The ID is used to store a count of the number of
times the timer has expired, which is initialized to 0. /
( void * ) 0,
/ Each timer calls the same callback when it expires. /
vTimerCallback );
xTTimerHd2= xTimerCreate( / Just a text name, not used by the RTOS kernel. /
“Timer3”,
/ The timer period in ticks, must be greater than 0. /
2000/portTICK_PERIOD_MS,
/ The timers will auto-reload themselves when they
expire. /
pdTRUE,
/ The ID is used to store a count of the number of
times the timer has expired, which is initialized to 0. /
( void * ) 0,
/ Each timer calls the same callback when it expires. */
vTimerCallback2 );
xTimerStart( xTTimerHd1, 0 );
xTimerStart( xTTimerHd2, 0 );
tms = xTimerIsTimerActive(xTTimerHd1);