Contains the BSP driver for the B-L475E-IOT01 board.
Dependents: mbed-os-example-ble-Thermometer DISCO_L475VG_IOT01-Telegram-BOT DISCO_L475VG_IOT01-sche_cheveux DISCO_L475VG_IOT01-QSPI_FLASH_FILE_SYSTEM ... more
stm32l475e_iot01_psensor.c
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l475e_iot01_psensor.c 00004 * @author MCD Application Team 00005 * @brief This file provides a set of functions needed to manage the pressure sensor 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Includes ------------------------------------------------------------------*/ 00021 #include "stm32l475e_iot01_psensor.h" 00022 00023 /** @addtogroup BSP 00024 * @{ 00025 */ 00026 00027 /** @addtogroup STM32L475E_IOT01 00028 * @{ 00029 */ 00030 00031 /** @defgroup STM32L475E_IOT01_PRESSURE PRESSURE 00032 * @{ 00033 */ 00034 00035 /** @defgroup STM32L475E_IOT01_PRESSURE_Private_Variables PRESSURE Private Variables 00036 * @{ 00037 */ 00038 static PSENSOR_DrvTypeDef *Psensor_drv; 00039 /** 00040 * @} 00041 */ 00042 00043 /** @defgroup STM32L475E_IOT01_PRESSURE_Private_Functions PRESSURE Private Functions 00044 * @{ 00045 */ 00046 00047 /** 00048 * @brief Initializes peripherals used by the I2C Pressure Sensor driver. 00049 * @retval PSENSOR status 00050 */ 00051 uint32_t BSP_PSENSOR_Init(void) 00052 { 00053 uint32_t ret; 00054 00055 if(LPS22HB_P_Drv.ReadID(LPS22HB_I2C_ADDRESS) != LPS22HB_WHO_AM_I_VAL) 00056 { 00057 ret = PSENSOR_ERROR; 00058 } 00059 else 00060 { 00061 Psensor_drv = &LPS22HB_P_Drv; 00062 00063 /* PSENSOR Init */ 00064 Psensor_drv->Init(LPS22HB_I2C_ADDRESS); 00065 ret = PSENSOR_OK; 00066 } 00067 00068 return ret; 00069 } 00070 00071 /** 00072 * @brief Read ID of LPS22HB. 00073 * @retval LPS22HB ID value. 00074 */ 00075 uint8_t BSP_PSENSOR_ReadID(void) 00076 { 00077 return Psensor_drv->ReadID(LPS22HB_I2C_ADDRESS); 00078 } 00079 00080 /** 00081 * @brief Read Pressure register of LPS22HB. 00082 * @retval LPS22HB measured pressure value. 00083 */ 00084 float BSP_PSENSOR_ReadPressure(void) 00085 { 00086 return Psensor_drv->ReadPressure(LPS22HB_I2C_ADDRESS); 00087 } 00088 /** 00089 * @} 00090 */ 00091 00092 /** 00093 * @} 00094 */ 00095 00096 /** 00097 * @} 00098 */ 00099 00100 /** 00101 * @} 00102 */ 00103 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 13:55:42 by 1.7.2