Simple receiver application for SX127x radio.
Dependencies: MbedJSONValue SX127x sx12xx_hal
Diff: main.cpp
- Revision:
- 1:8cd5f8492271
- Parent:
- 0:f843ca4a8e98
- Child:
- 2:fef452211079
--- a/main.cpp Sat Dec 15 18:10:28 2018 +0000 +++ b/main.cpp Thu Mar 21 08:51:01 2019 +0000 @@ -1,9 +1,11 @@ #include "radio.h" +// Semtech radio definitions for SX127x, SX126x and SX128x + #if defined(SX127x_H) #define BW_KHZ 500 - #define SPREADING_FACTOR 10 - #define CF_HZ 913000000 + #define SPREADING_FACTOR 11 + #define CF_HZ 912000000 #elif defined(SX126x_H) #define BW_KHZ 500 #define SPREADING_FACTOR 10 @@ -29,6 +31,8 @@ myled.write(!myled.read()); // toggle LED + // Display payload packet information + for (i = 0; i < size; i++) { printf("%02d ", Radio::radio.rx_buf[i]); // Changed to "%02d \n" } @@ -49,17 +53,24 @@ int main() { + + // POR & Reset debug message + printf("\r\nreset-rx\r\n"); Radio::Init(&rev); - //Radio::radio.hw_reset(); Comment out to make it work!!!! + // Radio Start + Radio::Standby(); Radio::LoRaModemConfig(BW_KHZ, SPREADING_FACTOR, 1); Radio::SetChannel(CF_HZ); - // preambleLen, fixLen, crcOn, invIQ + // preambleLen, fixLen, crcOn, invIQ + Radio::LoRaPacketConfig(8, false, true, false); + + // Start radio receiver, wait for packets from transmitter Radio::Rx(0);