mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-22 07:35:39 +08:00
[update] usleep supports calling in interrupts.
This commit is contained in:
parent
8a274211f1
commit
66b7289ee7
@ -55,7 +55,14 @@ RTM_EXPORT(sleep);
|
|||||||
|
|
||||||
int usleep(useconds_t usec)
|
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);
|
rt_hw_us_delay(usec % 1000u);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user