mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-18 11:03:50 +01:00
pkg/openthread: migrate to ztimer
This commit is contained in:
parent
45add49342
commit
c31dae311a
@ -3,7 +3,8 @@ USEMODULE += openthread_contrib
|
|||||||
USEMODULE += netdev
|
USEMODULE += netdev
|
||||||
USEMODULE += openthread_contrib_netdev
|
USEMODULE += openthread_contrib_netdev
|
||||||
USEMODULE += l2util
|
USEMODULE += l2util
|
||||||
USEMODULE += xtimer
|
USEMODULE += ztimer
|
||||||
|
USEMODULE += ztimer_msec
|
||||||
USEMODULE += event
|
USEMODULE += event
|
||||||
|
|
||||||
FEATURES_REQUIRED += cpp
|
FEATURES_REQUIRED += cpp
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
#include "ot.h"
|
#include "ot.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "xtimer.h"
|
|
||||||
|
|
||||||
#ifdef MODULE_AT86RF2XX
|
#ifdef MODULE_AT86RF2XX
|
||||||
#include "at86rf2xx.h"
|
#include "at86rf2xx.h"
|
||||||
|
|||||||
@ -22,8 +22,7 @@
|
|||||||
#include "openthread/platform/alarm-milli.h"
|
#include "openthread/platform/alarm-milli.h"
|
||||||
#include "ot.h"
|
#include "ot.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "xtimer.h"
|
#include "ztimer.h"
|
||||||
#include "timex.h"
|
|
||||||
|
|
||||||
#define ENABLE_DEBUG 0
|
#define ENABLE_DEBUG 0
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -44,7 +43,7 @@ void _timeout_cb(void *arg)
|
|||||||
event_post(openthread_get_evq(), &ev_timer);
|
event_post(openthread_get_evq(), &ev_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static xtimer_t ot_timer = {
|
static ztimer_t ot_timer = {
|
||||||
.callback = _timeout_cb,
|
.callback = _timeout_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,8 +65,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
|
|||||||
event_post(openthread_get_evq(), &ev_timer);
|
event_post(openthread_get_evq(), &ev_timer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int dt = aDt * US_PER_MS;
|
ztimer_set(ZTIMER_MSEC, &ot_timer, aDt);
|
||||||
xtimer_set(&ot_timer, dt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,13 +74,13 @@ void otPlatAlarmMilliStop(otInstance *aInstance)
|
|||||||
{
|
{
|
||||||
(void)aInstance;
|
(void)aInstance;
|
||||||
DEBUG("openthread: otPlatAlarmStop\n");
|
DEBUG("openthread: otPlatAlarmStop\n");
|
||||||
xtimer_remove(&ot_timer);
|
ztimer_remove(ZTIMER_MSEC, &ot_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OpenThread will call this for getting running time in millisecs */
|
/* OpenThread will call this for getting running time in millisecs */
|
||||||
uint32_t otPlatAlarmMilliGetNow(void)
|
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);
|
DEBUG("openthread: otPlatAlarmGetNow: %" PRIu32 "\n", now);
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user