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
被浏览
1.4k
1 个回答
isme
isme 认证专家 2024-01-15
冰镇大西瓜

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

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览