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.

Committer:
dudmuck
Date:
Thu Sep 16 21:57:23 2021 +0000
Revision:
14:14b9e1c08bfc
Parent:
9:295e37c38fb3
BufferedSerial flush printf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 1:0817a150122b 1 static uint8_t pktType;
Wayne Roberts 1:0817a150122b 2
Wayne Roberts 1:0817a150122b 3 static void chipModeChange(void);
Wayne Roberts 1:0817a150122b 4
Wayne Roberts 1:0817a150122b 5 static const menu_t gfsk_menu[];
Wayne Roberts 1:0817a150122b 6 static const menu_t flrc_menu[];
Wayne Roberts 3:56fc764dee0a 7 static const menu_t rng_menu[];
Wayne Roberts 1:0817a150122b 8
Wayne Roberts 1:0817a150122b 9 static void rxDone(uint8_t size, const pktStatus_t*);
Wayne Roberts 1:0817a150122b 10
Wayne Roberts 1:0817a150122b 11 static unsigned lora_bw_read(bool);
Wayne Roberts 1:0817a150122b 12 static menuMode_e lora_bw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 13 static const dropdown_item_t lora_bw_item;
Wayne Roberts 1:0817a150122b 14
Wayne Roberts 2:ea9245bb1c53 15 static unsigned lora_cr_read(bool);
Wayne Roberts 2:ea9245bb1c53 16 static menuMode_e lora_cr_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 17 static const dropdown_item_t lora_cr_item;
Wayne Roberts 1:0817a150122b 18
Wayne Roberts 1:0817a150122b 19 static void lora_sf_print(void);
Wayne Roberts 1:0817a150122b 20 static bool lora_sf_write(const char*);
Wayne Roberts 1:0817a150122b 21 static const value_item_t lora_sf_item;
Wayne Roberts 1:0817a150122b 22
Wayne Roberts 2:ea9245bb1c53 23 static void cad_push(void);
Wayne Roberts 2:ea9245bb1c53 24 static const button_item_t lora_cad_item;
Wayne Roberts 2:ea9245bb1c53 25
Wayne Roberts 2:ea9245bb1c53 26 static unsigned lora_cadsymbs_read(bool);
Wayne Roberts 2:ea9245bb1c53 27 static menuMode_e lora_cadsymbs_write(unsigned sidx);
Wayne Roberts 2:ea9245bb1c53 28 static const dropdown_item_t lora_cadsymbs_item;
Wayne Roberts 2:ea9245bb1c53 29
Wayne Roberts 2:ea9245bb1c53 30 /*************************************************/
Wayne Roberts 2:ea9245bb1c53 31
Wayne Roberts 3:56fc764dee0a 32 static bool rng_role_read(void);
Wayne Roberts 3:56fc764dee0a 33 static bool rng_role_push(void);
Wayne Roberts 3:56fc764dee0a 34 static const toggle_item_t rng_role_item;
Wayne Roberts 3:56fc764dee0a 35
Wayne Roberts 3:56fc764dee0a 36 static bool tmp;
Wayne Roberts 3:56fc764dee0a 37
Wayne Roberts 3:56fc764dee0a 38 static void rng_id_send_print(void);
Wayne Roberts 3:56fc764dee0a 39 static bool rng_id_send_write(const char*);
Wayne Roberts 3:56fc764dee0a 40 static const value_item_t rng_id_send_item;
Wayne Roberts 3:56fc764dee0a 41
Wayne Roberts 3:56fc764dee0a 42 static void rng_slave_id_print(void);
Wayne Roberts 3:56fc764dee0a 43 static bool rng_slave_id_write(const char*);
Wayne Roberts 3:56fc764dee0a 44 static const value_item_t rng_slave_id_item;
Wayne Roberts 3:56fc764dee0a 45
Wayne Roberts 3:56fc764dee0a 46 static unsigned rng_idLength_read(bool);
Wayne Roberts 3:56fc764dee0a 47 static menuMode_e rng_idLength_write(unsigned sidx);
Wayne Roberts 3:56fc764dee0a 48 static const dropdown_item_t rng_idLength_item;
Wayne Roberts 3:56fc764dee0a 49
Wayne Roberts 3:56fc764dee0a 50 static void rng_delay_print(void);
Wayne Roberts 3:56fc764dee0a 51 static bool rng_delay_write(const char*);
Wayne Roberts 3:56fc764dee0a 52 static const value_item_t rng_delay_item;
Wayne Roberts 3:56fc764dee0a 53
Wayne Roberts 3:56fc764dee0a 54 static void rngTx(void);
Wayne Roberts 3:56fc764dee0a 55
Wayne Roberts 3:56fc764dee0a 56 static unsigned rng_resultMux_read(bool);
Wayne Roberts 3:56fc764dee0a 57 static menuMode_e rng_resultMux_write(unsigned sidx);
Wayne Roberts 3:56fc764dee0a 58 static const dropdown_item_t rng_resultMux_item;
Wayne Roberts 3:56fc764dee0a 59
Wayne Roberts 3:56fc764dee0a 60 static void rng_wndFltSize_print(void);
Wayne Roberts 3:56fc764dee0a 61 static bool rng_wndFltSize_write(const char*);
Wayne Roberts 3:56fc764dee0a 62 static const value_item_t rng_wndFltSize_item;
Wayne Roberts 3:56fc764dee0a 63
Wayne Roberts 3:56fc764dee0a 64 static void rng_rngRssiThresh_print(void);
Wayne Roberts 3:56fc764dee0a 65 static bool rng_rngRssiThresh_write(const char*);
Wayne Roberts 3:56fc764dee0a 66 static const value_item_t rng_rngRssiThresh_item;
Wayne Roberts 3:56fc764dee0a 67
Wayne Roberts 3:56fc764dee0a 68 static LoRaPktPar0_t LoRaPktPar0;
Wayne Roberts 3:56fc764dee0a 69 static const float bwMHzs[];
Wayne Roberts 3:56fc764dee0a 70
Wayne Roberts 3:56fc764dee0a 71 static const uint16_t rngDelays[3][6];
Wayne Roberts 3:56fc764dee0a 72 static void rngUpdateDelayCal(void);
Wayne Roberts 3:56fc764dee0a 73 static bool manualRngDelay;
Wayne Roberts 3:56fc764dee0a 74
Wayne Roberts 3:56fc764dee0a 75 /*************************************************/
Wayne Roberts 3:56fc764dee0a 76
Wayne Roberts 2:ea9245bb1c53 77 static void modindex_print(void);
Wayne Roberts 2:ea9245bb1c53 78 static bool modindex_write(const char*);
Wayne Roberts 2:ea9245bb1c53 79 static const value_item_t gfsk_modindex_item;
Wayne Roberts 2:ea9245bb1c53 80
Wayne Roberts 2:ea9245bb1c53 81 static unsigned gfsk_flrc_bt_read(bool);
Wayne Roberts 2:ea9245bb1c53 82 static menuMode_e gfsk_flrc_bt_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 83 static const dropdown_item_t gfsk_flrc_bt_item;
Wayne Roberts 1:0817a150122b 84
Wayne Roberts 2:ea9245bb1c53 85 static unsigned gfsk_flrc_pl_read(bool);
Wayne Roberts 2:ea9245bb1c53 86 static menuMode_e gfsk_flrc_pl_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 87 static const dropdown_item_t gfsk_flrc_preamble_item;
Wayne Roberts 1:0817a150122b 88
Wayne Roberts 2:ea9245bb1c53 89 static unsigned gfsk_flrc_bpsbw_read(bool);
Wayne Roberts 2:ea9245bb1c53 90 static menuMode_e gfsk_flrc_bpsbw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 91 static const dropdown_item_t flrc_bitrate_item;
Wayne Roberts 1:0817a150122b 92 static const dropdown_item_t gfsk_bitrate_item;
Wayne Roberts 1:0817a150122b 93
Wayne Roberts 2:ea9245bb1c53 94 static unsigned gfsk_synclen_read(bool);
Wayne Roberts 2:ea9245bb1c53 95 static menuMode_e gfsk_synclen_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 96 static const dropdown_item_t gfsk_synclen_item;
Wayne Roberts 1:0817a150122b 97
Wayne Roberts 1:0817a150122b 98 static bool gfsk_flrc_fixvar_read(void);
Wayne Roberts 1:0817a150122b 99 static bool gfsk_flrc_fixvar_push(void);
Wayne Roberts 1:0817a150122b 100 static const toggle_item_t gfsk_flrc_fixvar_item;
Wayne Roberts 1:0817a150122b 101
Wayne Roberts 2:ea9245bb1c53 102 static unsigned gfsk_flrc_crclen_read(bool);
Wayne Roberts 2:ea9245bb1c53 103 static menuMode_e gfsk_flrc_crclen_write (unsigned sidx);
Wayne Roberts 1:0817a150122b 104 static const dropdown_item_t gfsk_flrc_crclen_item;
Wayne Roberts 1:0817a150122b 105
Wayne Roberts 1:0817a150122b 106 static bool gfsk_flrc_whit_read(void);
Wayne Roberts 1:0817a150122b 107 static bool gfsk_flrc_whit_push(void);
Wayne Roberts 1:0817a150122b 108 static const toggle_item_t gfsk_flrc_whit_item;
Wayne Roberts 1:0817a150122b 109
Wayne Roberts 1:0817a150122b 110 static void gfsk_flrc_crcinit_print(void);
Wayne Roberts 1:0817a150122b 111 static bool gfsk_flrc_crcinit_write (const char*);
Wayne Roberts 1:0817a150122b 112 static const value_item_t gfsk_flrc_crcinit_item;
Wayne Roberts 1:0817a150122b 113
Wayne Roberts 1:0817a150122b 114 static void gfsk_flrc_crcpoly_print(void);
Wayne Roberts 1:0817a150122b 115 static bool gfsk_flrc_crcpoly_write(const char*);
Wayne Roberts 1:0817a150122b 116 static const value_item_t gfsk_flrc_crcpoly_item;
Wayne Roberts 1:0817a150122b 117
Wayne Roberts 1:0817a150122b 118 static bool gfsk_flrc_sync1en_read(void);
Wayne Roberts 1:0817a150122b 119 static bool gfsk_flrc_sync2en_read(void);
Wayne Roberts 1:0817a150122b 120 static bool gfsk_flrc_sync3en_read(void);
Wayne Roberts 1:0817a150122b 121 static bool gfsk_flrc_sync1en_push(void);
Wayne Roberts 1:0817a150122b 122 static bool gfsk_flrc_sync2en_push(void);
Wayne Roberts 1:0817a150122b 123 static bool gfsk_flrc_sync3en_push(void);
Wayne Roberts 1:0817a150122b 124 static const toggle_item_t gfsk_flrc_sync1en_item;
Wayne Roberts 1:0817a150122b 125 static const toggle_item_t gfsk_flrc_sync2en_item;
Wayne Roberts 1:0817a150122b 126 static const toggle_item_t gfsk_flrc_sync3en_item;
Wayne Roberts 1:0817a150122b 127
Wayne Roberts 1:0817a150122b 128 static void gfsk_flrc_sync1_print(void);
Wayne Roberts 1:0817a150122b 129 static void gfsk_flrc_sync2_print(void);
Wayne Roberts 1:0817a150122b 130 static void gfsk_flrc_sync3_print(void);
Wayne Roberts 1:0817a150122b 131 static bool gfsk_flrc_sync1_write(const char*);
Wayne Roberts 1:0817a150122b 132 static bool gfsk_flrc_sync2_write(const char*);
Wayne Roberts 1:0817a150122b 133 static bool gfsk_flrc_sync3_write(const char*);
Wayne Roberts 1:0817a150122b 134 static const value_item_t gfsk_flrc_sync1_item;
Wayne Roberts 1:0817a150122b 135 static const value_item_t gfsk_flrc_sync2_item;
Wayne Roberts 1:0817a150122b 136 static const value_item_t gfsk_flrc_sync3_item;
Wayne Roberts 1:0817a150122b 137
Wayne Roberts 1:0817a150122b 138 static void lora_pblLen_print(void);
Wayne Roberts 1:0817a150122b 139 static bool lora_pblLen_write(const char*);
Wayne Roberts 1:0817a150122b 140 static const value_item_t lora_pblLen_item;
Wayne Roberts 1:0817a150122b 141
Wayne Roberts 1:0817a150122b 142 static bool lora_fixlen_read(void);
Wayne Roberts 1:0817a150122b 143 static bool lora_fixlen_push(void);
Wayne Roberts 1:0817a150122b 144 static const toggle_item_t lora_fixlen_item;
Wayne Roberts 1:0817a150122b 145
Wayne Roberts 1:0817a150122b 146 static bool lora_crcon_read(void);
Wayne Roberts 1:0817a150122b 147 static bool lora_crcon_push(void);
Wayne Roberts 1:0817a150122b 148 static const toggle_item_t lora_crcon_item;
Wayne Roberts 1:0817a150122b 149
Wayne Roberts 1:0817a150122b 150 static bool lora_iqinv_read(void);
Wayne Roberts 1:0817a150122b 151 static bool lora_iqinv_push(void);
Wayne Roberts 1:0817a150122b 152 static const toggle_item_t lora_iqinv_item;
Wayne Roberts 1:0817a150122b 153
Wayne Roberts 3:56fc764dee0a 154 static void lora_ppg_print(void);
Wayne Roberts 3:56fc764dee0a 155 static bool lora_ppg_write(const char*);
Wayne Roberts 3:56fc764dee0a 156 static const value_item_t lora_ppg_item;
Wayne Roberts 3:56fc764dee0a 157 static uint16_t ppg;
Wayne Roberts 3:56fc764dee0a 158
Wayne Roberts 2:ea9245bb1c53 159 static unsigned flrc_cr_read(bool);
Wayne Roberts 2:ea9245bb1c53 160 static menuMode_e flrc_cr_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 161 static const dropdown_item_t flrc_cr_item;
Wayne Roberts 1:0817a150122b 162
Wayne Roberts 2:ea9245bb1c53 163 static unsigned flrc_synclen_read(bool);
Wayne Roberts 2:ea9245bb1c53 164 static menuMode_e flrc_synclen_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 165 static const dropdown_item_t flrc_synclen_item;
Wayne Roberts 4:fa31fdf4ec8d 166
Wayne Roberts 4:fa31fdf4ec8d 167 static void xta_print(void);
Wayne Roberts 4:fa31fdf4ec8d 168 static bool xta_write(const char*);
Wayne Roberts 4:fa31fdf4ec8d 169 static const value_item_t xta_item;
Wayne Roberts 4:fa31fdf4ec8d 170
Wayne Roberts 4:fa31fdf4ec8d 171 static void xtb_print(void);
Wayne Roberts 4:fa31fdf4ec8d 172 static bool xtb_write(const char*);
Wayne Roberts 4:fa31fdf4ec8d 173 static const value_item_t xtb_item;
Wayne Roberts 4:fa31fdf4ec8d 174