OpenHarmony开发者论坛
标题:
Generic Wait Functions有没有sleep函数?
[打印本页]
作者:
wwwop
时间:
2023-11-14 13:16
标题:
Generic Wait Functions有没有sleep函数?
[md]Generic Wait Functions有没有sleep函数?
[/md]
作者:
dragon
时间:
2023-11-14 20:02
标题:
Generic Wait Functions有没有sleep函数?
自己写一个吧:
void Sleep(int ms)
{
uint32_t tickFreq = osKernelGetTickFreq();
uint32_t msPerTick = 1000 / tickFreq;
osDelay(ms / msPerTick);
uint32_t restMs = ms % msPerTick;
if (restMs) {
usleep(restMs * 1000);
}
}
复制代码
欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/)
Powered by Discuz! X3.5