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:
Sun Nov 25 15:34:40 2018 -0800
Revision:
4:fa31fdf4ec8d
Parent:
3:56fc764dee0a
Child:
9:295e37c38fb3
add PA-off and xtal trim

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