Initial Commit
Dependencies: SX127x sx12xx_hal
main.cpp
- Committer:
- LoRaToolbox
- Date:
- 2018-12-15
- Revision:
- 0:f843ca4a8e98
- Child:
- 1:8cd5f8492271
File content as of revision 0:f843ca4a8e98:
#include "radio.h" #if defined(SX127x_H) #define BW_KHZ 500 #define SPREADING_FACTOR 10 #define CF_HZ 913000000 #elif defined(SX126x_H) #define BW_KHZ 500 #define SPREADING_FACTOR 10 #define CF_HZ 913000000 #elif defined(SX128x_H) #define BW_KHZ 200 #define SPREADING_FACTOR 7 #define CF_HZ 2487000000 #endif DigitalOut myled(LED1); /**********************************************************************/ void txDoneCB() { } void rxDoneCB(uint8_t size, float rssi, float snr) { unsigned i; printf("%.1fdBm snr:%.1fdB\t", rssi, snr); myled.write(!myled.read()); // toggle LED for (i = 0; i < size; i++) { printf("%02d ", Radio::radio.rx_buf[i]); // Changed to "%02d \n" } printf("\r\n\n"); } const RadioEvents_t rev = { /* Dio0_top_half */ NULL, /* TxDone_topHalf */ NULL, /* TxDone_botHalf */ txDoneCB, /* TxTimeout */ NULL, /* RxDone */ rxDoneCB, /* RxTimeout */ NULL, /* RxError */ NULL, /* FhssChangeChannel */NULL, /* CadDone */ NULL }; int main() { printf("\r\nreset-rx\r\n"); Radio::Init(&rev); //Radio::radio.hw_reset(); Comment out to make it work!!!! Radio::Standby(); Radio::LoRaModemConfig(BW_KHZ, SPREADING_FACTOR, 1); Radio::SetChannel(CF_HZ); // preambleLen, fixLen, crcOn, invIQ Radio::LoRaPacketConfig(8, false, true, false); Radio::Rx(0); for (;;) { Radio::service(); } }