STM32L476G-Discovery BSP User Manual
|
stm32l476g_discovery.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l476g_discovery.h 00004 * @author MCD Application Team 00005 * @version $VERSION$ 00006 * @date $DATE$ 00007 * @brief This file contains definitions for STM32L476G_DISCOVERY's LEDs, 00008 * push-buttons hardware resources (MB1184). 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 #ifndef __STM32L476G_DISCOVERY_H 00041 #define __STM32L476G_DISCOVERY_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /** 00048 * @brief Define for STM32L476G_DISCOVERY board 00049 */ 00050 #if !defined (USE_STM32L476G_DISCO_REVC) && !defined (USE_STM32L476G_DISCO_REVB) && !defined (USE_STM32L476G_DISCO_REVA) 00051 #define USE_STM32L476G_DISCO_REVC 00052 #endif 00053 00054 00055 /* Includes ------------------------------------------------------------------*/ 00056 #include "stm32l4xx_hal.h" 00057 00058 /** @addtogroup BSP 00059 * @{ 00060 */ 00061 00062 /** @addtogroup STM32L476G_DISCOVERY 00063 * @{ 00064 */ 00065 00066 /** @addtogroup STM32L476G_DISCOVERY_Common 00067 * @{ 00068 */ 00069 00070 /** @defgroup STM32L476G_DISCOVERY_Exported_Types Exported Types 00071 * @{ 00072 */ 00073 00074 /** 00075 * @brief LED Types Definition 00076 */ 00077 #if defined (USE_STM32L476G_DISCO_REVC) || defined (USE_STM32L476G_DISCO_REVB) 00078 typedef enum 00079 { 00080 LED4 = 0, 00081 LED5 = 1, 00082 LED_RED = LED4, 00083 LED_GREEN = LED5 00084 }Led_TypeDef; 00085 #elif defined (USE_STM32L476G_DISCO_REVA) 00086 typedef enum 00087 { 00088 LED3 = 0, 00089 LED4 = 1, 00090 LED_RED = LED3, 00091 LED_GREEN = LED4 00092 }Led_TypeDef; 00093 #endif 00094 00095 /** 00096 * @brief JOYSTICK Types Definition 00097 */ 00098 typedef enum 00099 { 00100 JOY_SEL = 0, 00101 JOY_LEFT = 1, 00102 JOY_RIGHT = 2, 00103 JOY_DOWN = 3, 00104 JOY_UP = 4, 00105 JOY_NONE = 5 00106 }JOYState_TypeDef; 00107 00108 typedef enum 00109 { 00110 JOY_MODE_GPIO = 0, 00111 JOY_MODE_EXTI = 1 00112 }JOYMode_TypeDef; 00113 00114 typedef enum 00115 { 00116 SUPPLY_MODE_ERROR = 0, 00117 SUPPLY_MODE_EXTERNAL = 1, 00118 SUPPLY_MODE_BATTERY = 2 00119 }SupplyMode_TypeDef; 00120 00121 /** 00122 * @} 00123 */ 00124 00125 /** @defgroup STM32L476G_DISCOVERY_Exported_Constants Exported Constants 00126 * @{ 00127 */ 00128 00129 /** @defgroup STM32L476G_DISCOVERY_BATTERY BATTERY Detection Constants 00130 * @{ 00131 */ 00132 #define BATTERY_DETECTION_PIN GPIO_PIN_3 00133 #define BATTERY_DETECTION_GPIO_PORT GPIOB 00134 #define BATTERY_DETECTION_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00135 #define BATTERY_DETECTION_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00136 /** 00137 * @} 00138 */ 00139 00140 /** @defgroup STM32L476G_DISCOVERY_LED LED Constants 00141 * @{ 00142 */ 00143 #define LEDn 2 00144 00145 #if defined (USE_STM32L476G_DISCO_REVC) || defined (USE_STM32L476G_DISCO_REVB) 00146 #define LED4_PIN GPIO_PIN_2 00147 #define LED4_GPIO_PORT GPIOB 00148 #define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00149 #define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00150 00151 #define LED5_PIN GPIO_PIN_8 00152 #define LED5_GPIO_PORT GPIOE 00153 #define LED5_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00154 #define LED5_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00155 00156 #define LEDx_GPIO_CLK_ENABLE(__LED__) do { if((__LED__) == LED4) { LED4_GPIO_CLK_ENABLE(); } else \ 00157 if((__LED__) == LED5) { LED5_GPIO_CLK_ENABLE(); } } while(0) 00158 00159 #define LEDx_GPIO_CLK_DISABLE(__LED__) do { if((__LED__) == LED4) { LED4_GPIO_CLK_DISABLE(); } else \ 00160 if((__LED__) == LED5) { LED5_GPIO_CLK_DISABLE(); } } while(0) 00161 00162 #elif defined (USE_STM32L476G_DISCO_REVA) 00163 #define LED3_PIN GPIO_PIN_2 00164 #define LED3_GPIO_PORT GPIOB 00165 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00166 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00167 00168 #define LED4_PIN GPIO_PIN_8 00169 #define LED4_GPIO_PORT GPIOE 00170 #define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00171 #define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00172 00173 #define LEDx_GPIO_CLK_ENABLE(__LED__) do { if((__LED__) == LED3) { LED3_GPIO_CLK_ENABLE(); } else \ 00174 if((__LED__) == LED4) { LED4_GPIO_CLK_ENABLE(); } } while(0) 00175 00176 #define LEDx_GPIO_CLK_DISABLE(__LED__) do { if((__LED__) == LED3) { LED3_GPIO_CLK_DISABLE(); } else \ 00177 if((__LED__) == LED4) { LED4_GPIO_CLK_DISABLE(); } } while(0) 00178 00179 #endif 00180 /** 00181 * @} 00182 */ 00183 00184 /** @defgroup STM32L476G_DISCOVERY_BUTTON BUTTON Constants 00185 * @{ 00186 */ 00187 #define JOYn 5 00188 00189 /** 00190 * @brief Joystick Right push-button 00191 */ 00192 #define RIGHT_JOY_PIN GPIO_PIN_2 /* PA.02 */ 00193 #define RIGHT_JOY_GPIO_PORT GPIOA 00194 #define RIGHT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00195 #define RIGHT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00196 #define RIGHT_JOY_EXTI_IRQn EXTI2_IRQn 00197 00198 /** 00199 * @brief Joystick Left push-button 00200 */ 00201 #define LEFT_JOY_PIN GPIO_PIN_1 /* PA.01 */ 00202 #define LEFT_JOY_GPIO_PORT GPIOA 00203 #define LEFT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00204 #define LEFT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00205 #define LEFT_JOY_EXTI_IRQn EXTI1_IRQn 00206 00207 /** 00208 * @brief Joystick Up push-button 00209 */ 00210 #define UP_JOY_PIN GPIO_PIN_3 /* PA.03 */ 00211 #define UP_JOY_GPIO_PORT GPIOA 00212 #define UP_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00213 #define UP_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00214 #define UP_JOY_EXTI_IRQn EXTI3_IRQn 00215 00216 /** 00217 * @brief Joystick Down push-button 00218 */ 00219 #define DOWN_JOY_PIN GPIO_PIN_5 /* PA.05 */ 00220 #define DOWN_JOY_GPIO_PORT GPIOA 00221 #define DOWN_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00222 #define DOWN_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00223 #define DOWN_JOY_EXTI_IRQn EXTI9_5_IRQn 00224 00225 /** 00226 * @brief Joystick Sel push-button 00227 */ 00228 #define SEL_JOY_PIN GPIO_PIN_0 /* PA.00 */ 00229 #define SEL_JOY_GPIO_PORT GPIOA 00230 #define SEL_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00231 #define SEL_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00232 #define SEL_JOY_EXTI_IRQn EXTI0_IRQn 00233 00234 #define JOYx_GPIO_CLK_ENABLE(__JOY__) do { if((__JOY__) == JOY_SEL) { SEL_JOY_GPIO_CLK_ENABLE(); } else \ 00235 if((__JOY__) == JOY_DOWN) { DOWN_JOY_GPIO_CLK_ENABLE(); } else \ 00236 if((__JOY__) == JOY_LEFT) { LEFT_JOY_GPIO_CLK_ENABLE(); } else \ 00237 if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_ENABLE(); } else \ 00238 if((__JOY__) == JOY_UP) { UP_JOY_GPIO_CLK_ENABLE(); } } while(0) 00239 00240 #define JOYx_GPIO_CLK_DISABLE(__JOY__) do { if((__JOY__) == JOY_SEL) { SEL_JOY_GPIO_CLK_DISABLE(); } else \ 00241 if((__JOY__) == JOY_DOWN) { DOWN_JOY_GPIO_CLK_DISABLE(); } else \ 00242 if((__JOY__) == JOY_LEFT) { LEFT_JOY_GPIO_CLK_DISABLE(); } else \ 00243 if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_DISABLE(); } else \ 00244 if((__JOY__) == JOY_UP) { UP_JOY_GPIO_CLK_DISABLE(); } } while(0) 00245 00246 #define JOY_ALL_PINS (RIGHT_JOY_PIN | LEFT_JOY_PIN | UP_JOY_PIN | DOWN_JOY_PIN | SEL_JOY_PIN) 00247 00248 /** 00249 * @} 00250 */ 00251 00252 /** @defgroup STM32L476G_DISCOVERY_BUS BUS Constants 00253 * @{ 00254 */ 00255 #if defined(HAL_SPI_MODULE_ENABLED) 00256 /*##################### SPI2 ###################################*/ 00257 #define DISCOVERY_SPIx SPI2 00258 #define DISCOVERY_SPIx_CLOCK_ENABLE() __HAL_RCC_SPI2_CLK_ENABLE() 00259 #define DISCOVERY_SPIx_CLOCK_DISABLE() __HAL_RCC_SPI2_CLK_DISABLE() 00260 #define DISCOVERY_SPIx_GPIO_PORT GPIOD /* GPIOD */ 00261 #define DISCOVERY_SPIx_AF GPIO_AF5_SPI2 00262 #define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00263 #define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() 00264 #define DISCOVERY_SPIx_GPIO_FORCE_RESET() __HAL_RCC_SPI2_FORCE_RESET() 00265 #define DISCOVERY_SPIx_GPIO_RELEASE_RESET() __HAL_RCC_SPI2_RELEASE_RESET() 00266 #define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_1 /* PD.01*/ 00267 #define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_3 /* PD.03 */ 00268 #define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_4 /* PD.04 */ 00269 00270 /* Maximum Timeout values for flags waiting loops. These timeouts are not based 00271 on accurate values, they just guarantee that the application will not remain 00272 stuck if the SPI communication is corrupted. 00273 You may modify these timeout values depending on CPU frequency and application 00274 conditions (interrupts routines ...). */ 00275 #define SPIx_TIMEOUT_MAX ((uint32_t)0x1000) 00276 /* Read/Write command */ 00277 #define READWRITE_CMD ((uint8_t)0x80) 00278 /* Multiple byte read/write command */ 00279 #define MULTIPLEBYTE_CMD ((uint8_t)0x40) 00280 /* Dummy Byte Send by the SPI Master device in order to generate the Clock to the Slave device */ 00281 #define DUMMY_BYTE ((uint8_t)0x00) 00282 00283 #endif /* HAL_SPI_MODULE_ENABLED */ 00284 00285 #if defined(HAL_I2C_MODULE_ENABLED) 00286 /*##################### I2C1 ###################################*/ 00287 /* User can use this section to tailor I2C1 instance used and associated 00288 resources */ 00289 /* Definition for I2C1 Pins */ 00290 #define DISCOVERY_I2C1_SCL_GPIO_PORT GPIOB 00291 #define DISCOVERY_I2C1_SDA_GPIO_PORT GPIOB 00292 #if defined (USE_STM32L476G_DISCO_REVC) || defined (USE_STM32L476G_DISCO_REVB) 00293 #define DISCOVERY_I2C1_SCL_PIN GPIO_PIN_6 00294 #define DISCOVERY_I2C1_SDA_PIN GPIO_PIN_7 00295 #elif defined (USE_STM32L476G_DISCO_REVA) 00296 #define DISCOVERY_I2C1_SCL_PIN GPIO_PIN_8 00297 #define DISCOVERY_I2C1_SDA_PIN GPIO_PIN_9 00298 #endif 00299 #define DISCOVERY_I2C1_SCL_SDA_AF GPIO_AF4_I2C1 00300 00301 /* Definition for I2C1 clock resources */ 00302 #define DISCOVERY_I2C1 I2C1 00303 #define DISCOVERY_I2C1_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE() 00304 #define DISCOVERY_I2C1_CLK_DISABLE() __HAL_RCC_I2C1_CLK_DISABLE() 00305 #define DISCOVERY_I2C1_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00306 #define DISCOVERY_I2C1_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00307 #define DISCOVERY_I2C1_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00308 #define DISCOVERY_I2C1_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00309 #define DISCOVERY_I2C1_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET() 00310 #define DISCOVERY_I2C1_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET() 00311 00312 /* Definition for I2C1's NVIC */ 00313 #define DISCOVERY_I2C1_EV_IRQn I2C1_EV_IRQn 00314 #define DISCOVERY_I2C1_EV_IRQHandler I2C1_EV_IRQHandler 00315 #define DISCOVERY_I2C1_ER_IRQn I2C1_ER_IRQn 00316 #define DISCOVERY_I2C1_ER_IRQHandler I2C1_ER_IRQHandler 00317 00318 /* I2C TIMING Register define when I2C clock source is SYSCLK */ 00319 /* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 80 MHz */ 00320 /* Set 0x90112626 value to reach 100 KHz speed (Rise time = 640ns, Fall time = 20ns) */ 00321 #ifndef DISCOVERY_I2C1_TIMING 00322 #define DISCOVERY_I2C1_TIMING 0x90112626 00323 #endif /* DISCOVERY_I2C1_TIMING */ 00324 00325 /* I2C clock speed configuration (in Hz) 00326 WARNING: 00327 Make sure that this define is not already declared in other files (ie. 00328 stm324xg_discovery.h file). It can be used in parallel by other modules. */ 00329 #ifndef BSP_I2C_SPEED 00330 #define BSP_I2C_SPEED 100000 00331 #endif /* BSP_I2C_SPEED */ 00332 00333 00334 /* Audio codec I2C address */ 00335 #define AUDIO_I2C_ADDRESS ((uint16_t) 0x94) 00336 00337 /* Maximum Timeout values for flags waiting loops. These timeouts are not based 00338 on accurate values, they just guarantee that the application will not remain 00339 stuck if the I2C communication is corrupted. 00340 You may modify these timeout values depending on CPU frequency and application 00341 conditions (interrupts routines ...). */ 00342 #define DISCOVERY_I2C1_TIMEOUT_MAX 3000 00343 00344 00345 /*##################### I2C2 ###################################*/ 00346 /* User can use this section to tailor I2C2 instance used and associated 00347 resources */ 00348 /* Definition for I2C2 Pins */ 00349 #define DISCOVERY_I2C2_SCL_PIN GPIO_PIN_10 00350 #define DISCOVERY_I2C2_SCL_GPIO_PORT GPIOB 00351 #define DISCOVERY_I2C2_SDA_PIN GPIO_PIN_11 00352 #define DISCOVERY_I2C2_SDA_GPIO_PORT GPIOB 00353 #define DISCOVERY_I2C2_SCL_SDA_AF GPIO_AF4_I2C2 00354 /* Definition for I2C2 clock resources */ 00355 #define DISCOVERY_I2C2 I2C2 00356 #define DISCOVERY_I2C2_CLK_ENABLE() __HAL_RCC_I2C2_CLK_ENABLE() 00357 #define DISCOVERY_I2C2_CLK_DISABLE() __HAL_RCC_I2C2_CLK_DISABLE() 00358 #define DISCOVERY_I2C2_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00359 #define DISCOVERY_I2C2_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00360 #define DISCOVERY_I2C2_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00361 #define DISCOVERY_I2C2_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00362 #define DISCOVERY_I2C2_FORCE_RESET() __HAL_RCC_I2C2_FORCE_RESET() 00363 #define DISCOVERY_I2C2_RELEASE_RESET() __HAL_RCC_I2C2_RELEASE_RESET() 00364 00365 /* Definition for I2C2's NVIC */ 00366 #define DISCOVERY_I2C2_EV_IRQn I2C2_EV_IRQn 00367 #define DISCOVERY_I2C2_ER_IRQn I2C2_ER_IRQn 00368 00369 /* I2C TIMING Register define when I2C clock source is SYSCLK */ 00370 /* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 80 MHz */ 00371 /* Set 0x90112626 value to reach 100 KHz speed (Rise time = 640ns, Fall time = 20ns) */ 00372 #ifndef DISCOVERY_I2C2_TIMING 00373 #define DISCOVERY_I2C2_TIMING 0x90112626 00374 #endif /* DISCOVERY_I2C2_TIMING */ 00375 00376 /* I2C clock speed configuration (in Hz) 00377 WARNING: 00378 Make sure that this define is not already declared in other files (ie. 00379 stm324xg_discovery.h file). It can be used in parallel by other modules. */ 00380 #ifndef BSP_I2C_SPEED 00381 #define BSP_I2C_SPEED 100000 00382 #endif /* BSP_I2C_SPEED */ 00383 00384 #define IDD_I2C_ADDRESS ((uint16_t) 0x84) 00385 00386 /* Maximum Timeout values for flags waiting loops. These timeouts are not based 00387 on accurate values, they just guarantee that the application will not remain 00388 stuck if the I2C communication is corrupted. 00389 You may modify these timeout values depending on CPU frequency and application 00390 conditions (interrupts routines ...). */ 00391 #define DISCOVERY_I2C2_TIMEOUT_MAX 3000 00392 #endif /* HAL_I2C_MODULE_ENABLED */ 00393 00394 /*##################### Accelerometer ##########################*/ 00395 /** 00396 * @brief Accelerometer Chip Select macro definition 00397 */ 00398 #define ACCELERO_CS_LOW() HAL_GPIO_WritePin(ACCELERO_CS_GPIO_PORT, ACCELERO_CS_PIN, GPIO_PIN_RESET) 00399 #define ACCELERO_CS_HIGH() HAL_GPIO_WritePin(ACCELERO_CS_GPIO_PORT, ACCELERO_CS_PIN, GPIO_PIN_SET) 00400 00401 /** 00402 * @brief Accelerometer SPI Interface pins 00403 */ 00404 #define ACCELERO_CS_GPIO_PORT GPIOE /* GPIOE */ 00405 #define ACCELERO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00406 #define ACCELERO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00407 #define ACCELERO_CS_PIN GPIO_PIN_0 /* PE.00 */ 00408 00409 /** 00410 * @brief Accelerometer Interrupt pins 00411 */ 00412 #define ACCELERO_XLINT_GPIO_PORT GPIOE /* GPIOE */ 00413 #define ACCELERO_XLINT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00414 #define ACCELERO_XLINT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00415 #define ACCELERO_XLINT_PIN GPIO_PIN_1 /* PE.01 */ 00416 #define ACCELERO_XLINT_EXTI_IRQn EXTI1_IRQn 00417 00418 /*##################### Magnetometer ##########################*/ 00419 /** 00420 * @brief Magnetometer Chip Select macro definition 00421 */ 00422 #define MAGNETO_CS_LOW() HAL_GPIO_WritePin(MAGNETO_CS_GPIO_PORT, MAGNETO_CS_PIN, GPIO_PIN_RESET) 00423 #define MAGNETO_CS_HIGH() HAL_GPIO_WritePin(MAGNETO_CS_GPIO_PORT, MAGNETO_CS_PIN, GPIO_PIN_SET) 00424 00425 /** 00426 * @brief Magnetometer SPI Interface pins 00427 */ 00428 #define MAGNETO_CS_GPIO_PORT GPIOC /* GPIOC */ 00429 #define MAGNETO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00430 #define MAGNETO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00431 #define MAGNETO_CS_PIN GPIO_PIN_0 /* PC.00 */ 00432 00433 00434 /** 00435 * @brief Magnetometer Interrupt pins 00436 */ 00437 #define MAGNETO_INT_GPIO_PORT GPIOC /* GPIOC */ 00438 #define MAGNETO_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00439 #define MAGNETO_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00440 #define MAGNETO_INT1_PIN GPIO_PIN_1 /* PC.01 */ 00441 #define MAGNETO_INT1_EXTI_IRQn EXTI1_IRQn 00442 00443 #define MAGNETO_DRDY_GPIO_PORT GPIOC /* GPIOC */ 00444 #define MAGNETO_DRDY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00445 #define MAGNETO_DRDY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00446 #define MAGNETO_DRDY_PIN GPIO_PIN_2 /* PC.01 */ 00447 00448 00449 /*##################### Audio Codec ##########################*/ 00450 /** 00451 * @brief Audio codec chip reset definition 00452 */ 00453 /* Audio codec power on/off macro definition */ 00454 #define CODEC_AUDIO_POWER_OFF() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_RESET) 00455 #define CODEC_AUDIO_POWER_ON() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_SET) 00456 00457 /* Audio Reset Pin definition */ 00458 #define AUDIO_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00459 #define AUDIO_RESET_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00460 #define AUDIO_RESET_PIN GPIO_PIN_3 00461 #define AUDIO_RESET_GPIO GPIOE 00462 00463 /*##################### Gyroscope ##########################*/ 00464 /** 00465 * @brief Gyroscope Chip Select macro definition 00466 */ 00467 #define GYRO_CS_LOW() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_RESET) 00468 #define GYRO_CS_HIGH() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_SET) 00469 00470 /** 00471 * @brief Gyroscope SPI Interface pins 00472 */ 00473 #define GYRO_CS_GPIO_PORT GPIOD /* GPIOD */ 00474 #define GYRO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00475 #define GYRO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() 00476 #define GYRO_CS_PIN GPIO_PIN_7 /* PD.07 */ 00477 00478 /** 00479 * @brief Gyroscope Interrupt pins 00480 */ 00481 #if defined (USE_STM32L476G_DISCO_REVC) || defined (USE_STM32L476G_DISCO_REVB) 00482 #define GYRO_INT1_GPIO_PORT GPIOD /* GPIOD */ 00483 #define GYRO_INT1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00484 #define GYRO_INT1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() 00485 #define GYRO_INT1_PIN GPIO_PIN_2 /* PD.02 */ 00486 #define GYRO_INT1_EXTI_IRQn EXTI2_IRQn 00487 #define GYRO_INT2_GPIO_PORT GPIOB /* GPIOB */ 00488 #define GYRO_INT2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00489 #define GYRO_INT2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00490 #define GYRO_INT2_PIN GPIO_PIN_8 /* PB.08 */ 00491 #define GYRO_INT2_EXTI_IRQn EXTI9_5_IRQn 00492 #elif defined (USE_STM32L476G_DISCO_REVA) 00493 #define GYRO_INT1_GPIO_PORT GPIOB /* GPIOB */ 00494 #define GYRO_INT1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00495 #define GYRO_INT1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00496 #define GYRO_INT1_PIN GPIO_PIN_6 /* PB.06 */ 00497 #define GYRO_INT1_EXTI_IRQn EXTI9_5_IRQn 00498 #define GYRO_INT2_GPIO_PORT GPIOB /* GPIOB */ 00499 #define GYRO_INT2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00500 #define GYRO_INT2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00501 #define GYRO_INT2_PIN GPIO_PIN_7 /* PB.07 */ 00502 #define GYRO_INT2_EXTI_IRQn EXTI9_5_IRQn 00503 #endif 00504 00505 /*##################### Idd ##########################*/ 00506 /** 00507 * @brief Idd current measurement interface pins 00508 */ 00509 #define IDD_INT_GPIO_PORT GPIOC /* GPIOC */ 00510 #define IDD_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00511 #define IDD_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00512 #define IDD_INT_PIN GPIO_PIN_13 /* PC.13 */ 00513 #define IDD_INT_EXTI_IRQn EXTI15_10_IRQn 00514 00515 #define IDD_WAKEUP_GPIO_PORT GPIOA /* GPIOA */ 00516 #define IDD_WAKEUP_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00517 #define IDD_WAKEUP_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00518 #define IDD_WAKEUP_PIN GPIO_PIN_4 /* PA.04 */ 00519 00520 /** 00521 * @} 00522 */ 00523 00524 /** 00525 * @} 00526 */ 00527 00528 00529 /** @defgroup STM32L476G_DISCOVERY_Exported_Functions Exported Functions 00530 * @{ 00531 */ 00532 uint32_t BSP_GetVersion(void); 00533 SupplyMode_TypeDef BSP_SupplyModeDetection(void); 00534 void BSP_LED_Init(Led_TypeDef Led); 00535 void BSP_LED_DeInit(Led_TypeDef Led); 00536 void BSP_LED_On(Led_TypeDef Led); 00537 void BSP_LED_Off(Led_TypeDef Led); 00538 void BSP_LED_Toggle(Led_TypeDef Led); 00539 uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode); 00540 void BSP_JOY_DeInit(void); 00541 JOYState_TypeDef BSP_JOY_GetState(void); 00542 00543 /** 00544 * @} 00545 */ 00546 00547 /** 00548 * @} 00549 */ 00550 00551 /** 00552 * @} 00553 */ 00554 00555 /** 00556 * @} 00557 */ 00558 00559 #ifdef __cplusplus 00560 } 00561 #endif 00562 00563 #endif /* __STM32L476G_DISCOVERY_H */ 00564 00565 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jun 23 2015 17:15:45 for STM32L476G-Discovery BSP User Manual by 1.7.6.1