mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-31 13:20:26 +08:00
实现 usleep
This commit is contained in:
parent
702103a203
commit
9d004a2892
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user