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/

Committer:
jeromecoutant
Date:
Tue Sep 24 15:30:09 2019 +0200
Revision:
7:bfe8272ced90
Parent:
4:137bb367ba50
Update BSP files with STM32Cube L4 V1.14.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 4:137bb367ba50 1 /**
bcostm 4:137bb367ba50 2 ******************************************************************************
bcostm 4:137bb367ba50 3 * @file hts221.h
bcostm 4:137bb367ba50 4 * @author MCD Application Team
bcostm 4:137bb367ba50 5 * @brief HTS221 header driver file
bcostm 4:137bb367ba50 6 ******************************************************************************
bcostm 4:137bb367ba50 7 * @attention
bcostm 4:137bb367ba50 8 *
jeromecoutant 7:bfe8272ced90 9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
jeromecoutant 7:bfe8272ced90 10 * All rights reserved.</center></h2>
bcostm 4:137bb367ba50 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 4:137bb367ba50 16 *
bcostm 4:137bb367ba50 17 ******************************************************************************
bcostm 4:137bb367ba50 18 */
bcostm 4:137bb367ba50 19
bcostm 4:137bb367ba50 20 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 4:137bb367ba50 21 #ifndef __HTS221__H
bcostm 4:137bb367ba50 22 #define __HTS221__H
bcostm 4:137bb367ba50 23
bcostm 4:137bb367ba50 24 #ifdef __cplusplus
bcostm 4:137bb367ba50 25 extern "C" {
bcostm 4:137bb367ba50 26 #endif
bcostm 4:137bb367ba50 27
bcostm 4:137bb367ba50 28 /* Includes ------------------------------------------------------------------*/
bcostm 4:137bb367ba50 29 #include "../Common/hsensor.h"
bcostm 4:137bb367ba50 30 #include "../Common/tsensor.h"
bcostm 4:137bb367ba50 31
bcostm 4:137bb367ba50 32 /** @addtogroup BSP
bcostm 4:137bb367ba50 33 * @{
bcostm 4:137bb367ba50 34 */
bcostm 4:137bb367ba50 35
bcostm 4:137bb367ba50 36 /** @addtogroup Component
bcostm 4:137bb367ba50 37 * @{
bcostm 4:137bb367ba50 38 */
bcostm 4:137bb367ba50 39
bcostm 4:137bb367ba50 40 /** @addtogroup HTS221
bcostm 4:137bb367ba50 41 * @{
bcostm 4:137bb367ba50 42 */
bcostm 4:137bb367ba50 43
bcostm 4:137bb367ba50 44 /** @defgroup HTS221_Exported_Constants HTS221 Exported Constants
bcostm 4:137bb367ba50 45 * @{
bcostm 4:137bb367ba50 46 */
bcostm 4:137bb367ba50 47
bcostm 4:137bb367ba50 48 /**
bcostm 4:137bb367ba50 49 * @brief Bitfield positioning.
bcostm 4:137bb367ba50 50 */
bcostm 4:137bb367ba50 51 #define HTS221_BIT(x) ((uint8_t)x)
bcostm 4:137bb367ba50 52
bcostm 4:137bb367ba50 53
bcostm 4:137bb367ba50 54 /**
bcostm 4:137bb367ba50 55 * @brief Device Identification register.
bcostm 4:137bb367ba50 56 * Read
bcostm 4:137bb367ba50 57 * Default value: 0xBC
bcostm 4:137bb367ba50 58 * 7:0 This read-only register contains the device identifier for HTS221.
bcostm 4:137bb367ba50 59 */
bcostm 4:137bb367ba50 60 #define HTS221_WHO_AM_I_REG (uint8_t)0x0F
bcostm 4:137bb367ba50 61
bcostm 4:137bb367ba50 62 /**
bcostm 4:137bb367ba50 63 * @brief Device Identification value.
bcostm 4:137bb367ba50 64 */
bcostm 4:137bb367ba50 65 #define HTS221_WHO_AM_I_VAL (uint8_t)0xBC
bcostm 4:137bb367ba50 66
bcostm 4:137bb367ba50 67
bcostm 4:137bb367ba50 68 /**
bcostm 4:137bb367ba50 69 * @brief Humidity and temperature average mode register.
bcostm 4:137bb367ba50 70 * Read/write
bcostm 4:137bb367ba50 71 * Default value: 0x1B
bcostm 4:137bb367ba50 72 * 7:6 Reserved.
bcostm 4:137bb367ba50 73 * 5:3 AVGT2-AVGT1-AVGT0: Select the temperature internal average.
bcostm 4:137bb367ba50 74 *
bcostm 4:137bb367ba50 75 * AVGT2 | AVGT1 | AVGT0 | Nr. Internal Average
bcostm 4:137bb367ba50 76 * ----------------------------------------------------
bcostm 4:137bb367ba50 77 * 0 | 0 | 0 | 2
bcostm 4:137bb367ba50 78 * 0 | 0 | 1 | 4
bcostm 4:137bb367ba50 79 * 0 | 1 | 0 | 8
bcostm 4:137bb367ba50 80 * 0 | 1 | 1 | 16
bcostm 4:137bb367ba50 81 * 1 | 0 | 0 | 32
bcostm 4:137bb367ba50 82 * 1 | 0 | 1 | 64
bcostm 4:137bb367ba50 83 * 1 | 1 | 0 | 128
bcostm 4:137bb367ba50 84 * 1 | 1 | 1 | 256
bcostm 4:137bb367ba50 85 *
bcostm 4:137bb367ba50 86 * 2:0 AVGH2-AVGH1-AVGH0: Select humidity internal average.
bcostm 4:137bb367ba50 87 * AVGH2 | AVGH1 | AVGH0 | Nr. Internal Average
bcostm 4:137bb367ba50 88 * ------------------------------------------------------
bcostm 4:137bb367ba50 89 * 0 | 0 | 0 | 4
bcostm 4:137bb367ba50 90 * 0 | 0 | 1 | 8
bcostm 4:137bb367ba50 91 * 0 | 1 | 0 | 16
bcostm 4:137bb367ba50 92 * 0 | 1 | 1 | 32
bcostm 4:137bb367ba50 93 * 1 | 0 | 0 | 64
bcostm 4:137bb367ba50 94 * 1 | 0 | 1 | 128
bcostm 4:137bb367ba50 95 * 1 | 1 | 0 | 256
bcostm 4:137bb367ba50 96 * 1 | 1 | 1 | 512
bcostm 4:137bb367ba50 97 *
bcostm 4:137bb367ba50 98 */
bcostm 4:137bb367ba50 99 #define HTS221_AV_CONF_REG (uint8_t)0x10
bcostm 4:137bb367ba50 100
bcostm 4:137bb367ba50 101 #define HTS221_AVGT_BIT HTS221_BIT(3)
bcostm 4:137bb367ba50 102 #define HTS221_AVGH_BIT HTS221_BIT(0)
bcostm 4:137bb367ba50 103
bcostm 4:137bb367ba50 104 #define HTS221_AVGH_MASK (uint8_t)0x07
bcostm 4:137bb367ba50 105 #define HTS221_AVGT_MASK (uint8_t)0x38
bcostm 4:137bb367ba50 106
bcostm 4:137bb367ba50 107 /**
bcostm 4:137bb367ba50 108 * @brief Control register 1.
bcostm 4:137bb367ba50 109 * Read/write
bcostm 4:137bb367ba50 110 * Default value: 0x00
bcostm 4:137bb367ba50 111 * 7 PD: power down control. 0 - power down mode; 1 - active mode.
bcostm 4:137bb367ba50 112 * 6:3 Reserved.
bcostm 4:137bb367ba50 113 * 2 BDU: block data update. 0 - continuous update
bcostm 4:137bb367ba50 114 * 1 - output registers not updated until MSB and LSB reading.
bcostm 4:137bb367ba50 115 * 1:0 ODR1, ODR0: output data rate selection.
bcostm 4:137bb367ba50 116 *
bcostm 4:137bb367ba50 117 * ODR1 | ODR0 | Humidity output data-rate(Hz) | Pressure output data-rate(Hz)
bcostm 4:137bb367ba50 118 * ----------------------------------------------------------------------------------
bcostm 4:137bb367ba50 119 * 0 | 0 | one shot | one shot
bcostm 4:137bb367ba50 120 * 0 | 1 | 1 | 1
bcostm 4:137bb367ba50 121 * 1 | 0 | 7 | 7
bcostm 4:137bb367ba50 122 * 1 | 1 | 12.5 | 12.5
bcostm 4:137bb367ba50 123 *
bcostm 4:137bb367ba50 124 */
bcostm 4:137bb367ba50 125 #define HTS221_CTRL_REG1 (uint8_t)0x20
bcostm 4:137bb367ba50 126
bcostm 4:137bb367ba50 127 #define HTS221_PD_BIT HTS221_BIT(7)
bcostm 4:137bb367ba50 128 #define HTS221_BDU_BIT HTS221_BIT(2)
bcostm 4:137bb367ba50 129 #define HTS221_ODR_BIT HTS221_BIT(0)
bcostm 4:137bb367ba50 130
bcostm 4:137bb367ba50 131 #define HTS221_PD_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 132 #define HTS221_BDU_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 133 #define HTS221_ODR_MASK (uint8_t)0x03
bcostm 4:137bb367ba50 134
bcostm 4:137bb367ba50 135 /**
bcostm 4:137bb367ba50 136 * @brief Control register 2.
bcostm 4:137bb367ba50 137 * Read/write
bcostm 4:137bb367ba50 138 * Default value: 0x00
bcostm 4:137bb367ba50 139 * 7 BOOT: Reboot memory content. 0: normal mode
bcostm 4:137bb367ba50 140 * 1: reboot memory content. Self-cleared upon completation.
bcostm 4:137bb367ba50 141 * 6:2 Reserved.
bcostm 4:137bb367ba50 142 * 1 HEATHER: 0: heater enable; 1: heater disable.
bcostm 4:137bb367ba50 143 * 0 ONE_SHOT: 0: waiting for start of conversion
bcostm 4:137bb367ba50 144 * 1: start for a new dataset. Self-cleared upon completation.
bcostm 4:137bb367ba50 145 */
bcostm 4:137bb367ba50 146 #define HTS221_CTRL_REG2 (uint8_t)0x21
bcostm 4:137bb367ba50 147
bcostm 4:137bb367ba50 148 #define HTS221_BOOT_BIT HTS221_BIT(7)
bcostm 4:137bb367ba50 149 #define HTS221_HEATHER_BIT HTS221_BIT(1)
bcostm 4:137bb367ba50 150 #define HTS221_ONESHOT_BIT HTS221_BIT(0)
bcostm 4:137bb367ba50 151
bcostm 4:137bb367ba50 152 #define HTS221_BOOT_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 153 #define HTS221_HEATHER_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 154 #define HTS221_ONE_SHOT_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 155
bcostm 4:137bb367ba50 156 /**
bcostm 4:137bb367ba50 157 * @brief Control register 3.
bcostm 4:137bb367ba50 158 * Read/write
bcostm 4:137bb367ba50 159 * Default value: 0x00
bcostm 4:137bb367ba50 160 * 7 DRDY_H_L: Interrupt edge. 0: active high, 1: active low.
bcostm 4:137bb367ba50 161 * 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: push-pull
bcostm 4:137bb367ba50 162 * 1: open drain.
bcostm 4:137bb367ba50 163 * 5:3 Reserved.
bcostm 4:137bb367ba50 164 * 2 DRDY: interrupt config. 0: disable, 1: enable.
bcostm 4:137bb367ba50 165 */
bcostm 4:137bb367ba50 166 #define HTS221_CTRL_REG3 (uint8_t)0x22
bcostm 4:137bb367ba50 167
bcostm 4:137bb367ba50 168 #define HTS221_DRDY_H_L_BIT HTS221_BIT(7)
bcostm 4:137bb367ba50 169 #define HTS221_PP_OD_BIT HTS221_BIT(6)
bcostm 4:137bb367ba50 170 #define HTS221_DRDY_BIT HTS221_BIT(2)
bcostm 4:137bb367ba50 171
bcostm 4:137bb367ba50 172 #define HTS221_DRDY_H_L_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 173 #define HTS221_PP_OD_MASK (uint8_t)0x40
bcostm 4:137bb367ba50 174 #define HTS221_DRDY_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 175
bcostm 4:137bb367ba50 176 /**
bcostm 4:137bb367ba50 177 * @brief Status register.
bcostm 4:137bb367ba50 178 * Read
bcostm 4:137bb367ba50 179 * Default value: 0x00
bcostm 4:137bb367ba50 180 * 7:2 Reserved.
bcostm 4:137bb367ba50 181 * 1 H_DA: Humidity data available. 0: new data for humidity is not yet available
bcostm 4:137bb367ba50 182 * 1: new data for humidity is available.
bcostm 4:137bb367ba50 183 * 0 T_DA: Temperature data available. 0: new data for temperature is not yet available
bcostm 4:137bb367ba50 184 * 1: new data for temperature is available.
bcostm 4:137bb367ba50 185 */
bcostm 4:137bb367ba50 186 #define HTS221_STATUS_REG (uint8_t)0x27
bcostm 4:137bb367ba50 187
bcostm 4:137bb367ba50 188 #define HTS221_H_DA_BIT HTS221_BIT(1)
bcostm 4:137bb367ba50 189 #define HTS221_T_DA_BIT HTS221_BIT(0)
bcostm 4:137bb367ba50 190
bcostm 4:137bb367ba50 191 #define HTS221_HDA_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 192 #define HTS221_TDA_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 193
bcostm 4:137bb367ba50 194 /**
bcostm 4:137bb367ba50 195 * @brief Humidity data (LSB).
bcostm 4:137bb367ba50 196 * Read
bcostm 4:137bb367ba50 197 * Default value: 0x00.
bcostm 4:137bb367ba50 198 * HOUT7 - HOUT0: Humidity data LSB (2's complement).
bcostm 4:137bb367ba50 199 */
bcostm 4:137bb367ba50 200 #define HTS221_HR_OUT_L_REG (uint8_t)0x28
bcostm 4:137bb367ba50 201
bcostm 4:137bb367ba50 202 /**
bcostm 4:137bb367ba50 203 * @brief Humidity data (MSB).
bcostm 4:137bb367ba50 204 * Read
bcostm 4:137bb367ba50 205 * Default value: 0x00.
bcostm 4:137bb367ba50 206 * HOUT15 - HOUT8: Humidity data MSB (2's complement).
bcostm 4:137bb367ba50 207 */
bcostm 4:137bb367ba50 208 #define HTS221_HR_OUT_H_REG (uint8_t)0x29
bcostm 4:137bb367ba50 209
bcostm 4:137bb367ba50 210 /**
bcostm 4:137bb367ba50 211 * @brief Temperature data (LSB).
bcostm 4:137bb367ba50 212 * Read
bcostm 4:137bb367ba50 213 * Default value: 0x00.
bcostm 4:137bb367ba50 214 * TOUT7 - TOUT0: temperature data LSB.
bcostm 4:137bb367ba50 215 */
bcostm 4:137bb367ba50 216 #define HTS221_TEMP_OUT_L_REG (uint8_t)0x2A
bcostm 4:137bb367ba50 217
bcostm 4:137bb367ba50 218 /**
bcostm 4:137bb367ba50 219 * @brief Temperature data (MSB).
bcostm 4:137bb367ba50 220 * Read
bcostm 4:137bb367ba50 221 * Default value: 0x00.
bcostm 4:137bb367ba50 222 * TOUT15 - TOUT8: temperature data MSB.
bcostm 4:137bb367ba50 223 */
bcostm 4:137bb367ba50 224 #define HTS221_TEMP_OUT_H_REG (uint8_t)0x2B
bcostm 4:137bb367ba50 225
bcostm 4:137bb367ba50 226 /**
bcostm 4:137bb367ba50 227 * @brief Calibration registers.
bcostm 4:137bb367ba50 228 * Read
bcostm 4:137bb367ba50 229 */
bcostm 4:137bb367ba50 230 #define HTS221_H0_RH_X2 (uint8_t)0x30
bcostm 4:137bb367ba50 231 #define HTS221_H1_RH_X2 (uint8_t)0x31
bcostm 4:137bb367ba50 232 #define HTS221_T0_DEGC_X8 (uint8_t)0x32
bcostm 4:137bb367ba50 233 #define HTS221_T1_DEGC_X8 (uint8_t)0x33
bcostm 4:137bb367ba50 234 #define HTS221_T0_T1_DEGC_H2 (uint8_t)0x35
bcostm 4:137bb367ba50 235 #define HTS221_H0_T0_OUT_L (uint8_t)0x36
bcostm 4:137bb367ba50 236 #define HTS221_H0_T0_OUT_H (uint8_t)0x37
bcostm 4:137bb367ba50 237 #define HTS221_H1_T0_OUT_L (uint8_t)0x3A
bcostm 4:137bb367ba50 238 #define HTS221_H1_T0_OUT_H (uint8_t)0x3B
bcostm 4:137bb367ba50 239 #define HTS221_T0_OUT_L (uint8_t)0x3C
bcostm 4:137bb367ba50 240 #define HTS221_T0_OUT_H (uint8_t)0x3D
bcostm 4:137bb367ba50 241 #define HTS221_T1_OUT_L (uint8_t)0x3E
bcostm 4:137bb367ba50 242 #define HTS221_T1_OUT_H (uint8_t)0x3F
bcostm 4:137bb367ba50 243
bcostm 4:137bb367ba50 244 /**
bcostm 4:137bb367ba50 245 * @}
bcostm 4:137bb367ba50 246 */
bcostm 4:137bb367ba50 247
bcostm 4:137bb367ba50 248
bcostm 4:137bb367ba50 249 /** @defgroup HTS221_Humidity_Exported_Functions HTS221 Humidity Exported Functions
bcostm 4:137bb367ba50 250 * @{
bcostm 4:137bb367ba50 251 */
bcostm 4:137bb367ba50 252 /* HUMIDITY functions */
bcostm 4:137bb367ba50 253 void HTS221_H_Init(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 254 uint8_t HTS221_H_ReadID(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 255 float HTS221_H_ReadHumidity(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 256 /**
bcostm 4:137bb367ba50 257 * @}
bcostm 4:137bb367ba50 258 */
bcostm 4:137bb367ba50 259
bcostm 4:137bb367ba50 260 /** @defgroup HTS221_HumImported_Globals Humidity Imported Globals
bcostm 4:137bb367ba50 261 * @{
bcostm 4:137bb367ba50 262 */
bcostm 4:137bb367ba50 263 /* Humidity driver structure */
bcostm 4:137bb367ba50 264 extern HSENSOR_DrvTypeDef HTS221_H_Drv;
bcostm 4:137bb367ba50 265 /**
bcostm 4:137bb367ba50 266 * @}
bcostm 4:137bb367ba50 267 */
bcostm 4:137bb367ba50 268
bcostm 4:137bb367ba50 269 /** @defgroup HTS221_Temperature_Exported_Functions HTS221 Temperature Exported Functions
bcostm 4:137bb367ba50 270 * @{
bcostm 4:137bb367ba50 271 */
bcostm 4:137bb367ba50 272 /* TEMPERATURE functions */
bcostm 4:137bb367ba50 273 void HTS221_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
bcostm 4:137bb367ba50 274 float HTS221_T_ReadTemp(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 275 /**
bcostm 4:137bb367ba50 276 * @}
bcostm 4:137bb367ba50 277 */
bcostm 4:137bb367ba50 278
bcostm 4:137bb367ba50 279 /** @defgroup HTS221_TempImported_Globals Temperature Imported Globals
bcostm 4:137bb367ba50 280 * @{
bcostm 4:137bb367ba50 281 */
bcostm 4:137bb367ba50 282 /* Temperature driver structure */
bcostm 4:137bb367ba50 283 extern TSENSOR_DrvTypeDef HTS221_T_Drv;
bcostm 4:137bb367ba50 284
bcostm 4:137bb367ba50 285 /**
bcostm 4:137bb367ba50 286 * @}
bcostm 4:137bb367ba50 287 */
bcostm 4:137bb367ba50 288
bcostm 4:137bb367ba50 289 /** @defgroup HTS221_Imported_Functions HTS221 Imported Functions
bcostm 4:137bb367ba50 290 * @{
bcostm 4:137bb367ba50 291 */
bcostm 4:137bb367ba50 292 /* IO functions */
bcostm 4:137bb367ba50 293 extern void SENSOR_IO_Init(void);
bcostm 4:137bb367ba50 294 extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 4:137bb367ba50 295 extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 4:137bb367ba50 296 extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
bcostm 4:137bb367ba50 297 extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
bcostm 4:137bb367ba50 298 /**
bcostm 4:137bb367ba50 299 * @}
bcostm 4:137bb367ba50 300 */
bcostm 4:137bb367ba50 301
bcostm 4:137bb367ba50 302 #ifdef __cplusplus
bcostm 4:137bb367ba50 303 }
bcostm 4:137bb367ba50 304 #endif
bcostm 4:137bb367ba50 305
bcostm 4:137bb367ba50 306 #endif /* __HTS221__H */
bcostm 4:137bb367ba50 307
bcostm 4:137bb367ba50 308 /**
bcostm 4:137bb367ba50 309 * @}
bcostm 4:137bb367ba50 310 */
bcostm 4:137bb367ba50 311
bcostm 4:137bb367ba50 312 /**
bcostm 4:137bb367ba50 313 * @}
bcostm 4:137bb367ba50 314 */
bcostm 4:137bb367ba50 315
bcostm 4:137bb367ba50 316 /**
bcostm 4:137bb367ba50 317 * @}
bcostm 4:137bb367ba50 318 */
bcostm 4:137bb367ba50 319
bcostm 4:137bb367ba50 320 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/