在使用过程中怎么调用迟延函数

发布于 2024-05-04 09:56:33

假如我想在两段代码中间,加一个1s的迟延,应该如何操作?
有没有大佬给个示例?

查看更多

关注者
0
被浏览
1k
AnatolSher
AnatolSher 认证专家 2024-05-04
Lover of the ocean, yachts and Arduino

Depends on the SDK you are using. In HAL 0.6.0 - HAL_Delay(1000). In W80x-SDK you can pull the delay() function from iperf_timer.c
It usually works in microseconds. But delay maybe not less than 1 milliseconds. It will look like this for you

extern int delay(int us);
//your code
int ms = 1000; //1s = 1000 ms
delay(ms*1000); // in uS
//your code

If you need to call a specific function every 1 second, you can use vApplicationTickHook or RTOS timers
For example
image.png
in vApplicationTickHook() you can creat a counter
Or create a separate RTOS task

3 个回答
130****5949
130****5949 2024-05-04
这家伙很懒,什么也没写!

我用的是w801开发板

abcd
abcd 认证专家 2024-05-06
我只是个路过的老年人~

tls_os_time_delay(1 * HZ);

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览