W801_SDK_dev_env/demo/wm_timer_demo.c
2023-03-08 08:23:45 +01:00

41 lines
554 B
C

#include <string.h>
#include "wm_include.h"
#include "wm_demo.h"
#include "wm_timer.h"
#if DEMO_TIMER
static void demo_timer_irq(u8 *arg)
{
printf("timer irq\n");
}
int timer_demo(void)
{
u8 timer_id;
struct tls_timer_cfg timer_cfg;
timer_cfg.unit = TLS_TIMER_UNIT_MS;
timer_cfg.timeout = 2000;
timer_cfg.is_repeat = 1;
timer_cfg.callback = (tls_timer_irq_callback)demo_timer_irq;
timer_cfg.arg = NULL;
timer_id = tls_timer_create(&timer_cfg);
tls_timer_start(timer_id);
printf("timer start\n");
return WM_SUCCESS;
}
#endif