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


Wayne Roberts

File content as of revision 2:972a5704f152:

        static uint8_t bw_idx;

        static void targetInit(void);

        static const menu_t fsk_menu[];
        static const menu_t ook_menu[];
        static const menu_t ook_fixed_menu[];
        static const menu_t ook_peak_menu[];
        static const menu_t ook_average_menu[];

        static RegPaRamp_t RegPaRamp;

        static bool paSelect_read(void);
        static bool paSelect_push(void);
        static const toggle_item_t paSelect_item ;

        static void ocp_print(void);
        static bool ocp_write(const char* txt);
        static const value_item_t ocp_item;

        static void gfsk_fdev_print(void);
        static bool gfsk_fdev_write(const char* txt);
        static const value_item_t gfsk_fdev_item;

        static void fsk_ook_bps_print(void);
        static bool fsk_ook_bps_write(const char*);
        static const value_item_t fsk_ook_bitrate_item;

        static unsigned bt_read(bool);
        static menuMode_e bt_write(unsigned sidx);
        static const dropdown_item_t gfsk_bt_item;
        static const dropdown_item_t ook_bt_item;

        static unsigned rxbw_read(bool);
        static menuMode_e rxbw_write(unsigned sidx);
        static const dropdown_item_t rxbw_item;

        static unsigned bw_read(uint8_t regAddr);
        static void bw_write(unsigned sidx, uint8_t regAddr);

        static unsigned afcbw_read(bool);
        static menuMode_e afcbw_write(unsigned sidx);
        static const dropdown_item_t afcbw_item;

        static unsigned lora_bw_read(bool);
        static menuMode_e lora_bw_write(unsigned sidx);
        static dropdown_item_t lora_bw_item;    // strings written at runtime

        static void lora_sf_print(void);
        static bool lora_sf_write(const char*);
        static const value_item_t lora_sf_item;

        static unsigned lora_cr_read(bool);
        static menuMode_e lora_cr_write(unsigned sidx);
        static const dropdown_item_t lora_cr_item;

        static void lora_pblLen_print(void);
        static bool lora_pblLen_write(const char*);
        static const value_item_t lora_pblLen_item;

        static unsigned lora_fixlen_read(bool);
        static menuMode_e lora_fixlen_write(unsigned sidx);
        static const dropdown_item_t lora_fixlen_item;

        static bool lora_crcon_read(void);
        static bool lora_crcon_push(void);
        static const toggle_item_t lora_crcon_item;

        static bool lora_iqinvTX_read(void);
        static bool lora_iqinvTX_push(void);
        static const toggle_item_t lora_iqinvTX_item;

        static bool lora_iqinvRX_read(void);
        static bool lora_iqinvRX_push(void);
        static const toggle_item_t lora_iqinvRX_item;

        static void lora_ppg_print(void);
        static bool lora_ppg_write(const char*);
        static const value_item_t lora_ppg_item;

        static void pblLen_print(void);
        static bool pblLen_write(const char*);
        static const value_item_t pblLen_item ;

        static unsigned rxTrigger_read(bool);
        static menuMode_e rxTrigger_write(unsigned sidx);
        static const dropdown_item_t rxTrigger_item;

        static bool AgcAutoOn_read(void);
        static bool AgcAutoOn_push(void);
        static const toggle_item_t agcautoon_item;

        static bool AfcAutoOn_read(void);
        static bool AfcAutoOn_push(void);
        static const toggle_item_t afcautoon_item;

        static bool RestartRxOnCollision_read(void);
        static bool RestartRxOnCollision_push(void);
        static const toggle_item_t RestartRxOnCollision_item;

        static void RestartRxWithPllLock_push(void);
        static const button_item_t RestartRxWithPllLock_item;

        static void RestartRxWithoutPllLock_push(void);
        static const button_item_t RestartRxWithoutPllLock_item;

        static bool AfcAutoClearOn_read(void);
        static bool AfcAutoClearOn_push(void);
        static const toggle_item_t AfcAutoClearOn_item;

        static void AfcClear_push(void);
        static const button_item_t AfcClear_item;

        static void AgcStart_push(void);
        static const button_item_t AgcStart_item;

        static void syncWord_print(void);
        static bool syncWord_write(const char*);
        static const value_item_t syncWord_item;

        static void syncSize_print(void);
        static bool syncSize_write(const char*);
        static const value_item_t syncSize_item;

        static bool SyncOn_read(void);
        static bool SyncOn_push(void);
        static const toggle_item_t syncOn_item;

        static bool fsk_pktfmt_read(void);
        static bool fsk_pktfmt_push(void);
        static const toggle_item_t fskook_pktfmt_item;

        static void rssiOffset_print(void);
        static bool rssiOffset_write(const char*);
        static const value_item_t rssiOffset_item;

        static unsigned rssiSmoothing_read(bool);
        static menuMode_e rssiSmoothing_write(unsigned sidx);
        static const dropdown_item_t rssiSmoothing_item;

        static bool dataMode_read(void);
        static bool dataMode_push(void);
        static const toggle_item_t dataMode_item;

        static bool bitSyncOn_read(void);
        static bool bitSyncOn_push(void);
        static const toggle_item_t bitSyncOn_item;

        static const button_item_t pdLabel_item;

        static bool pdOn_read(void);
        static bool pdOn_push(void);
        static const toggle_item_t pdOn_item;

        static unsigned pdSize_read(bool);
        static menuMode_e pdSize_write(unsigned sidx);
        static const dropdown_item_t pdSize_item;

        static void pdTol_print(void);
        static bool pdTol_write(const char*);
        static const value_item_t pdTol_item;

        static bool TxStartCondition_read(void);
        static bool TxStartCondition_push(void);
        static const toggle_item_t TxStartCondition_item;

        static void FifoThreshold_print(void);
        static bool FifoThreshold_write(const char*);
        static const value_item_t FifoThreshold_item ;

        static unsigned dcFree_read(bool);
        static menuMode_e dcFree_write(unsigned sidx);
        static const dropdown_item_t dcFree_item;

        static bool fskook_crcon_read(void);
        static bool fskook_crcon_push(void);
        static const toggle_item_t fskook_crcon_item;

        static void rssiThresh_print(void);
        static bool rssiThresh_write(const char*);
        static const value_item_t rssiThresh_item ;

        static const button_item_t ookLabel_item;

        static unsigned ookthreshtype_read(bool);
        static menuMode_e ookthreshtype_write(unsigned sidx);
        static const dropdown_item_t ookthreshtype_item;

        static unsigned ook_peak_step_read(bool);
        static menuMode_e ook_peak_step_write(unsigned sidx);
        static const dropdown_item_t ook_peak_step_item;

        static unsigned ook_peak_dec_read(bool);
        static menuMode_e ook_peak_dec_write(unsigned sidx);
        static const dropdown_item_t ook_peak_dec_item;

        static void ookFixedThresh_print(void);
        static bool ookFixedThresh_write(const char*);
        static const value_item_t ookFixedThresh_item;

        static unsigned ook_avgOffset_read(bool);
        static menuMode_e ook_avgOffset_write(unsigned sidx);
        static const dropdown_item_t ook_avgOffset_item;

        static unsigned ook_avgFilter_read(bool);
        static menuMode_e ook_avgFilter_write(unsigned sidx);
        static const dropdown_item_t ook_avgFilter_item;

        static bool pblPol_read(void);
        static bool pblPol_push(void);
        static const toggle_item_t pblPol_item;

        static void cadrx_push(void);
        static const button_item_t lora_cadrx_item;