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:
Mon Apr 29 13:54:35 2019 -0700
Revision:
2:972a5704f152
Parent:
0:e1e70da93044
add Ticker for polling photo-sensor and pressure/temp-sensor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wayne Roberts 0:e1e70da93044 1 #include "x_nucleo_iks01a2.h"
Wayne Roberts 0:e1e70da93044 2 #include "x_nucleo_iks01a2_accelero.h"
Wayne Roberts 0:e1e70da93044 3 #include "x_nucleo_iks01a2_pressure.h"
Wayne Roberts 0:e1e70da93044 4 #include "x_nucleo_iks01a2_temperature.h"
Wayne Roberts 0:e1e70da93044 5
Wayne Roberts 0:e1e70da93044 6 #define SAMPLE_LIST_MAX 10 /*!< Max. number of acceleration values (X,Y,Z) to be printed to UART */
Wayne Roberts 0:e1e70da93044 7 #define FIFO_INDICATION_DELAY 100 /*!< When FIFO event ocurs, LED is ON for at least this period [ms] */
Wayne Roberts 0:e1e70da93044 8
Wayne Roberts 0:e1e70da93044 9 #define LIS2DH_MAIN_NONE 0
Wayne Roberts 0:e1e70da93044 10 #define LIS2DH_BSP_FAIL 1
Wayne Roberts 0:e1e70da93044 11 #define LIS2DH_FAIL 2
Wayne Roberts 0:e1e70da93044 12 #define LIS2DH_FAIL_STATE 3
Wayne Roberts 0:e1e70da93044 13 #define LIS2DH_MAIN_SLEEP 4
Wayne Roberts 0:e1e70da93044 14 #define LIS2DH_MAIN_READ_FIFO 5
Wayne Roberts 0:e1e70da93044 15
Wayne Roberts 0:e1e70da93044 16 #ifdef __cplusplus
Wayne Roberts 0:e1e70da93044 17 extern "C" {
Wayne Roberts 0:e1e70da93044 18 #endif
Wayne Roberts 0:e1e70da93044 19
Wayne Roberts 0:e1e70da93044 20 typedef struct displayFloatToInt_s
Wayne Roberts 0:e1e70da93044 21 {
Wayne Roberts 0:e1e70da93044 22 int8_t sign; /* 0 means positive, 1 means negative */
Wayne Roberts 0:e1e70da93044 23 uint32_t out_int;
Wayne Roberts 0:e1e70da93044 24 uint32_t out_dec;
Wayne Roberts 0:e1e70da93044 25 } displayFloatToInt_t;
Wayne Roberts 0:e1e70da93044 26
Wayne Roberts 0:e1e70da93044 27 int demo_start(void);
Wayne Roberts 0:e1e70da93044 28
Wayne Roberts 0:e1e70da93044 29 int lis2dh_mainloop(void);
Wayne Roberts 0:e1e70da93044 30
Wayne Roberts 0:e1e70da93044 31 uint8_t accel_get_num_samples(void);
Wayne Roberts 0:e1e70da93044 32 int lis2dh_set_fifo_bypass(void);
Wayne Roberts 0:e1e70da93044 33 DrvStatusTypeDef lis2dh12_get_axes(SensorAxes_t *);
Wayne Roberts 0:e1e70da93044 34
Wayne Roberts 0:e1e70da93044 35 void lis2dh_int1(void); // irq callback
Wayne Roberts 0:e1e70da93044 36
Wayne Roberts 0:e1e70da93044 37 void c_log_printf(const char* format, ...); // from main.cpp
Wayne Roberts 0:e1e70da93044 38 void demo_sample_temp(displayFloatToInt_t*);
Wayne Roberts 0:e1e70da93044 39 void demo_sample_pressure(displayFloatToInt_t*);
Wayne Roberts 0:e1e70da93044 40 int lis2dh_set_fifo_mode(void);
Wayne Roberts 0:e1e70da93044 41 int accel_enable(uint8_t);
Wayne Roberts 0:e1e70da93044 42 int accel_is_enabled(uint8_t* status);
Wayne Roberts 0:e1e70da93044 43
Wayne Roberts 0:e1e70da93044 44 #ifdef __cplusplus
Wayne Roberts 0:e1e70da93044 45 }
Wayne Roberts 0:e1e70da93044 46 #endif