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:
13:8ce61a1897ab
Parent:
10:db4e11a55bda
--- a/radio_lr1110.cpp	Fri Jun 12 11:48:21 2020 -0700
+++ b/radio_lr1110.cpp	Tue Aug 24 16:21:28 2021 -0700
@@ -301,7 +301,7 @@
 void Radio::txTimeout_print()
 {
     float sec = radio.txTimeout / 32768.0;
-    pc.printf("%.3f", sec);
+    printf("%.3f", sec);
 }
 
 bool Radio::txTimeout_write(const char *txt)
@@ -373,7 +373,7 @@
     ticks |= tcxo_buf[2];
     ticks <<= 8;
     ticks |= tcxo_buf[3];
-    pc.printf("%.1f", ticks / 32.768);
+    printf("%.1f", ticks / 32.768);
 }
 
 bool tcxo_delay_write(const char *txt)
@@ -604,7 +604,7 @@
     txParamsB_t tpb;
     radio.memRegRead(REG_ADDR_TX_PARAMS_B, 1, &tpb.dword);
     pa_config_buf[2] = tpb.bits.PaDutyCycle;
-    pc.printf("%u", tpb.bits.PaDutyCycle);
+    printf("%u", tpb.bits.PaDutyCycle);
 }
 
 bool Radio::PaDutyCycle_write(const char *txt)
@@ -624,7 +624,7 @@
     txParamsB_t tpb;
     radio.memRegRead(REG_ADDR_TX_PARAMS_B, 1, &tpb.dword);
     pa_config_buf[3] = tpb.bits.PaHPSel;
-    pc.printf("%u", tpb.bits.PaHPSel);
+    printf("%u", tpb.bits.PaHPSel);
 }
 
 bool Radio::PaHPSel_write(const char *txt)
@@ -688,7 +688,7 @@
 
 void wifiNbMaxRes_print()
 {
-    pc.printf("%u", wifiScan_buf[4]);
+    printf("%u", wifiScan_buf[4]);
 }
 
 bool wifiNbMaxRes_write(const char *txt)
@@ -703,7 +703,7 @@
 
 void wifiNbScanPerChan_print()
 {
-    pc.printf("%u", wifiScan_buf[5]);
+    printf("%u", wifiScan_buf[5]);
 }
 
 bool wifiNbScanPerChan_write(const char *txt)
@@ -782,7 +782,7 @@
     t = wifiScan_buf[6];
     t <<= 8;
     t |= wifiScan_buf[7];
-    pc.printf("%u", t);
+    printf("%u", t);
 }
 
 bool wifiTimeout_write(const char *txt)
@@ -842,7 +842,7 @@
 void gnssAutonomous_time_print()
 {
     unsigned t = Radio::radio.from_big_endian32(gnssAutonomous_buf);
-    pc.printf("%u", t);
+    printf("%u", t);
 }
 
 bool gnssAutonomous_time_write(const char *txt)
@@ -890,7 +890,7 @@
 
 void gnssAutoNbSvMax_print()
 {
-    pc.printf("%u", gnssAutonomous_buf[6]);
+    printf("%u", gnssAutonomous_buf[6]);
 }
 
 bool gnssAutoNbSvMax_write(const char *txt)
@@ -917,7 +917,7 @@
 void gnssAssisted_time_print()
 {
     unsigned t = Radio::radio.from_big_endian32(gnssAssisted_buf);
-    pc.printf("%u", t);
+    printf("%u", t);
 }
 
 bool gnssAssisted_time_write(const char *txt)
@@ -950,7 +950,7 @@
 
 void gnssAssisted_nbsvmax_print()
 {
-    pc.printf("%u", gnssAssisted_buf[6]);
+    printf("%u", gnssAssisted_buf[6]);
 }
 
 bool gnssAssisted_nbsvmax_write(const char *txt)
@@ -1101,7 +1101,7 @@
     unsigned hz;
     radio.memRegRead(REG_ADDR_GFSK_BITRATE, 1, &u32);
     hz = GFSK_BITRATE_NUMERATOR / u32;
-    pc.printf("%u", hz);
+    printf("%u", hz);
     radio.to_big_endian32(hz, gfsk_mp_buf);
 }
 
@@ -1172,7 +1172,7 @@
 
     for (n = 0; n < NB_RXBW; n++) {
         if (rxbws[n].bwf == bwf) {
-            pc.printf("%u", rxbws[n].hz);
+            printf("%u", rxbws[n].hz);
             break;
         }
     }
@@ -1227,7 +1227,7 @@
     uint32_t u32;
     radio.memRegRead(REG_ADDR_GFSK_FDEV, 1, &u32);
     hz = my_round(u32 * FREQ_STEP);
-    pc.printf("%u", hz);
+    printf("%u", hz);
     radio.to_big_endian32(hz, gfsk_mp_buf+6);
 }
 
@@ -1248,7 +1248,7 @@
     unsigned n;
     gfskConfig1_t cfg1;
     radio.memRegRead(REG_ADDR_GFSK_CFG1, 1, &cfg1.dword);
-    pc.printf("%u", cfg1.bits.preamble_length);
+    printf("%u", cfg1.bits.preamble_length);
     n = cfg1.bits.preamble_length;
     gfsk_pp_buf[1] = n;
     n >>= 8;
@@ -1306,8 +1306,8 @@
 {
     uint32_t dword[2];
     radio.memRegRead(REG_ADDR_GFSK_SYNC_LO, 2, dword);
-    pc.printf("%08lx", dword[1]);
-    pc.printf("%08lx", dword[0]);
+    printf("%08lx", dword[1]);
+    printf("%08lx", dword[0]);
 }
 
 bool Radio::gfsk_syncWord_write(const char* txt)
@@ -1377,7 +1377,7 @@
     gfskConfig2_t cfg2;
     radio.memRegRead(REG_ADDR_GFSK_CFG2, 1, &cfg2.dword);
     gfsk_pp_buf[3] = cfg2.bits.sync_word_length;
-    pc.printf("%u", cfg2.bits.sync_word_length);
+    printf("%u", cfg2.bits.sync_word_length);
 }
 
 bool Radio::gfsk_syncLen_write(const char *txt)
@@ -1469,7 +1469,7 @@
 void Radio::gfsk_crcinit_print()
 {
     radio.memRegRead(REG_ADDR_GFSK_CRC_INIT, 1, &gfsk_crc_Poly);
-    pc.printf("%04x", (unsigned)gfsk_crc_Poly);
+    printf("%04x", (unsigned)gfsk_crc_Poly);
 }
 
 bool Radio::gfsk_crcinit_write(const char *txt)
@@ -1489,7 +1489,7 @@
 void Radio::gfsk_crcpoly_print()
 {
     radio.memRegRead(REG_ADDR_GFSK_CRC_POLY, 1, &gfsk_crc_Poly);
-    pc.printf("%04x", (unsigned)gfsk_crc_Poly);
+    printf("%04x", (unsigned)gfsk_crc_Poly);
 }
 
 bool Radio::gfsk_crcpoly_write(const char *txt)
@@ -1561,7 +1561,7 @@
     loraConfig0_t cfg0;
     radio.memRegRead(REG_ADDR_LORA_CONFIG0, 1, &cfg0.dword);
     lora_mp_buf[0] = cfg0.bits.modem_sf;
-    pc.printf("%u", cfg0.bits.modem_sf);
+    printf("%u", cfg0.bits.modem_sf);
 }
 
 bool Radio::lora_sf_write(const char* str)
@@ -1581,7 +1581,7 @@
     unsigned pl;
     loraConfigC_t cfgc;
     radio.memRegRead(REG_ADDR_LORA_CONFIGC, 1, &cfgc.dword);
-    pc.printf("%u", cfgc.bits.preamble_length);
+    printf("%u", cfgc.bits.preamble_length);
     pl = cfgc.bits.preamble_length;
     lora_pp_buf[1] = pl & 0xff;
     pl >>= 8;
@@ -2781,9 +2781,9 @@
     radio.memRegRead(REG_ADDR_TX_PARAMS_C, 1, &txpc.dword);
     radio.memRegRead(REG_ADDR_TX_PARAMS_B, 1, &txpb.dword);
     if (txpb.bits.PaSel)
-        pc.printf("%d", txpc.bits.tx_dbm - 9);
+        printf("%d", txpc.bits.tx_dbm - 9);
     else
-        pc.printf("%d", txpc.bits.tx_dbm - 17);
+        printf("%d", txpc.bits.tx_dbm - 17);
 }
 
 const char* Radio::tx_ramp_strs[] = {
@@ -2814,7 +2814,7 @@
 
 void Radio::tx_payload_length_print()
 {
-    pc.printf("%u", get_payload_length());
+    printf("%u", get_payload_length());
 }