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
https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/
Drivers/BSP/B-L475E-IOT01/stm32l475e_iot01_psensor.c@7:bfe8272ced90, 2019-09-24 (annotated)
- Committer:
- jeromecoutant
- Date:
- Tue Sep 24 15:30:09 2019 +0200
- Revision:
- 7:bfe8272ced90
- Parent:
- 6:9dfa42666f03
Update BSP files with STM32Cube L4 V1.14.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 3:c6b5944187d5 | 1 | /** |
bcostm | 3:c6b5944187d5 | 2 | ****************************************************************************** |
bcostm | 3:c6b5944187d5 | 3 | * @file stm32l475e_iot01_psensor.c |
bcostm | 3:c6b5944187d5 | 4 | * @author MCD Application Team |
bcostm | 3:c6b5944187d5 | 5 | * @brief This file provides a set of functions needed to manage the pressure sensor |
bcostm | 3:c6b5944187d5 | 6 | ****************************************************************************** |
bcostm | 3:c6b5944187d5 | 7 | * @attention |
bcostm | 3:c6b5944187d5 | 8 | * |
jeromecoutant | 7:bfe8272ced90 | 9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
bcostm | 3:c6b5944187d5 | 10 | * All rights reserved.</center></h2> |
bcostm | 3:c6b5944187d5 | 11 | * |
jeromecoutant | 7:bfe8272ced90 | 12 | * This software component is licensed by ST under BSD 3-Clause license, |
jeromecoutant | 7:bfe8272ced90 | 13 | * the "License"; You may not use this file except in compliance with the |
jeromecoutant | 7:bfe8272ced90 | 14 | * License. You may obtain a copy of the License at: |
jeromecoutant | 7:bfe8272ced90 | 15 | * opensource.org/licenses/BSD-3-Clause |
bcostm | 3:c6b5944187d5 | 16 | * |
bcostm | 3:c6b5944187d5 | 17 | ****************************************************************************** |
bcostm | 3:c6b5944187d5 | 18 | */ |
bcostm | 3:c6b5944187d5 | 19 | |
bcostm | 3:c6b5944187d5 | 20 | /* Includes ------------------------------------------------------------------*/ |
bcostm | 3:c6b5944187d5 | 21 | #include "stm32l475e_iot01_psensor.h" |
bcostm | 3:c6b5944187d5 | 22 | |
bcostm | 3:c6b5944187d5 | 23 | /** @addtogroup BSP |
bcostm | 3:c6b5944187d5 | 24 | * @{ |
bcostm | 3:c6b5944187d5 | 25 | */ |
bcostm | 3:c6b5944187d5 | 26 | |
bcostm | 3:c6b5944187d5 | 27 | /** @addtogroup STM32L475E_IOT01 |
bcostm | 3:c6b5944187d5 | 28 | * @{ |
bcostm | 3:c6b5944187d5 | 29 | */ |
bcostm | 3:c6b5944187d5 | 30 | |
bcostm | 3:c6b5944187d5 | 31 | /** @defgroup STM32L475E_IOT01_PRESSURE PRESSURE |
bcostm | 3:c6b5944187d5 | 32 | * @{ |
bcostm | 3:c6b5944187d5 | 33 | */ |
bcostm | 3:c6b5944187d5 | 34 | |
bcostm | 3:c6b5944187d5 | 35 | /** @defgroup STM32L475E_IOT01_PRESSURE_Private_Variables PRESSURE Private Variables |
bcostm | 3:c6b5944187d5 | 36 | * @{ |
bcostm | 3:c6b5944187d5 | 37 | */ |
bcostm | 3:c6b5944187d5 | 38 | static PSENSOR_DrvTypeDef *Psensor_drv; |
bcostm | 3:c6b5944187d5 | 39 | /** |
bcostm | 3:c6b5944187d5 | 40 | * @} |
bcostm | 3:c6b5944187d5 | 41 | */ |
bcostm | 3:c6b5944187d5 | 42 | |
bcostm | 3:c6b5944187d5 | 43 | /** @defgroup STM32L475E_IOT01_PRESSURE_Private_Functions PRESSURE Private Functions |
bcostm | 3:c6b5944187d5 | 44 | * @{ |
bcostm | 3:c6b5944187d5 | 45 | */ |
bcostm | 3:c6b5944187d5 | 46 | |
bcostm | 3:c6b5944187d5 | 47 | /** |
bcostm | 3:c6b5944187d5 | 48 | * @brief Initializes peripherals used by the I2C Pressure Sensor driver. |
bcostm | 3:c6b5944187d5 | 49 | * @retval PSENSOR status |
bcostm | 3:c6b5944187d5 | 50 | */ |
bcostm | 3:c6b5944187d5 | 51 | uint32_t BSP_PSENSOR_Init(void) |
bcostm | 3:c6b5944187d5 | 52 | { |
bcostm | 3:c6b5944187d5 | 53 | uint32_t ret; |
bcostm | 3:c6b5944187d5 | 54 | |
bcostm | 3:c6b5944187d5 | 55 | if(LPS22HB_P_Drv.ReadID(LPS22HB_I2C_ADDRESS) != LPS22HB_WHO_AM_I_VAL) |
bcostm | 3:c6b5944187d5 | 56 | { |
bcostm | 3:c6b5944187d5 | 57 | ret = PSENSOR_ERROR; |
bcostm | 3:c6b5944187d5 | 58 | } |
bcostm | 3:c6b5944187d5 | 59 | else |
bcostm | 3:c6b5944187d5 | 60 | { |
bcostm | 3:c6b5944187d5 | 61 | Psensor_drv = &LPS22HB_P_Drv; |
bcostm | 3:c6b5944187d5 | 62 | |
bcostm | 3:c6b5944187d5 | 63 | /* PSENSOR Init */ |
bcostm | 3:c6b5944187d5 | 64 | Psensor_drv->Init(LPS22HB_I2C_ADDRESS); |
bcostm | 3:c6b5944187d5 | 65 | ret = PSENSOR_OK; |
bcostm | 3:c6b5944187d5 | 66 | } |
bcostm | 3:c6b5944187d5 | 67 | |
bcostm | 3:c6b5944187d5 | 68 | return ret; |
bcostm | 3:c6b5944187d5 | 69 | } |
bcostm | 3:c6b5944187d5 | 70 | |
bcostm | 3:c6b5944187d5 | 71 | /** |
bcostm | 3:c6b5944187d5 | 72 | * @brief Read ID of LPS22HB. |
bcostm | 3:c6b5944187d5 | 73 | * @retval LPS22HB ID value. |
bcostm | 3:c6b5944187d5 | 74 | */ |
bcostm | 3:c6b5944187d5 | 75 | uint8_t BSP_PSENSOR_ReadID(void) |
bcostm | 3:c6b5944187d5 | 76 | { |
bcostm | 3:c6b5944187d5 | 77 | return Psensor_drv->ReadID(LPS22HB_I2C_ADDRESS); |
bcostm | 3:c6b5944187d5 | 78 | } |
bcostm | 3:c6b5944187d5 | 79 | |
bcostm | 3:c6b5944187d5 | 80 | /** |
bcostm | 3:c6b5944187d5 | 81 | * @brief Read Pressure register of LPS22HB. |
bcostm | 3:c6b5944187d5 | 82 | * @retval LPS22HB measured pressure value. |
bcostm | 3:c6b5944187d5 | 83 | */ |
bcostm | 3:c6b5944187d5 | 84 | float BSP_PSENSOR_ReadPressure(void) |
bcostm | 3:c6b5944187d5 | 85 | { |
bcostm | 3:c6b5944187d5 | 86 | return Psensor_drv->ReadPressure(LPS22HB_I2C_ADDRESS); |
bcostm | 3:c6b5944187d5 | 87 | } |
bcostm | 3:c6b5944187d5 | 88 | /** |
bcostm | 3:c6b5944187d5 | 89 | * @} |
bcostm | 3:c6b5944187d5 | 90 | */ |
bcostm | 3:c6b5944187d5 | 91 | |
bcostm | 3:c6b5944187d5 | 92 | /** |
bcostm | 3:c6b5944187d5 | 93 | * @} |
bcostm | 3:c6b5944187d5 | 94 | */ |
bcostm | 3:c6b5944187d5 | 95 | |
bcostm | 3:c6b5944187d5 | 96 | /** |
bcostm | 3:c6b5944187d5 | 97 | * @} |
bcostm | 3:c6b5944187d5 | 98 | */ |
bcostm | 3:c6b5944187d5 | 99 | |
bcostm | 3:c6b5944187d5 | 100 | /** |
bcostm | 3:c6b5944187d5 | 101 | * @} |
bcostm | 3:c6b5944187d5 | 102 | */ |
bcostm | 3:c6b5944187d5 | 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |