4.6 软件定时器
<pre><code>#include "wm_include.h"
tls_os_timer_t *demo_os_timer = NULL;
static void demo_os_timer_irq(void *ptmr, void *parg)
{
pritnf("---> os timer irq\n");
}
void UserMain(void)
{
printf("\n user task \n");
// 创建软件定时器 1s 循环定时
tls_os_status_t ret = tls_os_timer_create(&demo_os_timer,
demo_os_timer_irq,
NULL, (1 * HZ), TRUE, NULL);
if (TLS_OS_SUCCESS == ret)
tls_os_timer_start(demo_os_timer);
#if DEMO_CONSOLE
CreateDemoTask();
#endif
//用户自己的task
}
</code></pre>