创建定时器如何使用了?

发布于 2023-12-12 10: 28: 05

tls_os_timer_create 创建成功了, tls_os_timer_start 一开启定时器就报错

ret = tls_os_timer_create (ctx-" mqtt_demo_heartbeat_timer,

                    mqtt_demo_heart_timer, 
                    NULL,   (10 * HZ) ,  TRUE,  NULL) ; 
                
                wm_printf ("ret: %d\n", ret) ; 
                if (ret == TLS_OS_SUCCESS) 
                {
                    tls_os_timer_start (ctx-" mqtt_demo_heartbeat_timer) ; 
                }

查看更多

关注者
0
被浏览
642
2 个回答
solid_2022
solid_2022 2023-12-12
这家伙很懒, 什么也没写!

参考 wm_timer_demo. c 写是可以的, 但不是 os 的

792711732
792711732 2024-01-02
这家伙很懒, 什么也没写!

u8 timer_id;
struct tls_timer_cfg timer_cfg;

timer_cfg. unit = TLS_TIMER_UNIT_MS;
timer_cfg. timeout = 1000;
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) ;
用这个定时器

撰写答案

请登录后再发布答案, 点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览