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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l475e_iot01_tsensor.c Source File

stm32l475e_iot01_tsensor.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l475e_iot01_tsensor.c
00004   * @author  MCD Application Team
00005   * @brief   This file provides a set of functions needed to manage the temperature sensor
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * <h2><center>&copy; 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_tsensor.h"
00022 
00023 /** @addtogroup BSP
00024   * @{
00025   */ 
00026 
00027 /** @addtogroup STM32L475E_IOT01
00028   * @{
00029   */
00030 
00031 /** @defgroup STM32L475E_IOT01_TEMPERATURE TEMPERATURE
00032   * @{
00033   */
00034 
00035 /** @defgroup STM32L475E_IOT01_TEMPERATURE_Private_Variables TEMPERATURE Private Variables 
00036   * @{
00037   */ 
00038 static TSENSOR_DrvTypeDef *tsensor_drv;  
00039 /**
00040   * @}
00041   */
00042 
00043 /** @defgroup STM32L475E_IOT01_TEMPERATURE_Private_Functions TEMPERATURE Private Functions
00044   * @{
00045   */
00046 
00047 /**
00048   * @brief  Initializes peripherals used by the I2C Temperature Sensor driver.
00049   * @retval TSENSOR status
00050   */
00051 uint32_t BSP_TSENSOR_Init(void)
00052 {  
00053   uint8_t ret = TSENSOR_ERROR;
00054 
00055 #ifdef USE_LPS22HB_TEMP
00056   tsensor_drv = &LPS22HB_T_Drv;
00057 #else /* USE_HTS221_TEMP */
00058   tsensor_drv = &HTS221_T_Drv; 
00059 #endif
00060 
00061   /* Low level init */
00062   SENSOR_IO_Init();
00063 
00064   /* TSENSOR Init */   
00065   tsensor_drv->Init(TSENSOR_I2C_ADDRESS, NULL);
00066 
00067   ret = TSENSOR_OK;
00068   
00069   return ret;
00070 }
00071 
00072 /**
00073   * @brief  Read Temperature register of TS751.
00074   * @retval STTS751 measured temperature value.
00075   */
00076 float BSP_TSENSOR_ReadTemp(void)
00077 { 
00078   return tsensor_drv->ReadTemp(TSENSOR_I2C_ADDRESS);
00079 }
00080 
00081 /**
00082   * @}
00083   */
00084 
00085 /**
00086   * @}
00087   */
00088 
00089 /**
00090   * @}
00091   */
00092 
00093 /**
00094   * @}
00095   */
00096 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/