STM32F413H-Discovery BSP User Manual
|
stm32f413h_discovery.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f413h_discovery.h 00004 * @author MCD Application Team 00005 * @version V1.0.0 00006 * @date 27-January-2017 00007 * @brief This file contains definitions for STM32F413H_DISCOVERY's LEDs, 00008 * push-buttons and COM ports hardware resources. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2017 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 __STM32F413H_DISCOVERY_H 00041 #define __STM32F413H_DISCOVERY_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* Includes ------------------------------------------------------------------*/ 00048 #include "stm32f4xx_hal.h" 00049 00050 /** @addtogroup BSP 00051 * @{ 00052 */ 00053 00054 /** @addtogroup STM32F413H_DISCOVERY 00055 * @{ 00056 */ 00057 00058 /** @addtogroup STM32F413H_DISCOVERY_LOW_LEVEL 00059 * @{ 00060 */ 00061 00062 /** @defgroup STM32F413H_DISCOVERY_LOW_LEVEL_Exported_Types STM32F413H DISCOVERY Low Level Exported Types 00063 * @{ 00064 */ 00065 typedef enum 00066 { 00067 LED3 = 0, 00068 LED_GREEN = LED3, 00069 LED4 = 1, 00070 LED_RED = LED4, 00071 }Led_TypeDef; 00072 00073 00074 typedef enum 00075 { 00076 BUTTON_WAKEUP = 0 00077 }Button_TypeDef; 00078 00079 typedef enum 00080 { 00081 BUTTON_MODE_GPIO = 0, 00082 BUTTON_MODE_EXTI = 1 00083 }ButtonMode_TypeDef; 00084 00085 typedef enum 00086 { 00087 COM1 = 0, 00088 }COM_TypeDef; 00089 /** 00090 * @} 00091 */ 00092 00093 /** @defgroup STM32F413H_DISCOVERY_LOW_LEVEL_Exported_Constants STM32F413H DISCOVERY Low Level Exported Constants 00094 * @{ 00095 */ 00096 00097 /** 00098 * @brief Define for STM32F413H_DISCOVERY board 00099 */ 00100 #if !defined (USE_STM32F413H_DISCOVERY) 00101 #define USE_STM32F413H_DISCOVERY 00102 #endif 00103 00104 /** @addtogroup STM32F413H_DISCOVERY_LOW_LEVEL_LED STM32F413H DISCOVERY Low Level Led 00105 * @{ 00106 */ 00107 #define LEDn ((uint8_t)2) 00108 00109 #define LED4_GPIO_PORT GPIOE 00110 #define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() 00111 #define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() 00112 00113 #define LED3_GPIO_PORT GPIOC 00114 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00115 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00116 00117 #define LED4_PIN GPIO_PIN_3 00118 #define LED3_PIN GPIO_PIN_5 00119 00120 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED3_GPIO_CLK_ENABLE(); else \ 00121 if((__INDEX__) == 1) LED4_GPIO_CLK_ENABLE(); \ 00122 }while(0) 00123 00124 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED3_GPIO_CLK_DISABLE(); else \ 00125 if((__INDEX__) == 1) LED4_GPIO_CLK_DISABLE(); \ 00126 }while(0) 00127 /** 00128 * @} 00129 */ 00130 00131 /** @addtogroup STM32F413H_DISCOVERY_LOW_LEVEL_BUTTON STM32F413H DISCOVERY Low Level Button 00132 * @{ 00133 */ 00134 /* Only one User/Wakeup button */ 00135 #define BUTTONn ((uint8_t)1) 00136 00137 /** 00138 * @brief Wakeup push-button 00139 */ 00140 #define WAKEUP_BUTTON_PIN GPIO_PIN_0 00141 #define WAKEUP_BUTTON_GPIO_PORT GPIOA 00142 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00143 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00144 #define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn 00145 00146 /** 00147 * @} 00148 */ 00149 00150 /** @addtogroup STM32F413H_DISCOVERY_LOW_LEVEL_SIGNAL 00151 * @{ 00152 */ 00153 /** 00154 * @brief SD-detect signal 00155 */ 00156 #define SD_DETECT_PIN GPIO_PIN_11 00157 #define SD_DETECT_GPIO_PORT GPIOF 00158 #define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE() 00159 #define SD_DETECT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE() 00160 #define SD_DETECT_EXTI_IRQn EXTI15_10_IRQn 00161 00162 00163 /** 00164 * @brief TS INT pin 00165 */ 00166 #define TS_INT_PIN GPIO_PIN_1 00167 #define TS_INT_GPIO_PORT GPIOC 00168 #define TS_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00169 #define TS_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00170 #define TS_INT_EXTI_IRQn EXTI1_IRQn 00171 00172 /** 00173 * @brief TS RST pin 00174 */ 00175 #define TS_RESET_PIN GPIO_PIN_13 00176 #define TS_RESET_GPIO_PORT GPIOB 00177 #define TS_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00178 #define TS_RESET_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00179 #define TS_RESET_EXTI_IRQn EXTI15_10_IRQn 00180 00181 /** 00182 * @} 00183 */ 00184 00185 /** @addtogroup STM32F413H_DISCOVERY_LOW_LEVEL_COM STM32F413H DISCOVERY Low Level COM 00186 * @{ 00187 */ 00188 #define COMn ((uint8_t)1) 00189 00190 /** 00191 * @brief Definition for COM port1, connected to USART6 00192 */ 00193 #define DISCOVERY_COM1 USART6 00194 #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART6_CLK_ENABLE() 00195 #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART6_CLK_DISABLE() 00196 00197 #define DISCOVERY_COM1_TX_PIN GPIO_PIN_14 00198 #define DISCOVERY_COM1_TX_GPIO_PORT GPIOG 00199 #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE() 00200 #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE() 00201 #define DISCOVERY_COM1_TX_AF GPIO_AF8_USART6 00202 00203 #define DISCOVERY_COM1_RX_PIN GPIO_PIN_9 00204 #define DISCOVERY_COM1_RX_GPIO_PORT GPIOG 00205 #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE() 00206 #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE() 00207 #define DISCOVERY_COM1_RX_AF GPIO_AF8_USART6 00208 00209 #define DISCOVERY_COM1_IRQn USART6_IRQn 00210 00211 #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_CLK_ENABLE();} } while(0) 00212 #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_CLK_DISABLE() : 0) 00213 00214 #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_TX_GPIO_CLK_ENABLE();} } while(0) 00215 #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() : 0) 00216 00217 #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {DISCOVERY_COM1_RX_GPIO_CLK_ENABLE();} } while(0) 00218 #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() : 0) 00219 00220 /* Exported constant IO ------------------------------------------------------*/ 00221 00222 #define AUDIO_I2C_ADDRESS ((uint16_t)0x34) 00223 #define EEPROM_I2C_ADDRESS_A01 ((uint16_t)0xA0) 00224 #define EEPROM_I2C_ADDRESS_A02 ((uint16_t)0xA6) 00225 #define TS_I2C_ADDRESS ((uint16_t)0x70) 00226 00227 /* User can use this section to tailor I2Cx/I2Cx instance used and associated 00228 resources */ 00229 /* Definition for AUDIO I2Cx resources */ 00230 #define DISCOVERY_AUDIO_I2Cx FMPI2C1 00231 #define DISCOVERY_AUDIO_I2Cx_CLK_ENABLE() __HAL_RCC_FMPI2C1_CLK_ENABLE() 00232 #define DISCOVERY_AUDIO_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00233 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00234 00235 #define DISCOVERY_AUDIO_I2Cx_FORCE_RESET() __HAL_RCC_FMPI2C1_FORCE_RESET() 00236 #define DISCOVERY_AUDIO_I2Cx_RELEASE_RESET() __HAL_RCC_FMPI2C1_RELEASE_RESET() 00237 00238 /* Definition for I2Cx Pins */ 00239 #define DISCOVERY_AUDIO_I2Cx_SCL_PIN GPIO_PIN_6 00240 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT GPIOC 00241 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF GPIO_AF4_FMPI2C1 00242 #define DISCOVERY_AUDIO_I2Cx_SDA_PIN GPIO_PIN_7 00243 00244 /* I2C interrupt requests */ 00245 #define DISCOVERY_AUDIO_I2Cx_EV_IRQn FMPI2C1_EV_IRQn 00246 #define DISCOVERY_AUDIO_I2Cx_ER_IRQn FMPI2C1_ER_IRQn 00247 00248 /* I2C clock speed configuration (in Hz) 00249 WARNING: 00250 Make sure that this define is not already declared in other files. 00251 It can be used in parallel by other modules. */ 00252 #ifndef DISCOVERY_I2C_SPEED 00253 #define DISCOVERY_I2C_SPEED 100000 00254 #endif /* DISCOVERY_I2C_SPEED */ 00255 00256 #ifndef DISCOVERY_I2Cx_TIMING 00257 #define DISCOVERY_I2Cx_TIMING ((uint32_t)0x00901954) 00258 #endif /* DISCOVERY_I2Cx_TIMING */ 00259 /** 00260 * @} 00261 */ 00262 00263 /** 00264 * @} 00265 */ 00266 00267 /** @defgroup STM32F413H_DISCOVERY_LOW_LEVEL_Exported_Functions STM32F413H DISCOVERY Low Level Exported Functions 00268 * @{ 00269 */ 00270 uint32_t BSP_GetVersion(void); 00271 void BSP_LED_Init(Led_TypeDef Led); 00272 void BSP_LED_DeInit(Led_TypeDef Led); 00273 void BSP_LED_On(Led_TypeDef Led); 00274 void BSP_LED_Off(Led_TypeDef Led); 00275 void BSP_LED_Toggle(Led_TypeDef Led); 00276 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); 00277 void BSP_PB_DeInit(Button_TypeDef Button); 00278 uint32_t BSP_PB_GetState(Button_TypeDef Button); 00279 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); 00280 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); 00281 00282 /** 00283 * @} 00284 */ 00285 00286 /** 00287 * @} 00288 */ 00289 00290 /** 00291 * @} 00292 */ 00293 00294 /** 00295 * @} 00296 */ 00297 00298 #ifdef __cplusplus 00299 } 00300 #endif 00301 00302 #endif /* __STM32F413H_DISCOVERY_H */ 00303 00304 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Thu Jan 26 2017 16:30:37 for STM32F413H-Discovery BSP User Manual by 1.7.6.1