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:
10:db4e11a55bda
BufferedSerial flush printf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 1:0817a150122b 1 static uint8_t bw_idx;
Wayne Roberts 1:0817a150122b 2
Wayne Roberts 1:0817a150122b 3 static void targetInit(void);
Wayne Roberts 1:0817a150122b 4
Wayne Roberts 1:0817a150122b 5 static const menu_t fsk_menu[];
Wayne Roberts 1:0817a150122b 6 static const menu_t ook_menu[];
Wayne Roberts 1:0817a150122b 7 static const menu_t ook_fixed_menu[];
Wayne Roberts 1:0817a150122b 8 static const menu_t ook_peak_menu[];
Wayne Roberts 1:0817a150122b 9 static const menu_t ook_average_menu[];
Wayne Roberts 1:0817a150122b 10
Wayne Roberts 1:0817a150122b 11 static RegPaRamp_t RegPaRamp;
Wayne Roberts 1:0817a150122b 12
Wayne Roberts 1:0817a150122b 13 static bool paSelect_read(void);
Wayne Roberts 1:0817a150122b 14 static bool paSelect_push(void);
Wayne Roberts 10:db4e11a55bda 15 static const toggle_item_t paSelect_item;
Wayne Roberts 1:0817a150122b 16
Wayne Roberts 1:0817a150122b 17 static void ocp_print(void);
Wayne Roberts 1:0817a150122b 18 static bool ocp_write(const char* txt);
Wayne Roberts 1:0817a150122b 19 static const value_item_t ocp_item;
Wayne Roberts 1:0817a150122b 20
Wayne Roberts 1:0817a150122b 21 static void gfsk_fdev_print(void);
Wayne Roberts 1:0817a150122b 22 static bool gfsk_fdev_write(const char* txt);
Wayne Roberts 1:0817a150122b 23 static const value_item_t gfsk_fdev_item;
Wayne Roberts 1:0817a150122b 24
Wayne Roberts 1:0817a150122b 25 static void fsk_ook_bps_print(void);
Wayne Roberts 1:0817a150122b 26 static bool fsk_ook_bps_write(const char*);
Wayne Roberts 1:0817a150122b 27 static const value_item_t fsk_ook_bitrate_item;
Wayne Roberts 1:0817a150122b 28
Wayne Roberts 2:ea9245bb1c53 29 static unsigned bt_read(bool);
Wayne Roberts 2:ea9245bb1c53 30 static menuMode_e bt_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 31 static const dropdown_item_t gfsk_bt_item;
Wayne Roberts 1:0817a150122b 32 static const dropdown_item_t ook_bt_item;
Wayne Roberts 1:0817a150122b 33
Wayne Roberts 2:ea9245bb1c53 34 static unsigned rxbw_read(bool);
Wayne Roberts 2:ea9245bb1c53 35 static menuMode_e rxbw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 36 static const dropdown_item_t rxbw_item;
Wayne Roberts 1:0817a150122b 37
Wayne Roberts 2:ea9245bb1c53 38 static unsigned bw_read(uint8_t regAddr);
Wayne Roberts 2:ea9245bb1c53 39 static void bw_write(unsigned sidx, uint8_t regAddr);
Wayne Roberts 1:0817a150122b 40
Wayne Roberts 2:ea9245bb1c53 41 static unsigned afcbw_read(bool);
Wayne Roberts 2:ea9245bb1c53 42 static menuMode_e afcbw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 43 static const dropdown_item_t afcbw_item;
Wayne Roberts 1:0817a150122b 44
Wayne Roberts 2:ea9245bb1c53 45 static unsigned lora_bw_read(bool);
Wayne Roberts 2:ea9245bb1c53 46 static menuMode_e lora_bw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 47 static dropdown_item_t lora_bw_item; // strings written at runtime
Wayne Roberts 1:0817a150122b 48
Wayne Roberts 1:0817a150122b 49 static void lora_sf_print(void);
Wayne Roberts 1:0817a150122b 50 static bool lora_sf_write(const char*);
Wayne Roberts 1:0817a150122b 51 static const value_item_t lora_sf_item;
Wayne Roberts 1:0817a150122b 52
Wayne Roberts 2:ea9245bb1c53 53 static unsigned lora_cr_read(bool);
Wayne Roberts 2:ea9245bb1c53 54 static menuMode_e lora_cr_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 55 static const dropdown_item_t lora_cr_item;
Wayne Roberts 1:0817a150122b 56
Wayne Roberts 1:0817a150122b 57 static void lora_pblLen_print(void);
Wayne Roberts 1:0817a150122b 58 static bool lora_pblLen_write(const char*);
Wayne Roberts 1:0817a150122b 59 static const value_item_t lora_pblLen_item;
Wayne Roberts 1:0817a150122b 60
Wayne Roberts 2:ea9245bb1c53 61 static unsigned lora_fixlen_read(bool);
Wayne Roberts 2:ea9245bb1c53 62 static menuMode_e lora_fixlen_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 63 static const dropdown_item_t lora_fixlen_item;
Wayne Roberts 1:0817a150122b 64
Wayne Roberts 1:0817a150122b 65 static bool lora_crcon_read(void);
Wayne Roberts 1:0817a150122b 66 static bool lora_crcon_push(void);
Wayne Roberts 1:0817a150122b 67 static const toggle_item_t lora_crcon_item;
Wayne Roberts 1:0817a150122b 68
Wayne Roberts 1:0817a150122b 69 static bool lora_iqinvTX_read(void);
Wayne Roberts 1:0817a150122b 70 static bool lora_iqinvTX_push(void);
Wayne Roberts 1:0817a150122b 71 static const toggle_item_t lora_iqinvTX_item;
Wayne Roberts 1:0817a150122b 72
Wayne Roberts 1:0817a150122b 73 static bool lora_iqinvRX_read(void);
Wayne Roberts 1:0817a150122b 74 static bool lora_iqinvRX_push(void);
Wayne Roberts 1:0817a150122b 75 static const toggle_item_t lora_iqinvRX_item;
Wayne Roberts 1:0817a150122b 76
Wayne Roberts 3:56fc764dee0a 77 static void lora_ppg_print(void);
Wayne Roberts 3:56fc764dee0a 78 static bool lora_ppg_write(const char*);
Wayne Roberts 3:56fc764dee0a 79 static const value_item_t lora_ppg_item;
Wayne Roberts 3:56fc764dee0a 80
Wayne Roberts 10:db4e11a55bda 81 static bool lora_ppm_offset_read(void);
Wayne Roberts 10:db4e11a55bda 82 static bool lora_ppm_offset_push(void);
Wayne Roberts 10:db4e11a55bda 83 static const toggle_item_t lora_ppm_offset_item;
Wayne Roberts 10:db4e11a55bda 84
Wayne Roberts 1:0817a150122b 85 static void pblLen_print(void);
Wayne Roberts 1:0817a150122b 86 static bool pblLen_write(const char*);
Wayne Roberts 10:db4e11a55bda 87 static const value_item_t pblLen_item;
Wayne Roberts 1:0817a150122b 88
Wayne Roberts 2:ea9245bb1c53 89 static unsigned rxTrigger_read(bool);
Wayne Roberts 2:ea9245bb1c53 90 static menuMode_e rxTrigger_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 91 static const dropdown_item_t rxTrigger_item;
Wayne Roberts 1:0817a150122b 92
Wayne Roberts 1:0817a150122b 93 static bool AgcAutoOn_read(void);
Wayne Roberts 1:0817a150122b 94 static bool AgcAutoOn_push(void);
Wayne Roberts 1:0817a150122b 95 static const toggle_item_t agcautoon_item;
Wayne Roberts 1:0817a150122b 96
Wayne Roberts 1:0817a150122b 97 static bool AfcAutoOn_read(void);
Wayne Roberts 1:0817a150122b 98 static bool AfcAutoOn_push(void);
Wayne Roberts 1:0817a150122b 99 static const toggle_item_t afcautoon_item;
Wayne Roberts 1:0817a150122b 100
Wayne Roberts 1:0817a150122b 101 static bool RestartRxOnCollision_read(void);
Wayne Roberts 1:0817a150122b 102 static bool RestartRxOnCollision_push(void);
Wayne Roberts 1:0817a150122b 103 static const toggle_item_t RestartRxOnCollision_item;
Wayne Roberts 1:0817a150122b 104
Wayne Roberts 1:0817a150122b 105 static void RestartRxWithPllLock_push(void);
Wayne Roberts 1:0817a150122b 106 static const button_item_t RestartRxWithPllLock_item;
Wayne Roberts 1:0817a150122b 107
Wayne Roberts 1:0817a150122b 108 static void RestartRxWithoutPllLock_push(void);
Wayne Roberts 1:0817a150122b 109 static const button_item_t RestartRxWithoutPllLock_item;
Wayne Roberts 1:0817a150122b 110
Wayne Roberts 1:0817a150122b 111 static bool AfcAutoClearOn_read(void);
Wayne Roberts 1:0817a150122b 112 static bool AfcAutoClearOn_push(void);
Wayne Roberts 1:0817a150122b 113 static const toggle_item_t AfcAutoClearOn_item;
Wayne Roberts 1:0817a150122b 114
Wayne Roberts 1:0817a150122b 115 static void AfcClear_push(void);
Wayne Roberts 1:0817a150122b 116 static const button_item_t AfcClear_item;
Wayne Roberts 1:0817a150122b 117
Wayne Roberts 1:0817a150122b 118 static void AgcStart_push(void);
Wayne Roberts 1:0817a150122b 119 static const button_item_t AgcStart_item;
Wayne Roberts 1:0817a150122b 120
Wayne Roberts 1:0817a150122b 121 static void syncWord_print(void);
Wayne Roberts 1:0817a150122b 122 static bool syncWord_write(const char*);
Wayne Roberts 1:0817a150122b 123 static const value_item_t syncWord_item;
Wayne Roberts 1:0817a150122b 124
Wayne Roberts 1:0817a150122b 125 static void syncSize_print(void);
Wayne Roberts 1:0817a150122b 126 static bool syncSize_write(const char*);
Wayne Roberts 1:0817a150122b 127 static const value_item_t syncSize_item;
Wayne Roberts 1:0817a150122b 128
Wayne Roberts 1:0817a150122b 129 static bool SyncOn_read(void);
Wayne Roberts 1:0817a150122b 130 static bool SyncOn_push(void);
Wayne Roberts 1:0817a150122b 131 static const toggle_item_t syncOn_item;
Wayne Roberts 1:0817a150122b 132
Wayne Roberts 1:0817a150122b 133 static bool fsk_pktfmt_read(void);
Wayne Roberts 1:0817a150122b 134 static bool fsk_pktfmt_push(void);
Wayne Roberts 1:0817a150122b 135 static const toggle_item_t fskook_pktfmt_item;
Wayne Roberts 1:0817a150122b 136
Wayne Roberts 1:0817a150122b 137 static void rssiOffset_print(void);
Wayne Roberts 1:0817a150122b 138 static bool rssiOffset_write(const char*);
Wayne Roberts 1:0817a150122b 139 static const value_item_t rssiOffset_item;
Wayne Roberts 1:0817a150122b 140
Wayne Roberts 1:0817a150122b 141 static unsigned rssiSmoothing_read(bool);
Wayne Roberts 1:0817a150122b 142 static menuMode_e rssiSmoothing_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 143 static const dropdown_item_t rssiSmoothing_item;
Wayne Roberts 1:0817a150122b 144
Wayne Roberts 1:0817a150122b 145 static bool dataMode_read(void);
Wayne Roberts 1:0817a150122b 146 static bool dataMode_push(void);
Wayne Roberts 1:0817a150122b 147 static const toggle_item_t dataMode_item;
Wayne Roberts 1:0817a150122b 148
Wayne Roberts 1:0817a150122b 149 static bool bitSyncOn_read(void);
Wayne Roberts 1:0817a150122b 150 static bool bitSyncOn_push(void);
Wayne Roberts 1:0817a150122b 151 static const toggle_item_t bitSyncOn_item;
Wayne Roberts 1:0817a150122b 152
Wayne Roberts 1:0817a150122b 153 static const button_item_t pdLabel_item;
Wayne Roberts 1:0817a150122b 154
Wayne Roberts 1:0817a150122b 155 static bool pdOn_read(void);
Wayne Roberts 1:0817a150122b 156 static bool pdOn_push(void);
Wayne Roberts 1:0817a150122b 157 static const toggle_item_t pdOn_item;
Wayne Roberts 1:0817a150122b 158
Wayne Roberts 1:0817a150122b 159 static unsigned pdSize_read(bool);
Wayne Roberts 1:0817a150122b 160 static menuMode_e pdSize_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 161 static const dropdown_item_t pdSize_item;
Wayne Roberts 1:0817a150122b 162
Wayne Roberts 1:0817a150122b 163 static void pdTol_print(void);
Wayne Roberts 1:0817a150122b 164 static bool pdTol_write(const char*);
Wayne Roberts 1:0817a150122b 165 static const value_item_t pdTol_item;
Wayne Roberts 1:0817a150122b 166
Wayne Roberts 1:0817a150122b 167 static bool TxStartCondition_read(void);
Wayne Roberts 1:0817a150122b 168 static bool TxStartCondition_push(void);
Wayne Roberts 1:0817a150122b 169 static const toggle_item_t TxStartCondition_item;
Wayne Roberts 1:0817a150122b 170
Wayne Roberts 1:0817a150122b 171 static void FifoThreshold_print(void);
Wayne Roberts 1:0817a150122b 172 static bool FifoThreshold_write(const char*);
Wayne Roberts 10:db4e11a55bda 173 static const value_item_t FifoThreshold_item;
Wayne Roberts 1:0817a150122b 174
Wayne Roberts 1:0817a150122b 175 static unsigned dcFree_read(bool);
Wayne Roberts 1:0817a150122b 176 static menuMode_e dcFree_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 177 static const dropdown_item_t dcFree_item;
Wayne Roberts 1:0817a150122b 178
Wayne Roberts 1:0817a150122b 179 static bool fskook_crcon_read(void);
Wayne Roberts 1:0817a150122b 180 static bool fskook_crcon_push(void);
Wayne Roberts 1:0817a150122b 181 static const toggle_item_t fskook_crcon_item;
Wayne Roberts 1:0817a150122b 182
Wayne Roberts 1:0817a150122b 183 static void rssiThresh_print(void);
Wayne Roberts 1:0817a150122b 184 static bool rssiThresh_write(const char*);
Wayne Roberts 10:db4e11a55bda 185 static const value_item_t rssiThresh_item;
Wayne Roberts 1:0817a150122b 186
Wayne Roberts 1:0817a150122b 187 static const button_item_t ookLabel_item;
Wayne Roberts 1:0817a150122b 188
Wayne Roberts 1:0817a150122b 189 static unsigned ookthreshtype_read(bool);
Wayne Roberts 1:0817a150122b 190 static menuMode_e ookthreshtype_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 191 static const dropdown_item_t ookthreshtype_item;
Wayne Roberts 1:0817a150122b 192
Wayne Roberts 1:0817a150122b 193 static unsigned ook_peak_step_read(bool);
Wayne Roberts 1:0817a150122b 194 static menuMode_e ook_peak_step_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 195 static const dropdown_item_t ook_peak_step_item;
Wayne Roberts 1:0817a150122b 196
Wayne Roberts 1:0817a150122b 197 static unsigned ook_peak_dec_read(bool);
Wayne Roberts 1:0817a150122b 198 static menuMode_e ook_peak_dec_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 199 static const dropdown_item_t ook_peak_dec_item;
Wayne Roberts 1:0817a150122b 200
Wayne Roberts 1:0817a150122b 201 static void ookFixedThresh_print(void);
Wayne Roberts 1:0817a150122b 202 static bool ookFixedThresh_write(const char*);
Wayne Roberts 1:0817a150122b 203 static const value_item_t ookFixedThresh_item;
Wayne Roberts 1:0817a150122b 204
Wayne Roberts 1:0817a150122b 205 static unsigned ook_avgOffset_read(bool);
Wayne Roberts 1:0817a150122b 206 static menuMode_e ook_avgOffset_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 207 static const dropdown_item_t ook_avgOffset_item;
Wayne Roberts 1:0817a150122b 208
Wayne Roberts 1:0817a150122b 209 static unsigned ook_avgFilter_read(bool);
Wayne Roberts 1:0817a150122b 210 static menuMode_e ook_avgFilter_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 211 static const dropdown_item_t ook_avgFilter_item;
Wayne Roberts 1:0817a150122b 212
Wayne Roberts 1:0817a150122b 213 static bool pblPol_read(void);
Wayne Roberts 1:0817a150122b 214 static bool pblPol_push(void);
Wayne Roberts 1:0817a150122b 215 static const toggle_item_t pblPol_item;
Wayne Roberts 2:ea9245bb1c53 216
Wayne Roberts 2:ea9245bb1c53 217 static void cadrx_push(void);
Wayne Roberts 2:ea9245bb1c53 218 static const button_item_t lora_cadrx_item;