Files
TencentOS-tiny/board/NUCLEO_STM32L073RZ/BSP/HardWare/Common/bsp.c
Winfred LIN b6cb7147cc added fuzzy matching feature to at_echo; added set some AT+ commands for RHF76; added support for LSM6DS3;
1. in tos_at.h, added int  fuzzy_matching; field into at_echo_st struct, if this field is set to K_TRUE, then if echo message contains the string in "echo_expect" field.
2. added __API__ int tos_at_echo_fuzzy_matching_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect_contains) api to tos_at.c, which will create an at_echo_t with fuzzy_matching = K_TRUE;
3. added RHF76_ATCMD_SET_DELAY and  rhf76_set_delay to RHF76.h to allow set/query RX delay config
4. added RHF76_ATCMD_SET_DATA_RATE and rhf76_set_data_rate to RHF76.h to allow set/query date rate config
5. added rhf76_at_cmd_exe for DEBUG purpose, so that user can execute any AT+ commands they want
6. added code in lora_demo.c to demonstrate package segmentation.
2020-04-06 23:11:48 +10:00

40 lines
1.2 KiB
C

/**
******************************************************************************
* @file bsp.c
* @author jieranzhi
* @brief provide high level interfaces to manage the sensors on the
* application
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "bsp.h"
void BSP_Sensor_Init(DeviceConfig_TypeDef config)
{
/* Initialize sensors */
HTS221_Init();
LPS22HB_Init();
LIS3MDL_Init();
LIS3MDL_Set_FullScale((LIS3MDL_FullScaleTypeDef)config.magn_fullscale);
LSM6DS3_Init();
LSM6DS3_Set_Accel_FullScale((LSM6DS3_AccelFullscaleTypeDef)config.accel_fullscale);
LSM6DS3_Set_Gyro_FullScale((LSM6DS3_GyroFullscaleTypeDef)config.gyro_fullscale);
}
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;
}