|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Layer: Foundation ยท Build flags: PC_ENABLE_NRF24, PC_ENABLE_GATEWAY
A second radio driver plugged into the gateway - the cheap, ubiquitous Nordic nRF24L01+ 2.4 GHz module. It shows that a different bus shape drops into the same gateway: where the SX127x is plain register read/write, the nRF24 uses an SPI command protocol and a separate CE pin, so its nrf_bus carries an SPI transfer plus a CE callback.
The nRF24 does its own hardware addressing: a received frame's source is the pipe number it arrived on, so there is no in-payload header (no codec) - the pipe is the address handed to pc_gateway_uplink(). Payloads are a static width (PC_NRF24_PAYLOAD, default 32); a short send is zero-padded.
| nRF24 | ESP32 |
|---|---|
| SCK | GPIO 18 |
| MISO | GPIO 19 |
| MOSI | GPIO 23 |
| CSN | GPIO 5 |
| CE | GPIO 4 |
| VCC | 3V3 |
| GND | GND |
Change the PIN_* constants for your board (a 10 uF cap across VCC/GND helps the module's TX current spikes). It needs the module wired to actually receive - the SPI command protocol is host-tested in test/test_nrf24.
The flags must reach the library build, so pass them as build flags: