Merge pull request #4797 from Guozhanxin/usleep
[update] usleep supports calling in interrupts.
This commit is contained in:
commit
302c8bf23f
|
@ -54,8 +54,15 @@ unsigned int sleep(unsigned int seconds)
|
|||
RTM_EXPORT(sleep);
|
||||
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue