1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #15627 from maribu/ztimer_xtimer_compat

sys/ztimer: fix xtimer_compat
This commit is contained in:
Martine Lenders 2020-12-14 13:16:15 +01:00 committed by GitHub
commit dae714ce81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,9 +19,13 @@
#ifndef ZTIMER_XTIMER_COMPAT_H
#define ZTIMER_XTIMER_COMPAT_H
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
/* make sure to overwrite potentially conflicting XTIMER_WIDTH definition from
* board.h by eagerly including it */
#include "board.h"
#include "div.h"
#include "timex.h"
#ifdef MODULE_CORE_MSG
@ -41,6 +45,13 @@ extern "C" {
*/
#ifndef DOXYGEN
/* ztimer clocks with width lower than 32 bit get extended to 32 bit in software
* via ztimer_extend. So no matter what was defined elsewhere, we overwrite it
*/
#ifdef XTIMER_WIDTH
#undef XTIMER_WIDTH
#endif
#define XTIMER_WIDTH (32)
#define XTIMER_MASK (0)
@ -185,6 +196,7 @@ static inline void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout)
static inline void xtimer_set_timeout_flag64(xtimer_t *t, uint64_t timeout)
{
assert(timeout <= UINT32_MAX);
xtimer_set_timeout_flag(t, timeout);
}