mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/posix/sleep: use ztimer instead of xtimer
This commit is contained in:
parent
68a2a5dab0
commit
abcdc7968a
@ -562,7 +562,11 @@ ifneq (,$(filter posix_semaphore,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter posix_sleep,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer_msec
|
||||
ifneq (,$(filter periph_rtt,$(USEMODULE)))
|
||||
USEMODULE += ztimer_periph_rtt
|
||||
endif
|
||||
USEMODULE += ztimer_usec
|
||||
USEMODULE += posix_headers
|
||||
endif
|
||||
|
||||
|
@ -11,23 +11,25 @@
|
||||
*
|
||||
* @{
|
||||
* @file
|
||||
* @brief xtimer posix wrapper
|
||||
* @brief posix sleep/usleep implementation wrapped around @ref ztimer
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "kernel_defines.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
unsigned int sleep(unsigned int seconds)
|
||||
{
|
||||
xtimer_usleep64(seconds * US_PER_SEC);
|
||||
ztimer_sleep(ZTIMER_MSEC, seconds * MS_PER_SEC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
xtimer_usleep64(usec);
|
||||
ztimer_sleep(ZTIMER_USEC, usec);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user