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_hsensor.c
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l475e_iot01_hsensor.c 00004 * @author MCD Application Team 00005 * @brief This file provides a set of functions needed to manage the humidity 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_hsensor.h" 00022 00023 /** @addtogroup BSP 00024 * @{ 00025 */ 00026 00027 /** @addtogroup STM32L475E_IOT01 00028 * @{ 00029 */ 00030 00031 /** @defgroup STM32L475E_IOT01_HUMIDITY HUMIDITY 00032 * @{ 00033 */ 00034 00035 /** @defgroup STM32L475E_IOT01_HUMIDITY_Private_Variables HUMIDITY Private Variables 00036 * @{ 00037 */ 00038 static HSENSOR_DrvTypeDef *Hsensor_drv; 00039 /** 00040 * @} 00041 */ 00042 00043 /** @defgroup STM32L475E_IOT01_HUMIDITY_Private_Functions HUMIDITY Private Functions 00044 * @{ 00045 */ 00046 00047 /** 00048 * @brief Initializes peripherals used by the I2C Humidity Sensor driver. 00049 * @retval HSENSOR status 00050 */ 00051 uint32_t BSP_HSENSOR_Init(void) 00052 { 00053 uint32_t ret; 00054 00055 if(HTS221_H_Drv.ReadID(HTS221_I2C_ADDRESS) != HTS221_WHO_AM_I_VAL) 00056 { 00057 ret = HSENSOR_ERROR; 00058 } 00059 else 00060 { 00061 Hsensor_drv = &HTS221_H_Drv; 00062 /* HSENSOR Init */ 00063 Hsensor_drv->Init(HTS221_I2C_ADDRESS); 00064 ret = HSENSOR_OK; 00065 } 00066 00067 return ret; 00068 } 00069 00070 /** 00071 * @brief Read ID of HTS221. 00072 * @retval HTS221 ID value. 00073 */ 00074 uint8_t BSP_HSENSOR_ReadID(void) 00075 { 00076 return Hsensor_drv->ReadID(HTS221_I2C_ADDRESS); 00077 } 00078 00079 /** 00080 * @brief Read Humidity register of HTS221. 00081 * @retval HTS221 measured humidity value. 00082 */ 00083 float BSP_HSENSOR_ReadHumidity(void) 00084 { 00085 return Hsensor_drv->ReadHumidity(HTS221_I2C_ADDRESS); 00086 } 00087 /** 00088 * @} 00089 */ 00090 00091 /** 00092 * @} 00093 */ 00094 00095 /** 00096 * @} 00097 */ 00098 00099 /** 00100 * @} 00101 */ 00102 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 13:55:42 by 1.7.2