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:
21:96db08266089
Parent:
17:5f34cbe2ac53
--- a/radio_lr1110.cpp	Fri Jul 10 10:52:39 2020 -0700
+++ b/radio_lr1110.cpp	Fri Feb 05 16:35:05 2021 -0800
@@ -188,6 +188,13 @@
     }
 }
 
+bool Radio::init_irq;
+void Radio::my_irq_handler()
+{
+    /* radio irq immediately after hardware reset: hf_xosc start due to TCXO */
+    init_irq = true;
+}
+
 void Radio::dio9_top_half()
 {
     irqAt = lpt.read_us();
@@ -228,6 +235,7 @@
 
 void Radio::Init(const RadioEvents_t* e, unsigned spi_hz)
 {
+    uint64_t a, b;
     /* initialize payload length to zero in packet params */
     lora_pp_buf[3] = 0;
     gfsk_pp_buf[6] = 0;
@@ -236,14 +244,26 @@
     radio.rxDone = rx_done;
     radio.timeout = timeout_callback;
     //radio.chipModeChange = chipModeChange;
-    radio.dio9_topHalf = dio9_top_half;
 
     RadioEvents = e;
     lpt.start();
 
     spi.frequency(spi_hz);
 
+    radio.dio9_topHalf = my_irq_handler;
+    init_irq = false;
     radio.hw_reset();
+    a = Kernel::get_ms_count();
+    do {
+        b = Kernel::get_ms_count();
+        /* wait for radio interrupt at hardware reset, failure to start hf_xosc */
+        if (init_irq) {
+            radio.service();
+            break;
+        }
+    } while ((b - a) < 30);
+
+    radio.dio9_topHalf = dio9_top_half;
 
     initRfSwDIO();
 }