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.
是我哪个地方没写对么?