From 9c1076e7f7ff00761412720fbdaf9ae5ed1bbd01 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Tue, 31 Jan 2023 15:49:56 +0200 Subject: [PATCH] drivers: ieee802154_rf2xx: Remove magic number Define and use RF2XX_TRAC_STATUS instead of magic number. Signed-off-by: Andrei Emeltchenko --- drivers/ieee802154/ieee802154_rf2xx.c | 2 +- drivers/ieee802154/ieee802154_rf2xx_regs.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_rf2xx.c b/drivers/ieee802154/ieee802154_rf2xx.c index d255aa30c9..d9c8a6b6f1 100644 --- a/drivers/ieee802154/ieee802154_rf2xx.c +++ b/drivers/ieee802154/ieee802154_rf2xx.c @@ -267,7 +267,7 @@ static void rf2xx_process_tx_frame(const struct device *dev) struct rf2xx_context *ctx = dev->data; ctx->trx_trac = (rf2xx_iface_reg_read(dev, RF2XX_TRX_STATE_REG) >> - RF2XX_TRAC_STATUS) & 7; + RF2XX_TRAC_STATUS) & RF2XX_TRAC_BIT_MASK; k_sem_give(&ctx->trx_tx_sync); rf2xx_trx_set_rx_state(dev); } diff --git a/drivers/ieee802154/ieee802154_rf2xx_regs.h b/drivers/ieee802154/ieee802154_rf2xx_regs.h index c87dfdd5a3..d780b9a801 100644 --- a/drivers/ieee802154/ieee802154_rf2xx_regs.h +++ b/drivers/ieee802154/ieee802154_rf2xx_regs.h @@ -100,6 +100,7 @@ /* TRX_STATE */ #define RF2XX_TRAC_STATUS 5 #define RF2XX_TRX_CMD 0 +#define RF2XX_TRAC_BIT_MASK 7 /* TRX_CTRL_0 */ #define RF2XX_TOM_EN 7 @@ -295,6 +296,6 @@ /* RX_STATUS */ #define RF2XX_RX_TRAC_STATUS 4 -#define RF2XX_RX_TRAC_BIT_MASK 0x07 +#define RF2XX_RX_TRAC_BIT_MASK RF2XX_TRAC_BIT_MASK #endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_RF2XX_REGS_H_ */