From b4fce69fdcc4ed19aacb239107c391786546d0dc Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 9 Feb 2025 10:59:59 +0800 Subject: Only configure non-default values. --- nRF24L01/radio.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'nRF24L01/radio.c') diff --git a/nRF24L01/radio.c b/nRF24L01/radio.c index 097b22f..3dc11f9 100644 --- a/nRF24L01/radio.c +++ b/nRF24L01/radio.c @@ -130,32 +130,17 @@ void radio_init(const struct radio_cfg *cfg) _delay_ms(NRF24L01_POWER_ON_RST_DELAY); + // disable IRQs, set CRC encoding scheme to 2 bytes conf = 0; conf |= (1 << NRF24L01_MASK_RX_DR); conf |= (1 << NRF24L01_MASK_TX_DS); conf |= (1 << NRF24L01_MASK_MAX_RT); - conf |= (1 << NRF24L01_EN_CRC); conf |= (1 << NRF24L01_CRCO); - conf &= ~(1 << NRF24L01_PWR_UP); - conf &= ~(1 << NRF24L01_PRIM_RX); write_reg(NRF24L01_REG_CONFIG, conf); + // only use data pipe 0 conf = 0; - conf |= (1 << NRF24L01_ENAA_P5); - conf |= (1 << NRF24L01_ENAA_P4); - conf |= (1 << NRF24L01_ENAA_P3); - conf |= (1 << NRF24L01_ENAA_P2); - conf |= (1 << NRF24L01_ENAA_P1); - conf |= (1 << NRF24L01_ENAA_P0); - - write_reg(NRF24L01_REG_EN_AA, conf); - - conf = 0; - conf &= ~(1 << NRF24L01_ERX_P5); - conf &= ~(1 << NRF24L01_ERX_P4); - conf &= ~(1 << NRF24L01_ERX_P3); - conf &= ~(1 << NRF24L01_ERX_P2); conf &= ~(1 << NRF24L01_ERX_P1); conf |= (1 << NRF24L01_ERX_P0); -- cgit v1.2.3