test sending sensor results over lora radio. Accelerometer and temp/pressure.

Dependencies:   SX127x

Serial terminal operates at 115200.

This project provides a text-based menu over serial port.
Operating the program only requires using the arrow keys, enter key to activate a control, or entering numbers.

Two sensors provided:


LIS12DH12 accelerometer operates in a continuous sampling mode. Enable control for accelerometer enables this continuous sampling, approx every 3 seconds.
LPS22HH temperature / pressure sensor operates as single shot, where pressing the control button on terminal causes single sample to be performed.

poll rate control will enable repeated reading of pressure/temperature-sensor or photo-sensor when poll rate is greater than zero.

target must be: DISCO_L072CZ_LRWAN1

Committer:
Wayne Roberts
Date:
Wed Apr 24 10:11:06 2019 -0700
Revision:
0:e1e70da93044
initial commit

Who changed what in which revision?

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