SDK版本W80X_SDK_v1.00.10
简单加了个统计帧率:
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);
}
CreateDemoTask();
//用户自己的task
}
当入参为100时,实际输出5.000000 fps
当入参为1时,实际输出500.0000 fps
就是说,我希望delay N ms,实际delay了2N ms.
是我哪个地方没写对么?