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:
parent
754e272d74
commit
634d3df844
@ -14,7 +14,8 @@ menuconfig MODULE_AT86RF2XX
|
|||||||
select MODULE_NETDEV
|
select MODULE_NETDEV
|
||||||
select MODULE_NETDEV_IEEE802154
|
select MODULE_NETDEV_IEEE802154
|
||||||
select MODULE_NETDEV_LEGACY_API
|
select MODULE_NETDEV_LEGACY_API
|
||||||
select MODULE_XTIMER
|
select MODULE_ZTIMER
|
||||||
|
select MODULE_ZTIMER_USEC
|
||||||
|
|
||||||
if MODULE_AT86RF2XX
|
if MODULE_AT86RF2XX
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
DEFAULT_MODULE += auto_init_at86rf2xx
|
DEFAULT_MODULE += auto_init_at86rf2xx
|
||||||
DEFAULT_MODULE += netdev_ieee802154_oqpsk
|
DEFAULT_MODULE += netdev_ieee802154_oqpsk
|
||||||
|
|
||||||
USEMODULE += xtimer
|
USEMODULE += ztimer
|
||||||
|
USEMODULE += ztimer_usec
|
||||||
USEMODULE += ieee802154
|
USEMODULE += ieee802154
|
||||||
USEMODULE += netdev_ieee802154
|
USEMODULE += netdev_ieee802154
|
||||||
USEMODULE += netdev_legacy_api
|
USEMODULE += netdev_legacy_api
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "xtimer.h"
|
#include "ztimer.h"
|
||||||
#include "periph/spi.h"
|
#include "periph/spi.h"
|
||||||
#include "at86rf2xx_aes.h"
|
#include "at86rf2xx_aes.h"
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ uint8_t _aes_status(at86rf2xx_t *dev)
|
|||||||
static inline
|
static inline
|
||||||
void _aes_wait_for_result(at86rf2xx_t *dev)
|
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);
|
uint8_t status = _aes_status(dev);
|
||||||
/*
|
/*
|
||||||
If this assert fires, there probably is an implementation error.
|
If this assert fires, there probably is an implementation error.
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xtimer.h"
|
#include "ztimer.h"
|
||||||
#include "at86rf2xx_internal.h"
|
#include "at86rf2xx_internal.h"
|
||||||
#include "at86rf2xx_registers.h"
|
#include "at86rf2xx_registers.h"
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ void at86rf2xx_assert_awake(at86rf2xx_t *dev)
|
|||||||
#else
|
#else
|
||||||
gpio_clear(dev->params.sleep_pin);
|
gpio_clear(dev->params.sleep_pin);
|
||||||
#endif
|
#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
|
* may be inaccurate or the radio itself may take longer
|
||||||
* to wake up due to extra capacitance on the oscillator.
|
* to wake up due to extra capacitance on the oscillator.
|
||||||
* Spin until we are actually awake
|
* Spin until we are actually awake
|
||||||
@ -149,10 +149,10 @@ void at86rf2xx_hardware_reset(at86rf2xx_t *dev)
|
|||||||
*(AT86RF2XX_REG__TRXPR) |= AT86RF2XX_TRXPR_TRXRST;
|
*(AT86RF2XX_REG__TRXPR) |= AT86RF2XX_TRXPR_TRXRST;
|
||||||
#else
|
#else
|
||||||
gpio_clear(dev->params.reset_pin);
|
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);
|
gpio_set(dev->params.reset_pin);
|
||||||
#endif
|
#endif
|
||||||
xtimer_usleep(AT86RF2XX_RESET_DELAY);
|
ztimer_sleep(ZTIMER_USEC, AT86RF2XX_RESET_DELAY);
|
||||||
|
|
||||||
/* update state: if the radio state was P_ON (initialization phase),
|
/* update state: if the radio state was P_ON (initialization phase),
|
||||||
* it remains P_ON. Otherwise, it should go to TRX_OFF
|
* it remains P_ON. Otherwise, it should go to TRX_OFF
|
||||||
|
@ -65,7 +65,7 @@ extern "C" {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Minimum reset pulse width, refer p.190. We use 62us so
|
* @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)
|
#define AT86RF2XX_RESET_PULSE_WIDTH (62U)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user