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:
6:9dfa42666f03
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 stm32l475e_iot01.h
bcostm 4:137bb367ba50 4 * @author MCD Application Team
bcostm 4:137bb367ba50 5 * @brief STM32L475E IOT01 board support package
bcostm 4:137bb367ba50 6 ******************************************************************************
bcostm 4:137bb367ba50 7 * @attention
bcostm 4:137bb367ba50 8 *
jeromecoutant 7:bfe8272ced90 9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
bcostm 4:137bb367ba50 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 __STM32L475E_IOT01_H
bcostm 4:137bb367ba50 22 #define __STM32L475E_IOT01_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 "stm32l4xx_hal.h"
bcostm 4:137bb367ba50 30
bcostm 4:137bb367ba50 31 /** @addtogroup BSP
bcostm 4:137bb367ba50 32 * @{
bcostm 4:137bb367ba50 33 */
bcostm 4:137bb367ba50 34
bcostm 4:137bb367ba50 35 /** @addtogroup STM32L475E_IOT01
bcostm 4:137bb367ba50 36 * @{
bcostm 4:137bb367ba50 37 */
bcostm 4:137bb367ba50 38
bcostm 4:137bb367ba50 39 /** @addtogroup STM32L475E_IOT01_LOW_LEVEL
bcostm 4:137bb367ba50 40 * @{
bcostm 4:137bb367ba50 41 */
bcostm 4:137bb367ba50 42
bcostm 4:137bb367ba50 43 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
bcostm 4:137bb367ba50 44 * @{
bcostm 4:137bb367ba50 45 */
bcostm 4:137bb367ba50 46 typedef enum
bcostm 4:137bb367ba50 47 {
bcostm 5:0c70bc6d2dc0 48 DISCO_LED2 = 0,
bcostm 5:0c70bc6d2dc0 49 DISCO_LED_GREEN = DISCO_LED2,
bcostm 4:137bb367ba50 50 }Led_TypeDef;
bcostm 4:137bb367ba50 51
bcostm 4:137bb367ba50 52
bcostm 4:137bb367ba50 53 typedef enum
bcostm 4:137bb367ba50 54 {
bcostm 4:137bb367ba50 55 BUTTON_USER = 0
bcostm 4:137bb367ba50 56 }Button_TypeDef;
bcostm 4:137bb367ba50 57
bcostm 4:137bb367ba50 58 typedef enum
bcostm 4:137bb367ba50 59 {
bcostm 4:137bb367ba50 60 BUTTON_MODE_GPIO = 0,
bcostm 4:137bb367ba50 61 BUTTON_MODE_EXTI = 1
bcostm 4:137bb367ba50 62 }ButtonMode_TypeDef;
bcostm 4:137bb367ba50 63
bcostm 4:137bb367ba50 64 typedef enum
bcostm 4:137bb367ba50 65 {
bcostm 4:137bb367ba50 66 COM1 = 0,
bcostm 4:137bb367ba50 67 COM2 = 0,
bcostm 4:137bb367ba50 68 }COM_TypeDef;
bcostm 4:137bb367ba50 69 /**
bcostm 4:137bb367ba50 70 * @}
bcostm 4:137bb367ba50 71 */
bcostm 4:137bb367ba50 72
bcostm 4:137bb367ba50 73 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
bcostm 4:137bb367ba50 74 * @{
bcostm 4:137bb367ba50 75 */
bcostm 4:137bb367ba50 76
bcostm 4:137bb367ba50 77 /**
bcostm 4:137bb367ba50 78 * @brief Define for STM32L475E_IOT01 board
bcostm 4:137bb367ba50 79 */
bcostm 4:137bb367ba50 80 #if !defined (USE_STM32L475E_IOT01)
bcostm 4:137bb367ba50 81 #define USE_STM32L475E_IOT01
bcostm 4:137bb367ba50 82 #endif
bcostm 4:137bb367ba50 83
bcostm 4:137bb367ba50 84 #define LEDn ((uint8_t)1)
bcostm 4:137bb367ba50 85
bcostm 4:137bb367ba50 86 #define LED2_PIN GPIO_PIN_14
bcostm 4:137bb367ba50 87 #define LED2_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 88 #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 89 #define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 90
bcostm 4:137bb367ba50 91
bcostm 4:137bb367ba50 92
bcostm 4:137bb367ba50 93 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_ENABLE();}while(0)
bcostm 4:137bb367ba50 94
bcostm 4:137bb367ba50 95 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_DISABLE();}while(0)
bcostm 4:137bb367ba50 96
bcostm 4:137bb367ba50 97 /* Only one User/Wakeup button */
bcostm 4:137bb367ba50 98 #define BUTTONn ((uint8_t)1)
bcostm 4:137bb367ba50 99
bcostm 4:137bb367ba50 100 /**
bcostm 4:137bb367ba50 101 * @brief Wakeup push-button
bcostm 4:137bb367ba50 102 */
bcostm 4:137bb367ba50 103 #define USER_BUTTON_PIN GPIO_PIN_13
bcostm 4:137bb367ba50 104 #define USER_BUTTON_GPIO_PORT GPIOC
bcostm 4:137bb367ba50 105 #define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
bcostm 4:137bb367ba50 106 #define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
bcostm 4:137bb367ba50 107 #define USER_BUTTON_EXTI_IRQn EXTI15_10_IRQn
bcostm 4:137bb367ba50 108
bcostm 5:0c70bc6d2dc0 109 /**
bcostm 5:0c70bc6d2dc0 110 * @brief NFC Gpio PINs
bcostm 5:0c70bc6d2dc0 111 */
bcostm 5:0c70bc6d2dc0 112 #define NFC_GPIO_GPO_PIN GPIO_PIN_4
bcostm 5:0c70bc6d2dc0 113 #define NFC_GPIO_GPO_PIN_PORT GPIOE
bcostm 5:0c70bc6d2dc0 114 #define NFC_GPIO_RFDISABLE_PIN GPIO_PIN_2
bcostm 5:0c70bc6d2dc0 115 #define NFC_GPIO_RFDISABLE_PIN_PORT GPIOE
bcostm 5:0c70bc6d2dc0 116 #define NFC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE();
bcostm 5:0c70bc6d2dc0 117 #define NFC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE();
bcostm 4:137bb367ba50 118
bcostm 4:137bb367ba50 119
bcostm 4:137bb367ba50 120 #define COMn ((uint8_t)1)
bcostm 4:137bb367ba50 121
bcostm 4:137bb367ba50 122 /**
bcostm 4:137bb367ba50 123 * @brief Definition for COM port1, connected to USART1
bcostm 4:137bb367ba50 124 */
bcostm 4:137bb367ba50 125 #define DISCOVERY_COM1 USART1
bcostm 4:137bb367ba50 126 #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE()
bcostm 4:137bb367ba50 127 #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE()
bcostm 4:137bb367ba50 128
bcostm 4:137bb367ba50 129 #define DISCOVERY_COM1_TX_PIN GPIO_PIN_6
bcostm 4:137bb367ba50 130 #define DISCOVERY_COM1_TX_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 131 #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 132 #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 133 #define DISCOVERY_COM1_TX_AF GPIO_AF7_USART1
bcostm 4:137bb367ba50 134
bcostm 4:137bb367ba50 135 #define DISCOVERY_COM1_RX_PIN GPIO_PIN_7
bcostm 4:137bb367ba50 136 #define DISCOVERY_COM1_RX_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 137 #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 138 #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 139 #define DISCOVERY_COM1_RX_AF GPIO_AF7_USART1
bcostm 4:137bb367ba50 140
bcostm 4:137bb367ba50 141 #define DISCOVERY_COM1_IRQn USART1_IRQn
bcostm 4:137bb367ba50 142
bcostm 4:137bb367ba50 143
bcostm 4:137bb367ba50 144 #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 145 #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 146
bcostm 4:137bb367ba50 147 #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 148 #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 149
bcostm 4:137bb367ba50 150 #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 151 #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 152
bcostm 4:137bb367ba50 153
bcostm 4:137bb367ba50 154 /* User can use this section to tailor I2Cx instance used and associated resources */
bcostm 4:137bb367ba50 155 /* Definition for I2Cx resources */
bcostm 4:137bb367ba50 156 #define DISCOVERY_I2Cx I2C2
bcostm 4:137bb367ba50 157 #define DISCOVERY_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
bcostm 4:137bb367ba50 158 #define DISCOVERY_I2Cx_CLK_DISABLE() __HAL_RCC_I2C2_CLK_DISABLE()
bcostm 4:137bb367ba50 159 #define DISCOVERY_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
bcostm 4:137bb367ba50 160 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 161 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 162
bcostm 4:137bb367ba50 163 #define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
bcostm 4:137bb367ba50 164 #define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
bcostm 4:137bb367ba50 165
bcostm 4:137bb367ba50 166 /* Definition for I2Cx Pins */
bcostm 4:137bb367ba50 167 #define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_10
bcostm 4:137bb367ba50 168 #define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_11
bcostm 4:137bb367ba50 169 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 170 #define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C2
bcostm 4:137bb367ba50 171
bcostm 4:137bb367ba50 172 /* I2C interrupt requests */
bcostm 4:137bb367ba50 173 #define DISCOVERY_I2Cx_EV_IRQn I2C2_EV_IRQn
bcostm 4:137bb367ba50 174 #define DISCOVERY_I2Cx_ER_IRQn I2C2_ER_IRQn
bcostm 4:137bb367ba50 175
bcostm 4:137bb367ba50 176 /* I2C clock speed configuration (in Hz)
bcostm 4:137bb367ba50 177 WARNING:
bcostm 4:137bb367ba50 178 Make sure that this define is not already declared in other files.
bcostm 4:137bb367ba50 179 It can be used in parallel by other modules. */
bcostm 4:137bb367ba50 180 #ifndef DISCOVERY_I2C_SPEED
bcostm 4:137bb367ba50 181 #define DISCOVERY_I2C_SPEED 100000
bcostm 4:137bb367ba50 182 #endif /* DISCOVERY_I2C_SPEED */
bcostm 4:137bb367ba50 183
bcostm 4:137bb367ba50 184 #ifndef DISCOVERY_I2Cx_TIMING
bcostm 4:137bb367ba50 185 #define DISCOVERY_I2Cx_TIMING ((uint32_t)0x00702681)
bcostm 4:137bb367ba50 186 #endif /* DISCOVERY_I2Cx_TIMING */
bcostm 4:137bb367ba50 187
bcostm 4:137bb367ba50 188
bcostm 4:137bb367ba50 189 /* I2C Sensors address */
bcostm 4:137bb367ba50 190 /* LPS22HB (Pressure) I2C Address */
bcostm 4:137bb367ba50 191 #define LPS22HB_I2C_ADDRESS (uint8_t)0xBA
bcostm 4:137bb367ba50 192 /* HTS221 (Humidity) I2C Address */
bcostm 4:137bb367ba50 193 #define HTS221_I2C_ADDRESS (uint8_t)0xBE
bcostm 4:137bb367ba50 194
bcostm 4:137bb367ba50 195 #ifdef USE_LPS22HB_TEMP
bcostm 4:137bb367ba50 196 /* LPS22HB Sensor hardware I2C address */
bcostm 4:137bb367ba50 197 #define TSENSOR_I2C_ADDRESS LPS22HB_I2C_ADDRESS
bcostm 4:137bb367ba50 198 #else /* USE_HTS221_TEMP */
bcostm 4:137bb367ba50 199 /* HTS221 Sensor hardware I2C address */
bcostm 4:137bb367ba50 200 #define TSENSOR_I2C_ADDRESS HTS221_I2C_ADDRESS
bcostm 4:137bb367ba50 201 #endif
bcostm 5:0c70bc6d2dc0 202
bcostm 5:0c70bc6d2dc0 203 /* NFC I2C address and specific config parameters */
bcostm 5:0c70bc6d2dc0 204 #define M24SR_I2C_ADDR (uint8_t) 0xAC /*!< M24SR address */
bcostm 5:0c70bc6d2dc0 205 #define NFC_I2C_STATUS_SUCCESS (uint16_t) 0x0000
bcostm 5:0c70bc6d2dc0 206 #define NFC_I2C_ERROR_TIMEOUT (uint16_t) 0x0011
bcostm 5:0c70bc6d2dc0 207 #define NFC_I2C_TIMEOUT_STD (uint32_t) 8 /* I2C Time out (ms), used to call Transmit/Receive HAL functions */
bcostm 5:0c70bc6d2dc0 208 #define NFC_I2C_TIMEOUT_MAX (uint32_t) 200 /* I2C Time out (ms), this is the maximum time needed by M24SR to complete any command */
bcostm 5:0c70bc6d2dc0 209 #define NFC_I2C_TRIALS (uint32_t) 1 /* In case M24SR will reply ACK failed allow to perform retry before returning error (HAL option not used) */
bcostm 5:0c70bc6d2dc0 210
bcostm 5:0c70bc6d2dc0 211
bcostm 4:137bb367ba50 212 /**
bcostm 4:137bb367ba50 213 * @}
bcostm 4:137bb367ba50 214 */
bcostm 4:137bb367ba50 215
bcostm 4:137bb367ba50 216 /* Exported types ------------------------------------------------------------*/
bcostm 4:137bb367ba50 217 /* Exported constants --------------------------------------------------------*/
bcostm 4:137bb367ba50 218 /* Exported macros -----------------------------------------------------------*/
bcostm 4:137bb367ba50 219 /* Private macros ------------------------------------------------------------*/
bcostm 4:137bb367ba50 220 /* Exported functions --------------------------------------------------------*/
bcostm 4:137bb367ba50 221
bcostm 4:137bb367ba50 222 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
bcostm 4:137bb367ba50 223 * @{
bcostm 4:137bb367ba50 224 */
bcostm 4:137bb367ba50 225 uint32_t BSP_GetVersion(void);
bcostm 4:137bb367ba50 226 void BSP_LED_Init(Led_TypeDef Led);
bcostm 4:137bb367ba50 227 void BSP_LED_DeInit(Led_TypeDef Led);
bcostm 4:137bb367ba50 228 void BSP_LED_On(Led_TypeDef Led);
bcostm 4:137bb367ba50 229 void BSP_LED_Off(Led_TypeDef Led);
bcostm 4:137bb367ba50 230 void BSP_LED_Toggle(Led_TypeDef Led);
bcostm 4:137bb367ba50 231 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
bcostm 4:137bb367ba50 232 void BSP_PB_DeInit(Button_TypeDef Button);
bcostm 4:137bb367ba50 233 uint32_t BSP_PB_GetState(Button_TypeDef Button);
bcostm 4:137bb367ba50 234 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
bcostm 4:137bb367ba50 235 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
bcostm 4:137bb367ba50 236 /**
bcostm 4:137bb367ba50 237 * @}
bcostm 4:137bb367ba50 238 */
bcostm 4:137bb367ba50 239
bcostm 4:137bb367ba50 240 /**
bcostm 4:137bb367ba50 241 * @}
bcostm 4:137bb367ba50 242 */
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 * @}
bcostm 4:137bb367ba50 250 */
bcostm 4:137bb367ba50 251 #ifdef __cplusplus
bcostm 4:137bb367ba50 252 }
bcostm 4:137bb367ba50 253 #endif
bcostm 4:137bb367ba50 254
bcostm 4:137bb367ba50 255 #endif /* __STM32L475E_IOT01_H */
bcostm 4:137bb367ba50 256
bcostm 4:137bb367ba50 257 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/