未验证 提交 302c8bf2 编写于 作者: G guo 提交者: GitHub

Merge pull request #4797 from Guozhanxin/usleep

[update] usleep supports calling in interrupts.
......@@ -55,7 +55,14 @@ RTM_EXPORT(sleep);
int usleep(useconds_t usec)
{
rt_thread_mdelay(usec / 1000u);
if (rt_thread_self() != RT_NULL)
{
rt_thread_mdelay(usec / 1000u);
}
else
{
rt_hw_us_delay(usec / 1000u);
}
rt_hw_us_delay(usec % 1000u);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册