Hardware Abstraction Layer, permitting any LoRa application to use any LoRa radio chip

Dependents:   alarm_slave alarm_master lora_p2p lorawan1v1 ... more

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.

Pin assigned to arduino LoRa radio shield form-factor

Revision:
20:75635d50262e
Parent:
17:5f34cbe2ac53
--- a/radio_sx128x.cpp	Thu Jun 25 12:39:08 2020 -0700
+++ b/radio_sx128x.cpp	Fri Jul 10 10:52:39 2020 -0700
@@ -3,6 +3,18 @@
 #include "SPIu.h"
 #include <float.h>
 
+#ifdef DEVICE_LPTICKER
+LowPowerTimer Radio::lpt;
+#else
+Timer Radio::lpt;
+#endif
+
+#if (MBED_MAJOR_VERSION < 6)
+volatile us_timestamp_t Radio::irqAt;
+#else
+LowPowerClock::time_point Radio::irqAt;
+#endif
+
 #ifdef TARGET_FF_ARDUINO    /* pins of SX126xDVK1xAS board */
     #define NRST_PIN        A0
     SPIu spi(D11, D12, D13); // mosi, miso, sclk
@@ -43,11 +55,6 @@
     #define RX_INDICATION       pc3
 #endif /* TARGET_FF_MORPHO */
 
-#ifdef DEVICE_LPTICKER
-LowPowerTimer Radio::lpt;
-#else
-Timer Radio::lpt;
-#endif
 
 PacketParams_t Radio::ppGFSK;
 PacketParams_t Radio::ppLORA;
@@ -58,7 +65,6 @@
 ModulationParams_t Radio::mpLORA;
 
 const RadioEvents_t* RadioEvents;
-volatile us_timestamp_t Radio::irqAt;
 
 unsigned Radio::symbolPeriodUs;
 unsigned Radio::nSymbs;
@@ -249,7 +255,11 @@
 
 void Radio:: diox_top_half()
 {
+#if (MBED_MAJOR_VERSION < 6)
     irqAt = lpt.read_us();
+#else
+    irqAt = LowPowerClock::now();
+#endif
 
     if (RadioEvents->DioPin_top_half)
         RadioEvents->DioPin_top_half();
@@ -350,19 +360,35 @@
         int rssi;
         us_timestamp_t startAt, chFreeAt, now;
         radio.start_rx(-1);
+    #if (MBED_MAJOR_VERSION < 6)
         startAt = lpt.read_us();
+    #else
+        startAt = LowPowerClock::now().time_since_epoch().count();
+    #endif
 Lstart:
         do {
+    #if (MBED_MAJOR_VERSION < 6)
             now = lpt.read_us();
+    #else
+            now = LowPowerClock::now().time_since_epoch().count();
+    #endif
             if ((now - startAt) > maxListenTime) {
                 return -1;
             }
             radio.xfer(OPCODE_GET_RSSIINST, 0, 2, buf);
             rssi = buf[1] / -2;
         } while (rssi > rssiThresh);
+    #if (MBED_MAJOR_VERSION < 6)
         chFreeAt = lpt.read_us();
+    #else
+        chFreeAt = LowPowerClock::now().time_since_epoch().count();
+    #endif
         do {
+    #if (MBED_MAJOR_VERSION < 6)
             now = lpt.read_us();
+    #else
+            now = LowPowerClock::now().time_since_epoch().count();
+    #endif
             radio.xfer(OPCODE_GET_RSSIINST, 0, 2, buf);
             rssi = buf[1] / -2;
             if (rssi > rssiThresh) {