1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/at86rf2xx: migrate to ztimer

This commit is contained in:
Jue 2022-10-29 20:15:16 +02:00
parent 754e272d74
commit 634d3df844
5 changed files with 12 additions and 10 deletions

View File

@ -14,7 +14,8 @@ menuconfig MODULE_AT86RF2XX
select MODULE_NETDEV
select MODULE_NETDEV_IEEE802154
select MODULE_NETDEV_LEGACY_API
select MODULE_XTIMER
select MODULE_ZTIMER
select MODULE_ZTIMER_USEC
if MODULE_AT86RF2XX

View File

@ -1,7 +1,8 @@
DEFAULT_MODULE += auto_init_at86rf2xx
DEFAULT_MODULE += netdev_ieee802154_oqpsk
USEMODULE += xtimer
USEMODULE += ztimer
USEMODULE += ztimer_usec
USEMODULE += ieee802154
USEMODULE += netdev_ieee802154
USEMODULE += netdev_legacy_api

View File

@ -18,7 +18,7 @@
#include <assert.h>
#include "xtimer.h"
#include "ztimer.h"
#include "periph/spi.h"
#include "at86rf2xx_aes.h"
@ -55,7 +55,7 @@ uint8_t _aes_status(at86rf2xx_t *dev)
static inline
void _aes_wait_for_result(at86rf2xx_t *dev)
{
xtimer_usleep(AT86RF2XX_AES_DELAY_US);
ztimer_sleep(ZTIMER_USEC, AT86RF2XX_AES_DELAY_US);
uint8_t status = _aes_status(dev);
/*
If this assert fires, there probably is an implementation error.

View File

@ -21,7 +21,7 @@
* @}
*/
#include "xtimer.h"
#include "ztimer.h"
#include "at86rf2xx_internal.h"
#include "at86rf2xx_registers.h"
@ -127,9 +127,9 @@ void at86rf2xx_assert_awake(at86rf2xx_t *dev)
#else
gpio_clear(dev->params.sleep_pin);
#endif
xtimer_usleep(AT86RF2XX_WAKEUP_DELAY);
ztimer_sleep(ZTIMER_USEC, AT86RF2XX_WAKEUP_DELAY);
/* update state: on some platforms, the timer behind xtimer
/* update state: on some platforms, the timer behind ztimer
* may be inaccurate or the radio itself may take longer
* to wake up due to extra capacitance on the oscillator.
* Spin until we are actually awake
@ -149,10 +149,10 @@ void at86rf2xx_hardware_reset(at86rf2xx_t *dev)
*(AT86RF2XX_REG__TRXPR) |= AT86RF2XX_TRXPR_TRXRST;
#else
gpio_clear(dev->params.reset_pin);
xtimer_usleep(AT86RF2XX_RESET_PULSE_WIDTH);
ztimer_sleep(ZTIMER_USEC, AT86RF2XX_RESET_PULSE_WIDTH);
gpio_set(dev->params.reset_pin);
#endif
xtimer_usleep(AT86RF2XX_RESET_DELAY);
ztimer_sleep(ZTIMER_USEC, AT86RF2XX_RESET_DELAY);
/* update state: if the radio state was P_ON (initialization phase),
* it remains P_ON. Otherwise, it should go to TRX_OFF

View File

@ -65,7 +65,7 @@ extern "C" {
/**
* @brief Minimum reset pulse width, refer p.190. We use 62us so
* that it is at least one tick on platforms with coarse xtimers
* that it is at least one tick on platforms with coarse ztimers
*/
#define AT86RF2XX_RESET_PULSE_WIDTH (62U)