added lorawan example in IAR, and added support for LIS3MDL and LPS22HB sensors
1. modified the HTS221: removed magic numbers, added a sensor_tempnhumi_t struct to accommodate temperature and humidity data 2. added .h and .c files for LIS3MDL magnetic sensor 3. added .h and .c files for LPS22HB pressure sensor 3. added IAR (EWARM) project for lorawan example 4. added bsp.c and bsp.h to manager the sensors
This commit is contained in:
35
board/NUCLEO_STM32L073RZ/BSP/HardWare/Common/bsp.c
Normal file
35
board/NUCLEO_STM32L073RZ/BSP/HardWare/Common/bsp.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file bsp.c
|
||||
* @author jieranzhi
|
||||
* @brief provide high level interfaces to manage the sensors on the
|
||||
* application, this is a modified version of the official api
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "bsp.h"
|
||||
|
||||
void BSP_Sensor_Init(void)
|
||||
{
|
||||
/* Initialize sensors */
|
||||
HTS221_Init();
|
||||
LPS22HB_Init();
|
||||
LIS3MDL_Init();
|
||||
}
|
||||
|
||||
void BSP_Sensor_Read(sensor_data_t *sensor_data)
|
||||
{
|
||||
sensor_tempnhumi_t tempnhumi_sensor;
|
||||
sensor_press_t press_sensor;
|
||||
sensor_magn_t magn_sensor;
|
||||
|
||||
HTS221_Get_TemperatureAndHumidity(&tempnhumi_sensor);
|
||||
LPS22HB_Get_Press(&press_sensor);
|
||||
LIS3MDL_Get_Magn(&magn_sensor);
|
||||
|
||||
sensor_data->sensor_press = press_sensor;
|
||||
sensor_data->sensor_tempnhumi = tempnhumi_sensor;
|
||||
sensor_data->sensor_magn = magn_sensor;
|
||||
}
|
||||
|
Reference in New Issue
Block a user