STM32L4R9I-Discovery BSP User Manual
|
stm32l4r9i_discovery.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4r9i_discovery.h 00004 * @author MCD Application Team 00005 * @brief This file contains definitions for STM32L4R9I_DISCOVERY's LEDs, 00006 * push-buttons hardware resources (MB1311). 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00011 * 00012 * Redistribution and use in source and binary forms, with or without modification, 00013 * are permitted provided that the following conditions are met: 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00020 * may be used to endorse or promote products derived from this software 00021 * without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00026 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00027 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00028 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00029 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 ****************************************************************************** 00035 */ 00036 00037 /* Define to prevent recursive inclusion -------------------------------------*/ 00038 #ifndef __STM32L4R9I_DISCOVERY_H 00039 #define __STM32L4R9I_DISCOVERY_H 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 /** 00046 * @brief Define for STM32L4R9I_DISCOVERY board 00047 */ 00048 00049 00050 00051 /* Includes ------------------------------------------------------------------*/ 00052 #include "stm32l4xx_hal.h" 00053 #if defined(BSP_USE_CMSIS_OS) 00054 #include "cmsis_os.h" 00055 #endif 00056 00057 /** @addtogroup BSP 00058 * @{ 00059 */ 00060 00061 /** @addtogroup STM32L4R9I_DISCOVERY 00062 * @{ 00063 */ 00064 00065 /** @addtogroup STM32L4R9I_DISCOVERY_Common 00066 * @{ 00067 */ 00068 00069 /** @defgroup STM32L4R9I_DISCOVERY_Exported_Types Exported Types 00070 * @{ 00071 */ 00072 00073 /** 00074 * @brief LED Types Definition 00075 */ 00076 typedef enum 00077 { 00078 LED1 = 0, 00079 LED2 = 1, 00080 LED_ORANGE = LED1, 00081 LED_GREEN = LED2 00082 }Led_TypeDef; 00083 00084 00085 /** 00086 * @brief JOYSTICK Types Definition 00087 */ 00088 typedef enum 00089 { 00090 JOY_SEL = 0, 00091 JOY_LEFT = 1, 00092 JOY_RIGHT = 2, 00093 JOY_DOWN = 3, 00094 JOY_UP = 4, 00095 JOY_NONE = 5 00096 }JOYState_TypeDef; 00097 00098 typedef enum 00099 { 00100 JOY_MODE_GPIO = 0, 00101 JOY_MODE_EXTI = 1 00102 }JOYMode_TypeDef; 00103 00104 /** 00105 * @brief COM Type Definition 00106 */ 00107 typedef enum 00108 { 00109 COM1 = 0 00110 }COM_TypeDef; 00111 00112 /** 00113 * @} 00114 */ 00115 00116 /** @defgroup STM32L4R9I_DISCOVERY_Exported_Constants Exported Constants 00117 * @{ 00118 */ 00119 00120 /** @defgroup STM32L4R9I_DISCOVERY_LED LED Constants 00121 * @{ 00122 */ 00123 /* LED number */ 00124 #define LEDn 2 00125 00126 /* LED1 is accessed thru the MFX */ 00127 #define LED1_PIN IO_PIN_0 00128 00129 #define LED2_PIN GPIO_PIN_4 00130 #define LED2_GPIO_PORT GPIOH 00131 #define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE() 00132 #define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOH_CLK_DISABLE() 00133 00134 /** 00135 * @} 00136 */ 00137 00138 /** @defgroup STM32L4R9I_DISCOVERY_BUTTON BUTTON Constants 00139 * @{ 00140 */ 00141 #define JOYn 5 00142 00143 /** 00144 * @brief Joystick Right push-button 00145 */ 00146 #if defined(USE_STM32L4R9I_DISCO_REVA) 00147 /* Joystick right and up pins inverted */ 00148 #define RIGHT_JOY_PIN IO_PIN_1 00149 #else 00150 #define RIGHT_JOY_PIN IO_PIN_3 00151 #endif 00152 #define RIGHT_JOY_EXTI_IRQn EXTI1_IRQn 00153 00154 /** 00155 * @brief Joystick Left push-button 00156 */ 00157 #define LEFT_JOY_PIN IO_PIN_4 00158 #define LEFT_JOY_EXTI_IRQn EXTI1_IRQn 00159 00160 /** 00161 * @brief Joystick Up push-button 00162 */ 00163 #if defined(USE_STM32L4R9I_DISCO_REVA) 00164 /* Joystick right and up pins inverted */ 00165 #define UP_JOY_PIN IO_PIN_3 00166 #else 00167 #define UP_JOY_PIN IO_PIN_1 00168 #endif 00169 #define UP_JOY_EXTI_IRQn EXTI1_IRQn 00170 00171 /** 00172 * @brief Joystick Down push-button 00173 */ 00174 #define DOWN_JOY_PIN IO_PIN_2 00175 #define DOWN_JOY_EXTI_IRQn EXTI1_IRQn 00176 00177 /** 00178 * @brief Joystick Sel push-button 00179 */ 00180 #define SEL_JOY_PIN GPIO_PIN_13 /* PC.13 */ 00181 #define SEL_JOY_GPIO_PORT GPIOC 00182 #define SEL_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00183 #define SEL_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00184 #define SEL_JOY_EXTI_IRQn EXTI15_10_IRQn 00185 00186 /** 00187 * @} 00188 */ 00189 00190 /** @defgroup STM32L4R9I_DISCOVERY_MFX_PIN MFX Pins Constants 00191 * @{ 00192 */ 00193 00194 /** 00195 * @brief Pins definition connected to MFX 00196 */ 00197 #define DSI_RST_PIN IO_PIN_10 00198 #define EXT_RST_PIN IO_PIN_11 00199 #define OTG_FS_POWER_SWITCH_PIN IO_PIN_13 00200 #define OTG_FS_OVER_CURRENT_PIN IO_PIN_14 00201 #define SD_DETECT_PIN IO_PIN_5 00202 00203 /** 00204 * @} 00205 */ 00206 00207 /** @defgroup STM32L4R9I_DISCOVERY_COM COM Constants 00208 * @{ 00209 */ 00210 #define COMn 1 00211 00212 /** 00213 * @brief Definition for COM port1, connected to USART2 (ST-Link USB Virtual Com Port) 00214 */ 00215 #define DISCOVERY_COM1 USART2 00216 #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE() 00217 #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART2_CLK_DISABLE() 00218 00219 #define DISCOVERY_COM1_TX_PIN GPIO_PIN_2 00220 #define DISCOVERY_COM1_TX_GPIO_PORT GPIOA 00221 #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00222 #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00223 #define DISCOVERY_COM1_TX_AF GPIO_AF7_USART2 00224 00225 #define DISCOVERY_COM1_RX_PIN GPIO_PIN_3 00226 #define DISCOVERY_COM1_RX_GPIO_PORT GPIOA 00227 #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00228 #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00229 #define DISCOVERY_COM1_RX_AF GPIO_AF7_USART2 00230 00231 #define DISCOVERY_COM1_IRQn USART2_IRQn 00232 00233 00234 #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();}} while(0) 00235 #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_DISABLE();}} while(0) 00236 00237 #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();}} while(0) 00238 #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_DISABLE();}} while(0) 00239 00240 #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();}} while(0) 00241 #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_DISABLE();}} while(0) 00242 00243 /** 00244 * @} 00245 */ 00246 00247 /** @defgroup STM32L4R9I_DISCOVERY_BUS BUS Constants 00248 * @{ 00249 */ 00250 00251 #if defined(HAL_I2C_MODULE_ENABLED) 00252 /*##################### I2C1 ###################################*/ 00253 00254 /* I2C TIMING Register define when I2C clock source is SYSCLK */ 00255 /* I2C TIMING is calculated in case of the I2C Clock source is the SYSCLK = 120 MHz */ 00256 /* Set 0xC080242F value to reach 100 KHz speed (Rise time = 640ns, Fall time = 20ns) */ 00257 #ifndef DISCOVERY_I2C1_TIMING 00258 #define DISCOVERY_I2C1_TIMING 0xC080242F 00259 #endif /* DISCOVERY_I2C1_TIMING */ 00260 00261 /* Maximum Timeout values for flags waiting loops. These timeouts are not based 00262 on accurate values, they just guarantee that the application will not remain 00263 stuck if the I2C communication is corrupted. 00264 You may modify these timeout values depending on CPU frequency and application 00265 conditions (interrupts routines ...). */ 00266 #define DISCOVERY_I2C1_TIMEOUT_MAX 3000 00267 00268 #define IDD_I2C_ADDRESS ((uint16_t) 0x84) 00269 #define IO_I2C_ADDRESS ((uint16_t) 0x84) 00270 #define AUDIO_I2C_ADDRESS ((uint16_t) 0x94) 00271 #define TS_I2C_ADDRESS ((uint16_t) 0x70) 00272 #define CAMERA_I2C_ADDRESS ((uint16_t) 0x60) 00273 00274 #endif /* HAL_I2C_MODULE_ENABLED */ 00275 00276 /*##################### Audio Codec ##########################*/ 00277 /** 00278 * @brief Audio codec chip reset definition 00279 */ 00280 /* Audio codec power on/off macro definition */ 00281 #define CODEC_AUDIO_POWER_OFF() BSP_IO_WritePin(AUDIO_RESET_PIN, GPIO_PIN_RESET) 00282 #define CODEC_AUDIO_POWER_ON() BSP_IO_WritePin(AUDIO_RESET_PIN, GPIO_PIN_SET) 00283 00284 /* Audio Reset Pin definition */ 00285 #define AUDIO_RESET_PIN IO_PIN_15 00286 00287 /*##################### MFX ##########################*/ 00288 /** 00289 * @brief MFX interface pins 00290 */ 00291 #define MFX_INT_GPIO_PORT GPIOI 00292 #define MFX_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00293 #define MFX_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00294 #define MFX_INT_PIN GPIO_PIN_1 /* PI.01 */ 00295 #define MFX_INT_EXTI_IRQn EXTI1_IRQn 00296 00297 #define MFX_WAKEUP_GPIO_PORT GPIOB 00298 #define MFX_WAKEUP_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00299 #define MFX_WAKEUP_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00300 #define MFX_WAKEUP_PIN GPIO_PIN_2 /* PB.02 */ 00301 00302 /* Legacy */ 00303 #define IDD_INT_GPIO_PORT MFX_INT_GPIO_PORT 00304 #define IDD_INT_GPIO_CLK_ENABLE() MFX_INT_GPIO_CLK_ENABLE() 00305 #define IDD_INT_GPIO_CLK_DISABLE() MFX_INT_GPIO_CLK_DISABLE() 00306 #define IDD_INT_PIN MFX_INT_PIN 00307 #define IDD_INT_EXTI_IRQn MFX_INT_EXTI_IRQn 00308 #define IDD_WAKEUP_GPIO_PORT MFX_WAKEUP_GPIO_PORT 00309 #define IDD_WAKEUP_GPIO_CLK_ENABLE() MFX_WAKEUP_GPIO_CLK_ENABLE() 00310 #define IDD_WAKEUP_GPIO_CLK_DISABLE() MFX_WAKEUP_GPIO_CLK_DISABLE() 00311 #define IDD_WAKEUP_PIN MFX_WAKEUP_PIN 00312 00313 /** 00314 * @brief Idd current measurement interface pins on MFX 00315 */ 00316 #define IDD_AMP_CONTROL_PIN AGPIO_PIN_1 00317 00318 /** 00319 * @brief LCD pins 00320 */ 00321 /* TE pin */ 00322 #define LCD_TE_PIN GPIO_PIN_11 00323 #define LCD_TE_CTRL_GPIO_PORT GPIOF 00324 #define LCD_TE_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE() 00325 #define LCD_TE_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE() 00326 00327 /* Backlight control pin */ 00328 #define LCD_BL_CTRL_PIN GPIO_PIN_1 00329 #define LCD_BL_CTRL_GPIO_PORT GPIOB 00330 #define LCD_BL_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00331 #define LCD_BL_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00332 00333 /* TS INT pin */ 00334 #define TS_INT_PIN IO_PIN_9 00335 #define TS_INT_EXTI_IRQn EXTI1_IRQn 00336 00337 /** 00338 * @} 00339 */ 00340 00341 /** 00342 * @} 00343 */ 00344 00345 /** @defgroup STM32L4R9I_DISCOVERY_Exported_Functions Exported Functions 00346 * @{ 00347 */ 00348 uint32_t BSP_GetVersion(void); 00349 void BSP_LED_Init(Led_TypeDef Led); 00350 void BSP_LED_DeInit(Led_TypeDef Led); 00351 void BSP_LED_On(Led_TypeDef Led); 00352 void BSP_LED_Off(Led_TypeDef Led); 00353 void BSP_LED_Toggle(Led_TypeDef Led); 00354 uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode); 00355 void BSP_JOY_DeInit(void); 00356 JOYState_TypeDef BSP_JOY_GetState(void); 00357 #if defined(HAL_UART_MODULE_ENABLED) 00358 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); 00359 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); 00360 #endif /* HAL_UART_MODULE_ENABLED */ 00361 00362 /* These __weak functions can be surcharged by application code for specific application needs */ 00363 void BSP_ErrorHandler(void); 00364 00365 /** 00366 * @} 00367 */ 00368 00369 /** 00370 * @} 00371 */ 00372 00373 /** 00374 * @} 00375 */ 00376 00377 /** 00378 * @} 00379 */ 00380 00381 #ifdef __cplusplus 00382 } 00383 #endif 00384 00385 #endif /* __STM32L4R9I_DISCOVERY_H */ 00386 00387 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Oct 13 2017 02:37:42 for STM32L4R9I-Discovery BSP User Manual by 1.7.6.1