在使用過程中怎麼調用遲延函數

發布於 2024-05-04 09:56:33

假如我想在兩段代碼中間,加一個1s的遲延,應該如何操作?
有沒有大佬給個示例?

查看更多

關注者
0
被浏覽
395
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);

撰寫答案

請登錄後再發布答案,點擊登錄

發布
問題

分享
好友

手機
浏覽

掃碼手機浏覽