|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Layer: Foundation ยท Build flags: PC_ENABLE_LORA, PC_ENABLE_GATEWAY
The radio-plugin half of RadioGateway: instead of a simulated feed, this drives an actual Semtech SX127x / RFM95-96 over SPI and bridges its frames to the gateway.
The services/lora module has two layers, and only the first is hardware-specific:
pc_lora_bus (two callbacks that read / write a chip register). Here they are a few SPI transfers; that is the only code tied to your board.pc_lora_frame_parse / pc_lora_frame_build handle the RadioHead 4-byte header (to / from / id / flags) that sits on top of the header-less LoRa PHY.A downlink (a northbound command) is the mirror: pc_lora_frame_build() then pc_lora_send(), driven by the gateway port's transmit callback.
| RFM95 | ESP32 |
|---|---|
| SCK | GPIO 18 |
| MISO | GPIO 19 |
| MOSI | GPIO 23 |
| NSS | GPIO 5 |
| RST | GPIO 14 |
| DIO0 | GPIO 26 |
| VCC | 3V3 |
| GND | GND |
Change the PIN_* constants for your board. A production build triggers RX off the DIO0 interrupt and rides the DMA + FORWARD-lane path (RadioGateway); this sketch polls to stay simple. It needs the module wired to actually receive - the codec and the register protocol are host-tested in test/test_lora.
The flags must reach the library build, so pass them as build flags: