Go to the documentation of this file.
19 #ifndef ZTIMER_XTIMER_COMPAT_H
20 #define ZTIMER_XTIMER_COMPAT_H
27 #ifdef MODULE_CORE_MSG
71 static inline void _ztimer_sleep_scale(
ztimer_clock_t *clock, uint32_t time, uint32_t scale)
73 const uint32_t max_sleep = UINT32_MAX / scale;
75 while (time > max_sleep) {
98 _ztimer_sleep_scale(
ZTIMER_USEC, milliseconds, 1000);
void ztimer_remove(ztimer_clock_t *clock, ztimer_t *timer)
Remove a timer from a clock.
int16_t kernel_pid_t
Unique process identifier.
struct xtimer xtimer_t
xtimer timer structure
static void xtimer_periodic_wakeup(xtimer_ticks32_t *last_wakeup, uint32_t period)
will cause the calling thread to be suspended until the absolute time (last_wakeup + period).
void xtimer_now_timex(timex_t *out)
get the current system time into a timex_t
#define NS_PER_US
The number of nanoseconds per microsecond.
static xtimer_ticks64_t xtimer_now64(void)
get the current system time as 64bit time stamp
static xtimer_ticks32_t xtimer_now(void)
get the current system time as 32bit time stamp value
static uint32_t xtimer_now_usec(void)
get the current system time in microseconds since start
static void xtimer_msleep(uint32_t milliseconds)
Pause the execution of a thread for some milliseconds.
Messaging API for inter process communication.
Scheduler API definition.
static xtimer_ticks32_t xtimer_ticks_from_usec(uint32_t usec)
Convert microseconds to xtimer ticks.
ztimer_clock_t *const ZTIMER_MSEC
Default ztimer millisecond clock.
void ztimer_sleep(ztimer_clock_t *clock, uint32_t duration)
Put the calling thread to sleep for the specified number of ticks.
Utility library for comparing and computing timestamps.
void ztimer_set(ztimer_clock_t *clock, ztimer_t *timer, uint32_t val)
Set a timer on a clock.
static void xtimer_set(xtimer_t *timer, uint32_t offset)
Set a timer to execute a callback at some time in the future.
time_point now()
Returns the current time saved in a time point.
ztimer_clock_t *const ZTIMER_USEC
Default ztimer microsecond clock.
static void xtimer_usleep(uint32_t microseconds)
Pause the execution of a thread for some microseconds.
#define IS_ACTIVE(macro)
Allows to verify a macro definition outside the preprocessor.
static uint64_t div_u64_by_1000000(uint64_t val)
Integer divide val by 1000000.
int ztimer_msg_receive_timeout(ztimer_clock_t *clock, msg_t *msg, uint32_t timeout)
receive a message (blocking, with timeout)
static void xtimer_set_msg(xtimer_t *timer, uint32_t offset, msg_t *msg, kernel_pid_t target_pid)
Set a timer that sends a message.
static int xtimer_msg_receive_timeout(msg_t *msg, uint32_t timeout)
receive a message blocking but with timeout
uint32_t microseconds
number of microseconds
xtimer timestamp (32 bit)
static void xtimer_nanosleep(uint32_t nanoseconds)
Stop execution of a thread for some time.
uint32_t seconds
number of seconds
Mutex for thread synchronization.
xtimer timestamp (64 bit)
static uint32_t xtimer_usec_from_ticks(xtimer_ticks32_t ticks)
Convert xtimer ticks to microseconds.
static void xtimer_set_wakeup(xtimer_t *timer, uint32_t offset, kernel_pid_t pid)
Set a timer that wakes up a thread.
void ztimer_periodic_wakeup(ztimer_clock_t *clock, uint32_t *last_wakeup, uint32_t period)
Suspend the calling thread until the time (last_wakeup + period)
static void xtimer_sleep(uint32_t seconds)
Pause the execution of a thread for some seconds.
Describes a message object which can be sent between threads.
void ztimer_set_msg(ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset, msg_t *msg, kernel_pid_t target_pid)
Post a message after a delay.
static ztimer_now_t ztimer_now(ztimer_clock_t *clock)
Get the current time from a clock.
static uint64_t xtimer_now_usec64(void)
get the current system time in microseconds since start
void xtimer_remove(xtimer_t *timer)
remove a timer
void ztimer_set_wakeup(ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset, kernel_pid_t pid)
Set a timer that wakes up a thread.
#define US_PER_SEC
The number of microseconds per second.