1
0
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:
Alexandre Abadie 2020-10-26 22:43:47 +01:00
parent 68a2a5dab0
commit abcdc7968a
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 11 additions and 5 deletions

View File

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

View File

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