1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 17:43:51 +01:00

pkg/openthread: migrate to ztimer

This commit is contained in:
Alexandre Abadie 2021-11-03 10:19:13 +01:00
parent 45add49342
commit c31dae311a
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 7 additions and 9 deletions

View File

@ -3,7 +3,8 @@ USEMODULE += openthread_contrib
USEMODULE += netdev
USEMODULE += openthread_contrib_netdev
USEMODULE += l2util
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_msec
USEMODULE += event
FEATURES_REQUIRED += cpp

View File

@ -21,7 +21,6 @@
#include "ot.h"
#include "random.h"
#include "thread.h"
#include "xtimer.h"
#ifdef MODULE_AT86RF2XX
#include "at86rf2xx.h"

View File

@ -22,8 +22,7 @@
#include "openthread/platform/alarm-milli.h"
#include "ot.h"
#include "thread.h"
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -44,7 +43,7 @@ void _timeout_cb(void *arg)
event_post(openthread_get_evq(), &ev_timer);
}
static xtimer_t ot_timer = {
static ztimer_t ot_timer = {
.callback = _timeout_cb,
};
@ -66,8 +65,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
event_post(openthread_get_evq(), &ev_timer);
}
else {
int dt = aDt * US_PER_MS;
xtimer_set(&ot_timer, dt);
ztimer_set(ZTIMER_MSEC, &ot_timer, aDt);
}
}
@ -76,13 +74,13 @@ void otPlatAlarmMilliStop(otInstance *aInstance)
{
(void)aInstance;
DEBUG("openthread: otPlatAlarmStop\n");
xtimer_remove(&ot_timer);
ztimer_remove(ZTIMER_MSEC, &ot_timer);
}
/* OpenThread will call this for getting running time in millisecs */
uint32_t otPlatAlarmMilliGetNow(void)
{
uint32_t now = xtimer_now_usec() / US_PER_MS;
uint32_t now = ztimer_now(ZTIMER_MSEC);
DEBUG("openthread: otPlatAlarmGetNow: %" PRIu32 "\n", now);
return now;
}