diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-02-09 10:59:59 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-02-09 10:59:59 +0800 |
| commit | b4fce69fdcc4ed19aacb239107c391786546d0dc (patch) | |
| tree | f6a2e33cf549d2b54e17222f3e18d3f3244ae7ff | |
| parent | 141493fadd172c9cf529fd31355983f752829e87 (diff) | |
| download | smart-home-b4fce69fdcc4ed19aacb239107c391786546d0dc.tar.gz | |
Only configure non-default values.
| -rw-r--r-- | nRF24L01/radio.c | 19 |
1 files changed, 2 insertions, 17 deletions
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); |
