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:
bcostm
Date:
Fri Apr 14 13:09:54 2017 +0200
Revision:
4:137bb367ba50
Child:
5:0c70bc6d2dc0
Add remaining Components files

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 * @version V1.0.0
bcostm 4:137bb367ba50 6 * @date 17-March-2017
bcostm 4:137bb367ba50 7 * @brief STM32L475E IOT01 board support package
bcostm 4:137bb367ba50 8 ******************************************************************************
bcostm 4:137bb367ba50 9 * @attention
bcostm 4:137bb367ba50 10 *
bcostm 4:137bb367ba50 11 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
bcostm 4:137bb367ba50 12 * All rights reserved.</center></h2>
bcostm 4:137bb367ba50 13 *
bcostm 4:137bb367ba50 14 * Redistribution and use in source and binary forms, with or without
bcostm 4:137bb367ba50 15 * modification, are permitted, provided that the following conditions are met:
bcostm 4:137bb367ba50 16 *
bcostm 4:137bb367ba50 17 * 1. Redistribution of source code must retain the above copyright notice,
bcostm 4:137bb367ba50 18 * this list of conditions and the following disclaimer.
bcostm 4:137bb367ba50 19 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 4:137bb367ba50 20 * this list of conditions and the following disclaimer in the documentation
bcostm 4:137bb367ba50 21 * and/or other materials provided with the distribution.
bcostm 4:137bb367ba50 22 * 3. Neither the name of STMicroelectronics nor the names of other
bcostm 4:137bb367ba50 23 * contributors to this software may be used to endorse or promote products
bcostm 4:137bb367ba50 24 * derived from this software without specific written permission.
bcostm 4:137bb367ba50 25 * 4. This software, including modifications and/or derivative works of this
bcostm 4:137bb367ba50 26 * software, must execute solely and exclusively on microcontroller or
bcostm 4:137bb367ba50 27 * microprocessor devices manufactured by or for STMicroelectronics.
bcostm 4:137bb367ba50 28 * 5. Redistribution and use of this software other than as permitted under
bcostm 4:137bb367ba50 29 * this license is void and will automatically terminate your rights under
bcostm 4:137bb367ba50 30 * this license.
bcostm 4:137bb367ba50 31 *
bcostm 4:137bb367ba50 32 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
bcostm 4:137bb367ba50 33 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
bcostm 4:137bb367ba50 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
bcostm 4:137bb367ba50 35 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
bcostm 4:137bb367ba50 36 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
bcostm 4:137bb367ba50 37 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
bcostm 4:137bb367ba50 38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
bcostm 4:137bb367ba50 39 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
bcostm 4:137bb367ba50 40 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
bcostm 4:137bb367ba50 41 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
bcostm 4:137bb367ba50 42 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
bcostm 4:137bb367ba50 43 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 4:137bb367ba50 44 *
bcostm 4:137bb367ba50 45 ******************************************************************************
bcostm 4:137bb367ba50 46 */
bcostm 4:137bb367ba50 47
bcostm 4:137bb367ba50 48 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 4:137bb367ba50 49 #ifndef __STM32L475E_IOT01_H
bcostm 4:137bb367ba50 50 #define __STM32L475E_IOT01_H
bcostm 4:137bb367ba50 51
bcostm 4:137bb367ba50 52 #ifdef __cplusplus
bcostm 4:137bb367ba50 53 extern "C" {
bcostm 4:137bb367ba50 54 #endif
bcostm 4:137bb367ba50 55
bcostm 4:137bb367ba50 56 /* Includes ------------------------------------------------------------------*/
bcostm 4:137bb367ba50 57 #include "stm32l4xx_hal.h"
bcostm 4:137bb367ba50 58
bcostm 4:137bb367ba50 59 /** @addtogroup BSP
bcostm 4:137bb367ba50 60 * @{
bcostm 4:137bb367ba50 61 */
bcostm 4:137bb367ba50 62
bcostm 4:137bb367ba50 63 /** @addtogroup STM32L475E_IOT01
bcostm 4:137bb367ba50 64 * @{
bcostm 4:137bb367ba50 65 */
bcostm 4:137bb367ba50 66
bcostm 4:137bb367ba50 67 /** @addtogroup STM32L475E_IOT01_LOW_LEVEL
bcostm 4:137bb367ba50 68 * @{
bcostm 4:137bb367ba50 69 */
bcostm 4:137bb367ba50 70
bcostm 4:137bb367ba50 71 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
bcostm 4:137bb367ba50 72 * @{
bcostm 4:137bb367ba50 73 */
bcostm 4:137bb367ba50 74 typedef enum
bcostm 4:137bb367ba50 75 {
bcostm 4:137bb367ba50 76 DISCO_LED2 = 0,
bcostm 4:137bb367ba50 77 DISCO_LED_GREEN = DISCO_LED2,
bcostm 4:137bb367ba50 78 }Led_TypeDef;
bcostm 4:137bb367ba50 79
bcostm 4:137bb367ba50 80
bcostm 4:137bb367ba50 81 typedef enum
bcostm 4:137bb367ba50 82 {
bcostm 4:137bb367ba50 83 BUTTON_USER = 0
bcostm 4:137bb367ba50 84 }Button_TypeDef;
bcostm 4:137bb367ba50 85
bcostm 4:137bb367ba50 86 typedef enum
bcostm 4:137bb367ba50 87 {
bcostm 4:137bb367ba50 88 BUTTON_MODE_GPIO = 0,
bcostm 4:137bb367ba50 89 BUTTON_MODE_EXTI = 1
bcostm 4:137bb367ba50 90 }ButtonMode_TypeDef;
bcostm 4:137bb367ba50 91
bcostm 4:137bb367ba50 92 typedef enum
bcostm 4:137bb367ba50 93 {
bcostm 4:137bb367ba50 94 COM1 = 0,
bcostm 4:137bb367ba50 95 COM2 = 0,
bcostm 4:137bb367ba50 96 }COM_TypeDef;
bcostm 4:137bb367ba50 97 /**
bcostm 4:137bb367ba50 98 * @}
bcostm 4:137bb367ba50 99 */
bcostm 4:137bb367ba50 100
bcostm 4:137bb367ba50 101 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
bcostm 4:137bb367ba50 102 * @{
bcostm 4:137bb367ba50 103 */
bcostm 4:137bb367ba50 104
bcostm 4:137bb367ba50 105 /**
bcostm 4:137bb367ba50 106 * @brief Define for STM32L475E_IOT01 board
bcostm 4:137bb367ba50 107 */
bcostm 4:137bb367ba50 108 #if !defined (USE_STM32L475E_IOT01)
bcostm 4:137bb367ba50 109 #define USE_STM32L475E_IOT01
bcostm 4:137bb367ba50 110 #endif
bcostm 4:137bb367ba50 111
bcostm 4:137bb367ba50 112 #define LEDn ((uint8_t)1)
bcostm 4:137bb367ba50 113
bcostm 4:137bb367ba50 114 #define LED2_PIN GPIO_PIN_14
bcostm 4:137bb367ba50 115 #define LED2_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 116 #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 117 #define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 118
bcostm 4:137bb367ba50 119
bcostm 4:137bb367ba50 120
bcostm 4:137bb367ba50 121 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_ENABLE();}while(0)
bcostm 4:137bb367ba50 122
bcostm 4:137bb367ba50 123 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED2_GPIO_CLK_DISABLE();}while(0)
bcostm 4:137bb367ba50 124
bcostm 4:137bb367ba50 125 /* Only one User/Wakeup button */
bcostm 4:137bb367ba50 126 #define BUTTONn ((uint8_t)1)
bcostm 4:137bb367ba50 127
bcostm 4:137bb367ba50 128 /**
bcostm 4:137bb367ba50 129 * @brief Wakeup push-button
bcostm 4:137bb367ba50 130 */
bcostm 4:137bb367ba50 131 #define USER_BUTTON_PIN GPIO_PIN_13
bcostm 4:137bb367ba50 132 #define USER_BUTTON_GPIO_PORT GPIOC
bcostm 4:137bb367ba50 133 #define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
bcostm 4:137bb367ba50 134 #define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
bcostm 4:137bb367ba50 135 #define USER_BUTTON_EXTI_IRQn EXTI15_10_IRQn
bcostm 4:137bb367ba50 136
bcostm 4:137bb367ba50 137
bcostm 4:137bb367ba50 138
bcostm 4:137bb367ba50 139 #define COMn ((uint8_t)1)
bcostm 4:137bb367ba50 140
bcostm 4:137bb367ba50 141 /**
bcostm 4:137bb367ba50 142 * @brief Definition for COM port1, connected to USART1
bcostm 4:137bb367ba50 143 */
bcostm 4:137bb367ba50 144 #define DISCOVERY_COM1 USART1
bcostm 4:137bb367ba50 145 #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE()
bcostm 4:137bb367ba50 146 #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE()
bcostm 4:137bb367ba50 147
bcostm 4:137bb367ba50 148 #define DISCOVERY_COM1_TX_PIN GPIO_PIN_6
bcostm 4:137bb367ba50 149 #define DISCOVERY_COM1_TX_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 150 #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 151 #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 152 #define DISCOVERY_COM1_TX_AF GPIO_AF7_USART1
bcostm 4:137bb367ba50 153
bcostm 4:137bb367ba50 154 #define DISCOVERY_COM1_RX_PIN GPIO_PIN_7
bcostm 4:137bb367ba50 155 #define DISCOVERY_COM1_RX_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 156 #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 157 #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 158 #define DISCOVERY_COM1_RX_AF GPIO_AF7_USART1
bcostm 4:137bb367ba50 159
bcostm 4:137bb367ba50 160 #define DISCOVERY_COM1_IRQn USART1_IRQn
bcostm 4:137bb367ba50 161
bcostm 4:137bb367ba50 162
bcostm 4:137bb367ba50 163 #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 164 #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 165
bcostm 4:137bb367ba50 166 #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 167 #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 168
bcostm 4:137bb367ba50 169 #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();}} while(0)
bcostm 4:137bb367ba50 170 #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_DISABLE();}} while(0)
bcostm 4:137bb367ba50 171
bcostm 4:137bb367ba50 172
bcostm 4:137bb367ba50 173 /* User can use this section to tailor I2Cx instance used and associated resources */
bcostm 4:137bb367ba50 174 /* Definition for I2Cx resources */
bcostm 4:137bb367ba50 175 #define DISCOVERY_I2Cx I2C2
bcostm 4:137bb367ba50 176 #define DISCOVERY_I2Cx_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE()
bcostm 4:137bb367ba50 177 #define DISCOVERY_I2Cx_CLK_DISABLE() __HAL_RCC_I2C2_CLK_DISABLE()
bcostm 4:137bb367ba50 178 #define DISCOVERY_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
bcostm 4:137bb367ba50 179 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 4:137bb367ba50 180 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
bcostm 4:137bb367ba50 181
bcostm 4:137bb367ba50 182 #define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET()
bcostm 4:137bb367ba50 183 #define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET()
bcostm 4:137bb367ba50 184
bcostm 4:137bb367ba50 185 /* Definition for I2Cx Pins */
bcostm 4:137bb367ba50 186 #define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_10
bcostm 4:137bb367ba50 187 #define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_11
bcostm 4:137bb367ba50 188 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT GPIOB
bcostm 4:137bb367ba50 189 #define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C2
bcostm 4:137bb367ba50 190
bcostm 4:137bb367ba50 191 /* I2C interrupt requests */
bcostm 4:137bb367ba50 192 #define DISCOVERY_I2Cx_EV_IRQn I2C2_EV_IRQn
bcostm 4:137bb367ba50 193 #define DISCOVERY_I2Cx_ER_IRQn I2C2_ER_IRQn
bcostm 4:137bb367ba50 194
bcostm 4:137bb367ba50 195 /* I2C clock speed configuration (in Hz)
bcostm 4:137bb367ba50 196 WARNING:
bcostm 4:137bb367ba50 197 Make sure that this define is not already declared in other files.
bcostm 4:137bb367ba50 198 It can be used in parallel by other modules. */
bcostm 4:137bb367ba50 199 #ifndef DISCOVERY_I2C_SPEED
bcostm 4:137bb367ba50 200 #define DISCOVERY_I2C_SPEED 100000
bcostm 4:137bb367ba50 201 #endif /* DISCOVERY_I2C_SPEED */
bcostm 4:137bb367ba50 202
bcostm 4:137bb367ba50 203 #ifndef DISCOVERY_I2Cx_TIMING
bcostm 4:137bb367ba50 204 #define DISCOVERY_I2Cx_TIMING ((uint32_t)0x00702681)
bcostm 4:137bb367ba50 205 #endif /* DISCOVERY_I2Cx_TIMING */
bcostm 4:137bb367ba50 206
bcostm 4:137bb367ba50 207
bcostm 4:137bb367ba50 208 /* I2C Sensors address */
bcostm 4:137bb367ba50 209 /* LPS22HB (Pressure) I2C Address */
bcostm 4:137bb367ba50 210 #define LPS22HB_I2C_ADDRESS (uint8_t)0xBA
bcostm 4:137bb367ba50 211 /* HTS221 (Humidity) I2C Address */
bcostm 4:137bb367ba50 212 #define HTS221_I2C_ADDRESS (uint8_t)0xBE
bcostm 4:137bb367ba50 213
bcostm 4:137bb367ba50 214 #ifdef USE_LPS22HB_TEMP
bcostm 4:137bb367ba50 215 /* LPS22HB Sensor hardware I2C address */
bcostm 4:137bb367ba50 216 #define TSENSOR_I2C_ADDRESS LPS22HB_I2C_ADDRESS
bcostm 4:137bb367ba50 217 #else /* USE_HTS221_TEMP */
bcostm 4:137bb367ba50 218 /* HTS221 Sensor hardware I2C address */
bcostm 4:137bb367ba50 219 #define TSENSOR_I2C_ADDRESS HTS221_I2C_ADDRESS
bcostm 4:137bb367ba50 220 #endif
bcostm 4:137bb367ba50 221 /**
bcostm 4:137bb367ba50 222 * @}
bcostm 4:137bb367ba50 223 */
bcostm 4:137bb367ba50 224
bcostm 4:137bb367ba50 225 /* Exported types ------------------------------------------------------------*/
bcostm 4:137bb367ba50 226 /* Exported constants --------------------------------------------------------*/
bcostm 4:137bb367ba50 227 /* Exported macros -----------------------------------------------------------*/
bcostm 4:137bb367ba50 228 /* Private macros ------------------------------------------------------------*/
bcostm 4:137bb367ba50 229 /* Exported functions --------------------------------------------------------*/
bcostm 4:137bb367ba50 230
bcostm 4:137bb367ba50 231 /** @defgroup STM32L475E_IOT01_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
bcostm 4:137bb367ba50 232 * @{
bcostm 4:137bb367ba50 233 */
bcostm 4:137bb367ba50 234 uint32_t BSP_GetVersion(void);
bcostm 4:137bb367ba50 235 void BSP_LED_Init(Led_TypeDef Led);
bcostm 4:137bb367ba50 236 void BSP_LED_DeInit(Led_TypeDef Led);
bcostm 4:137bb367ba50 237 void BSP_LED_On(Led_TypeDef Led);
bcostm 4:137bb367ba50 238 void BSP_LED_Off(Led_TypeDef Led);
bcostm 4:137bb367ba50 239 void BSP_LED_Toggle(Led_TypeDef Led);
bcostm 4:137bb367ba50 240 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
bcostm 4:137bb367ba50 241 void BSP_PB_DeInit(Button_TypeDef Button);
bcostm 4:137bb367ba50 242 uint32_t BSP_PB_GetState(Button_TypeDef Button);
bcostm 4:137bb367ba50 243 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
bcostm 4:137bb367ba50 244 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
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 */
bcostm 4:137bb367ba50 252
bcostm 4:137bb367ba50 253 /**
bcostm 4:137bb367ba50 254 * @}
bcostm 4:137bb367ba50 255 */
bcostm 4:137bb367ba50 256
bcostm 4:137bb367ba50 257 /**
bcostm 4:137bb367ba50 258 * @}
bcostm 4:137bb367ba50 259 */
bcostm 4:137bb367ba50 260 #ifdef __cplusplus
bcostm 4:137bb367ba50 261 }
bcostm 4:137bb367ba50 262 #endif
bcostm 4:137bb367ba50 263
bcostm 4:137bb367ba50 264 #endif /* __STM32L475E_IOT01_H */
bcostm 4:137bb367ba50 265
bcostm 4:137bb367ba50 266 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/