Basic LoRa receiver example

Dependencies:   sx12xx_hal

radio chip selection

Radio chip driver is not included, allowing choice of radio device.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
if you're using SX1280, then import sx1280 driver into your program.
if you're using LR1110, then import LR1110 driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.
If you're using Type1SJ select target DISCO_L072CZ_LRWAN1 and import sx126x driver into your program.

On default serial port, this project will print out (at 9600bps) reset-rx once at startup.

Use project simple_tx on transmtting end.

Revision:
0:7c7b86c38e6f
Child:
2:5e56875de51b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jul 17 16:20:11 2018 -0700
@@ -0,0 +1,69 @@
+#include "radio.h"
+
+#if defined(SX127x_H)
+    #define BW_KHZ              125
+    #define SPREADING_FACTOR    7
+    #define CF_HZ               915000000
+#elif defined(SX126x_H)
+    #define BW_KHZ              125
+    #define SPREADING_FACTOR    7
+    #define CF_HZ               915000000
+#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("%02x ", Radio::radio.rx_buf[i]);
+    }
+    printf("\r\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::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();
+    }
+}
+