Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/at86rf2xx: migrate to ztimer #18822

Merged
merged 3 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/at86rf2xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion drivers/at86rf2xx/Makefile.dep
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions drivers/at86rf2xx/aes_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <assert.h>

#include "xtimer.h"
#include "ztimer.h"
#include "periph/spi.h"
#include "at86rf2xx_aes.h"

Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions drivers/at86rf2xx/at86rf2xx_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @}
*/

#include "xtimer.h"
#include "ztimer.h"
#include "at86rf2xx_internal.h"
#include "at86rf2xx_registers.h"

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/at86rf2xx/include/at86rf2xx_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions sys/net/gnrc/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,6 @@ ifneq (,$(filter gnrc_lwmac,$(USEMODULE)))
USEMODULE += gnrc_netif
USEMODULE += gnrc_nettype_lwmac
USEMODULE += gnrc_mac
USEMODULE += xtimer
FEATURES_REQUIRED += periph_rtt
endif
1 change: 0 additions & 1 deletion tests/driver_at86rf2xx_aes/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <stdio.h>
#include <string.h>

#include "xtimer.h"
#include "at86rf2xx.h"
#include "at86rf2xx_params.h"
#include "at86rf2xx_aes.h"
Expand Down