实现 usleep

This commit is contained in:
mysterywolf 2020-12-16 15:34:41 +08:00
parent 702103a203
commit 9d004a2892
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}