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:
Wayne Roberts
Date:
Mon May 04 17:54:55 2020 -0700
Revision:
9:295e37c38fb3
Parent:
8:f8918514ec50
sx126x: add LDO/DCDC control and TCXO control

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 static uint8_t bw_idx;
Wayne Roberts 1:0817a150122b 3
Wayne Roberts 1:0817a150122b 4 static void chipModeChange(void);
Wayne Roberts 1:0817a150122b 5 static uint8_t tx_param_buf[2];
Wayne Roberts 1:0817a150122b 6 static uint8_t pa_config_buf[4];
Wayne Roberts 1:0817a150122b 7
Wayne Roberts 1:0817a150122b 8 static void rxDone(uint8_t size, float rssi, float snr);
Wayne Roberts 1:0817a150122b 9
Wayne Roberts 1:0817a150122b 10 static const menu_t gfsk_menu[];
Wayne Roberts 1:0817a150122b 11
Wayne Roberts 1:0817a150122b 12 static bool deviceSel_read(void);
Wayne Roberts 1:0817a150122b 13 static bool deviceSel_push(void);
Wayne Roberts 1:0817a150122b 14 static const toggle_item_t deviceSel_item;
Wayne Roberts 1:0817a150122b 15
Wayne Roberts 1:0817a150122b 16 static unsigned paDutyCycle_read(bool);
Wayne Roberts 1:0817a150122b 17 static menuMode_e paDutyCycle_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 18 static const dropdown_item_t paDutyCycle_item;
Wayne Roberts 1:0817a150122b 19
Wayne Roberts 1:0817a150122b 20 static unsigned hpMax_read(bool);
Wayne Roberts 1:0817a150122b 21 static menuMode_e hpMax_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 22 static const dropdown_item_t hpMax_item;
Wayne Roberts 1:0817a150122b 23
Wayne Roberts 1:0817a150122b 24 static void ocp_print(void);
Wayne Roberts 1:0817a150122b 25 static bool ocp_write(const char*);
Wayne Roberts 1:0817a150122b 26 static const value_item_t ocp_item;
Wayne Roberts 1:0817a150122b 27
Wayne Roberts 4:fa31fdf4ec8d 28 static void xta_print(void);
Wayne Roberts 4:fa31fdf4ec8d 29 static bool xta_write(const char*);
Wayne Roberts 4:fa31fdf4ec8d 30 static const value_item_t xta_item;
Wayne Roberts 4:fa31fdf4ec8d 31
Wayne Roberts 4:fa31fdf4ec8d 32 static void xtb_print(void);
Wayne Roberts 4:fa31fdf4ec8d 33 static bool xtb_write(const char*);
Wayne Roberts 4:fa31fdf4ec8d 34 static const value_item_t xtb_item;
Wayne Roberts 4:fa31fdf4ec8d 35
Wayne Roberts 9:295e37c38fb3 36 static void ldo_push(void);
Wayne Roberts 9:295e37c38fb3 37 static const button_item_t ldo_item;
Wayne Roberts 9:295e37c38fb3 38
Wayne Roberts 9:295e37c38fb3 39 static void dcdc_push(void);
Wayne Roberts 9:295e37c38fb3 40 static const button_item_t dcdc_item;
Wayne Roberts 9:295e37c38fb3 41
Wayne Roberts 9:295e37c38fb3 42 static unsigned rxfe_pm_read(bool);
Wayne Roberts 9:295e37c38fb3 43 static menuMode_e rxfe_pm_write(unsigned sidx);
Wayne Roberts 9:295e37c38fb3 44 static const dropdown_item_t rxfe_pm_item;
Wayne Roberts 9:295e37c38fb3 45
Wayne Roberts 9:295e37c38fb3 46 static void tcxo_volts_print(void);
Wayne Roberts 9:295e37c38fb3 47 static bool tcxo_volts_write(const char*);
Wayne Roberts 9:295e37c38fb3 48 static const value_item_t tcxo_volts_item;
Wayne Roberts 9:295e37c38fb3 49
Wayne Roberts 9:295e37c38fb3 50 static unsigned tcxoDelayTicks; // runs at 64,000Hz
Wayne Roberts 9:295e37c38fb3 51 static void tcxo_delay_print(void);
Wayne Roberts 9:295e37c38fb3 52 static bool tcxo_delay_write(const char*);
Wayne Roberts 9:295e37c38fb3 53 static const value_item_t tcxo_delay_item;
Wayne Roberts 9:295e37c38fb3 54
Wayne Roberts 9:295e37c38fb3 55 #ifdef MEMSCAN
Wayne Roberts 9:295e37c38fb3 56 static void memread_push(void);
Wayne Roberts 9:295e37c38fb3 57 static const button_item_t memread_item;
Wayne Roberts 9:295e37c38fb3 58
Wayne Roberts 9:295e37c38fb3 59 static uint8_t shadow_read[];
Wayne Roberts 9:295e37c38fb3 60
Wayne Roberts 9:295e37c38fb3 61 static void memcmp_push(void);
Wayne Roberts 9:295e37c38fb3 62 static const button_item_t memcmp_item;
Wayne Roberts 9:295e37c38fb3 63 #endif /* MEMSCAN */
Wayne Roberts 9:295e37c38fb3 64
Wayne Roberts 9:295e37c38fb3 65 /**************** lora: ************************/
Wayne Roberts 9:295e37c38fb3 66
Wayne Roberts 1:0817a150122b 67 static unsigned lora_bw_read(bool);
Wayne Roberts 1:0817a150122b 68 static menuMode_e lora_bw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 69 static const dropdown_item_t lora_bw_item;
Wayne Roberts 1:0817a150122b 70
Wayne Roberts 1:0817a150122b 71 static void lora_sf_print(void);
Wayne Roberts 1:0817a150122b 72 static bool lora_sf_write(const char*);
Wayne Roberts 1:0817a150122b 73 static const value_item_t lora_sf_item;
Wayne Roberts 1:0817a150122b 74
Wayne Roberts 1:0817a150122b 75 static unsigned lora_cr_read(bool);
Wayne Roberts 1:0817a150122b 76 static menuMode_e lora_cr_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 77 static const dropdown_item_t lora_cr_item;
Wayne Roberts 1:0817a150122b 78
Wayne Roberts 1:0817a150122b 79 static bool ppmOffset_read(void);
Wayne Roberts 1:0817a150122b 80 static bool ppmOffset_push(void);
Wayne Roberts 1:0817a150122b 81 static const toggle_item_t lora_ppmOffset_item;
Wayne Roberts 1:0817a150122b 82
Wayne Roberts 1:0817a150122b 83 static void lora_pblLen_print(void);
Wayne Roberts 1:0817a150122b 84 static bool lora_pblLen_write(const char*);
Wayne Roberts 1:0817a150122b 85 static const value_item_t lora_pblLen_item;
Wayne Roberts 1:0817a150122b 86
Wayne Roberts 1:0817a150122b 87 static bool lora_headerType_read(void);
Wayne Roberts 1:0817a150122b 88 static bool lora_headerType_push(void);
Wayne Roberts 1:0817a150122b 89 static const toggle_item_t lora_headerType_item;
Wayne Roberts 1:0817a150122b 90
Wayne Roberts 1:0817a150122b 91 static bool lora_crcon_read(void);
Wayne Roberts 1:0817a150122b 92 static bool lora_crcon_push(void);
Wayne Roberts 1:0817a150122b 93 static const toggle_item_t lora_crcon_item;
dudmuck 8:f8918514ec50 94
dudmuck 8:f8918514ec50 95 static bool lora_sdmode_read(void);
dudmuck 8:f8918514ec50 96 static bool lora_sdmode_push(void);
dudmuck 8:f8918514ec50 97 static const toggle_item_t lora_sdmode_item;
Wayne Roberts 1:0817a150122b 98
Wayne Roberts 1:0817a150122b 99 static bool lora_inviq_read(void);
Wayne Roberts 1:0817a150122b 100 static bool lora_inviq_push(void);
Wayne Roberts 1:0817a150122b 101 static const toggle_item_t lora_inviq_item;
Wayne Roberts 1:0817a150122b 102
Wayne Roberts 3:56fc764dee0a 103 static void lora_ppg_print(void);
Wayne Roberts 3:56fc764dee0a 104 static bool lora_ppg_write(const char*);
Wayne Roberts 3:56fc764dee0a 105 static const value_item_t lora_ppg_item;
Wayne Roberts 3:56fc764dee0a 106 static uint16_t ppg;
Wayne Roberts 3:56fc764dee0a 107
Wayne Roberts 2:ea9245bb1c53 108 static void cad_push(void);
Wayne Roberts 2:ea9245bb1c53 109 static const button_item_t lora_cad_item;
Wayne Roberts 2:ea9245bb1c53 110
Wayne Roberts 2:ea9245bb1c53 111 static uint8_t cadParams[7];
Wayne Roberts 2:ea9245bb1c53 112
Wayne Roberts 2:ea9245bb1c53 113 static unsigned lora_cadsymbs_read(bool);
Wayne Roberts 2:ea9245bb1c53 114 static menuMode_e lora_cadsymbs_write(unsigned sidx);
Wayne Roberts 2:ea9245bb1c53 115 static const dropdown_item_t lora_cadsymbs_item;
Wayne Roberts 2:ea9245bb1c53 116
Wayne Roberts 2:ea9245bb1c53 117 static void lora_cadpnratio_print(void);
Wayne Roberts 2:ea9245bb1c53 118 static bool lora_cadpnratio_write(const char*);
Wayne Roberts 2:ea9245bb1c53 119 static const value_item_t lora_cadpnratio_item;
Wayne Roberts 2:ea9245bb1c53 120
Wayne Roberts 2:ea9245bb1c53 121 static void lora_cadmin_print(void);
Wayne Roberts 2:ea9245bb1c53 122 static bool lora_cadmin_write(const char*);
Wayne Roberts 2:ea9245bb1c53 123 static const value_item_t lora_cadmin_item;
Wayne Roberts 2:ea9245bb1c53 124
Wayne Roberts 2:ea9245bb1c53 125 static bool lora_cadexit_read(void);
Wayne Roberts 2:ea9245bb1c53 126 static bool lora_cadexit_push(void);
Wayne Roberts 2:ea9245bb1c53 127 static const toggle_item_t lora_cadexit_item;
Wayne Roberts 2:ea9245bb1c53 128
Wayne Roberts 2:ea9245bb1c53 129 static void lora_cadtimeout_print(void);
Wayne Roberts 2:ea9245bb1c53 130 static bool lora_cadtimeout_write(const char*);
Wayne Roberts 2:ea9245bb1c53 131 static const value_item_t lora_cadtimeout_item;
Wayne Roberts 2:ea9245bb1c53 132
Wayne Roberts 2:ea9245bb1c53 133 /*************************************************/
Wayne Roberts 2:ea9245bb1c53 134
Wayne Roberts 1:0817a150122b 135 static void gfsk_bitrate_print(void);
Wayne Roberts 1:0817a150122b 136 static bool gfsk_bitrate_write(const char*);
Wayne Roberts 1:0817a150122b 137 static const value_item_t gfsk_bitrate_item;
Wayne Roberts 1:0817a150122b 138
Wayne Roberts 1:0817a150122b 139 static unsigned gfsk_bt_read(bool);
Wayne Roberts 1:0817a150122b 140 static menuMode_e gfsk_bt_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 141 static const dropdown_item_t gfsk_bt_item;
Wayne Roberts 1:0817a150122b 142
Wayne Roberts 1:0817a150122b 143 static unsigned gfsk_rxbw_read(bool);
Wayne Roberts 1:0817a150122b 144 static menuMode_e gfsk_rxbw_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 145 static const dropdown_item_t gfsk_rxbw_item;
Wayne Roberts 1:0817a150122b 146
Wayne Roberts 1:0817a150122b 147 static void gfsk_fdev_print(void);
Wayne Roberts 1:0817a150122b 148 static bool gfsk_fdev_write(const char*);
Wayne Roberts 1:0817a150122b 149 static const value_item_t gfsk_fdev_item;
Wayne Roberts 1:0817a150122b 150
Wayne Roberts 1:0817a150122b 151 static bool gfsk_fixLen_read(void);
Wayne Roberts 1:0817a150122b 152 static bool gfsk_fixLen_push(void);
Wayne Roberts 1:0817a150122b 153 static const toggle_item_t gfsk_fixLen_item;
Wayne Roberts 1:0817a150122b 154
Wayne Roberts 1:0817a150122b 155 static void gfsk_pblLen_print(void);
Wayne Roberts 1:0817a150122b 156 static bool gfsk_pblLen_write(const char*);
Wayne Roberts 1:0817a150122b 157 static const value_item_t gfsk_pblLen_item;
Wayne Roberts 1:0817a150122b 158
Wayne Roberts 1:0817a150122b 159 static unsigned gfsk_pblDetLen_read(bool);
Wayne Roberts 1:0817a150122b 160 static menuMode_e gfsk_pblDetLen_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 161 static const dropdown_item_t gfsk_pblDetLen_item;
Wayne Roberts 1:0817a150122b 162
Wayne Roberts 1:0817a150122b 163 static void gfsk_swl_print(void);
Wayne Roberts 1:0817a150122b 164 static bool gfsk_swl_write(const char*);
Wayne Roberts 1:0817a150122b 165 static const value_item_t gfsk_swl_item;
Wayne Roberts 1:0817a150122b 166
Wayne Roberts 1:0817a150122b 167 static void gfsk_syncword_print(void);
Wayne Roberts 1:0817a150122b 168 static bool gfsk_syncword_write(const char*);
Wayne Roberts 1:0817a150122b 169 static const value_item_t gfsk_syncword_item;
Wayne Roberts 1:0817a150122b 170
Wayne Roberts 1:0817a150122b 171 static unsigned gfsk_addrcomp_read(bool);
Wayne Roberts 1:0817a150122b 172 static menuMode_e gfsk_addrcomp_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 173 static const dropdown_item_t gfsk_addrcomp_item;
Wayne Roberts 1:0817a150122b 174
Wayne Roberts 1:0817a150122b 175 static void gfsk_nodeadrs_print(void);
Wayne Roberts 1:0817a150122b 176 static bool gfsk_nodeadrs_write(const char*);
Wayne Roberts 1:0817a150122b 177 static const value_item_t gfsk_nodeadrs_item;
Wayne Roberts 1:0817a150122b 178
Wayne Roberts 1:0817a150122b 179 static void gfsk_broadcast_print(void);
Wayne Roberts 1:0817a150122b 180 static bool gfsk_broadcast_write(const char*);
Wayne Roberts 1:0817a150122b 181 static const value_item_t gfsk_broadcast_item;
Wayne Roberts 1:0817a150122b 182
Wayne Roberts 1:0817a150122b 183 static unsigned gfsk_crctype_read(bool);
Wayne Roberts 1:0817a150122b 184 static menuMode_e gfsk_crctype_write(unsigned sidx);
Wayne Roberts 1:0817a150122b 185 static const dropdown_item_t gfsk_crctype_item;
Wayne Roberts 1:0817a150122b 186
Wayne Roberts 1:0817a150122b 187 static bool gfsk_white_read(void);
Wayne Roberts 1:0817a150122b 188 static bool gfsk_white_push(void);
Wayne Roberts 1:0817a150122b 189 static const toggle_item_t gfsk_white_item;
Wayne Roberts 1:0817a150122b 190
Wayne Roberts 1:0817a150122b 191 static void gfsk_crcinit_print(void);
Wayne Roberts 1:0817a150122b 192 static bool gfsk_crcinit_write(const char*);
Wayne Roberts 1:0817a150122b 193 static const value_item_t gfsk_crcinit_item;
Wayne Roberts 1:0817a150122b 194
Wayne Roberts 1:0817a150122b 195 static void gfsk_crcpoly_print(void);
Wayne Roberts 1:0817a150122b 196 static bool gfsk_crcpoly_write(const char*);
Wayne Roberts 1:0817a150122b 197 static const value_item_t gfsk_crcpoly_item;
Wayne Roberts 1:0817a150122b 198
Wayne Roberts 1:0817a150122b 199 static void gfsk_whiteInit_print(void);
Wayne Roberts 1:0817a150122b 200 static bool gfsk_whiteInit_write(const char*);
Wayne Roberts 1:0817a150122b 201 static const value_item_t gfsk_whiteInit_item;
Wayne Roberts 2:ea9245bb1c53 202