tls_os_time_delay 函数问题

发布于 2024-01-12 22: 59: 28

SDK 版本 W80X_SDK_v1. 00. 10

简单加了个统计帧率:

include "wm_timer. h"

unsigned int FrameCount=0;
static void fps_timer_irq (u8 *arg)
{

printf ("%f fps\n",  ( (float) FrameCount / 5) ) ; 
FrameCount=0; 

}
void timer_fps (void)
{

u8 timer_id2; 
struct tls_timer_cfg timer_cfg2; 


timer_cfg2. unit = TLS_TIMER_UNIT_MS; 
timer_cfg2. timeout = 5000; 
timer_cfg2. is_repeat = 1; 
timer_cfg2. callback =  (tls_timer_irq_callback) fps_timer_irq; 
timer_cfg2. arg = NULL; 
timer_id2 = tls_timer_create (&timer_cfg2) ; 
tls_timer_start (timer_id2) ; 
printf ("timer start\n") ;     

}

void UserMain (void)
{

timer_fps () ; 
printf ("\n user task \n") ; 

while (1) {
    FrameCount ++; 
    tls_os_time_delay (100) ; 
}

if DEMO_CONSOLE

CreateDemoTask () ; 

endif

//用户自己的 task
}

当入参为 100 时, 实际输出 5. 000000 fps
当入参为 1 时, 实际输出 500. 0000 fps
就是说, 我希望 delay N ms, 实际 delay 了 2N ms.
是我哪个地方没写对么?

查看更多

关注者
0
被浏览
769
1 个回答
isme
isme 认证专家 2024-01-15
冰镇大西瓜

image. png
改为 1000 一个 tick 就是 1ms

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览