Text menu driven ANSI/VT100 console test utility for LoRa transceivers

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.

This is VT100 text-based menu driven test program for SX12xx transceiver devices.
Serial console is divided into horizontally into top half and bottom half.
The bottom half serves as scrolling area to log activity.
The top half serves as menu, to configure the radio.
For all devices, the serial console operates at 115200 8N1, and requires terminal with ANSI-VT100 capability, such as putty/teraterm/minicom etc.
Use program only with keyboard up/down/left/right keys. Enter to change an item, or number for value item. Some items are single bit, requiring only enter key to toggle. Others with fixed choices give a drop-down menu.

Revision:
14:14b9e1c08bfc
Parent:
13:8ce61a1897ab
--- a/radio_sx128x.cpp	Tue Aug 24 16:21:28 2021 -0700
+++ b/radio_sx128x.cpp	Thu Sep 16 21:57:23 2021 +0000
@@ -2,8 +2,9 @@
 #ifdef SX128x_H 
 
 #include <float.h>
+using namespace std::chrono;
 
-#ifdef TARGET_FF_ARDUINO    /* pins of SX126xDVK1xAS board */
+#if defined(TARGET_FF_ARDUINO) || defined(TARGET_FF_ARDUINO_UNO)    /* pins of SX126xDVK1xAS board */
     #define NRST_PIN        A0
     SPI spi(D11, D12, D13); // mosi, miso, sclk
     //           spi, nss, busy, dio1
@@ -1890,12 +1891,13 @@
     static IrqFlags_t prevIrqFlags;
     IrqFlags_t irqFlags;
     bool ret = false;
-    static us_timestamp_t prev_now;
-    us_timestamp_t now = lpt.read_us();
+    static long prev_now_ms;
+    auto now_tp = time_point_cast<milliseconds>(Kernel::Clock::now());
+    long now_ms = now_tp.time_since_epoch().count();    
 
     radio.service();
 
-    if (statusRow > 0 && now-prev_now > 50000) {
+    if (statusRow > 0 && now_ms-prev_now_ms > 50) {
         int cmp = 0;
         pktStatus_t pktStatus;
         uint8_t buf[6];
@@ -2012,7 +2014,7 @@
             }
         } // ..if change
 
-        prev_now = now;
+        prev_now_ms = now_ms;
     }
 
     return ret;