summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/libc/time/posix_sleep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/libc/time/posix_sleep.c b/components/libc/time/posix_sleep.c
index d45b3b945f..e50bda7d4a 100644
--- a/components/libc/time/posix_sleep.c
+++ b/components/libc/time/posix_sleep.c
@@ -8,6 +8,7 @@
* 2020-12-16 Meco Man add usleep
*/
#include <rtthread.h>
+#include <rthw.h>
#include <unistd.h>
unsigned int sleep(unsigned int seconds)
@@ -23,5 +24,7 @@ unsigned int sleep(unsigned int seconds)
int usleep(useconds_t usec)
{
-
+ rt_thread_mdelay(usec / 1000u);
+ rt_hw_us_delay(usec % 1000u);
+ return 0;
}