[update] usleep supports calling in interrupts.
@@ -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;
}
