diff options
| author | mysterywolf <[email protected]> | 2020-12-16 15:34:41 +0800 |
|---|---|---|
| committer | mysterywolf <[email protected]> | 2020-12-16 15:34:41 +0800 |
| commit | 9d004a2892394436e3a07a5dfb3e0fa9e8076433 (patch) | |
| tree | 5b492b3fe5bcef523c86d390bc85af2d733e9fea /components/libc | |
| parent | 702103a2037c7958f20b668aa138e4975a802c02 (diff) | |
实现 usleep
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/time/posix_sleep.c | 5 |
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; } |
