void user_timer_cb(OS_TIMER xTimer)
{
//add your code
}
/* Create the OS timer */
OS_TIMER rtc_dbg_h;
rtc_dbg_h = OS_TIMER_CREATE("RCX",
OS_MS_2_TICKS(1000), OS_TIMER_SUCCESS,
(void *) OS_GET_CURRENT_TASK(),
user_timer_cb);
OS_ASSERT(rtc_dbg_h);
/* Start the OS timer */
OS_TIMER_START(rtc_dbg_h, OS_TIMER_FOREVER);
看以上代码,一目了然, 没错,软件定时器就是这么简单。