提交 66b7289e 编写于 作者: G guozhanxin

[update] usleep supports calling in interrupts.

上级 8a274211
......@@ -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.
先完成此消息的编辑!
想要评论请 注册