STM32446E_EVAL BSP User Manual
|
stm32446e_eval.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32446e_eval.h 00004 * @author MCD Application Team 00005 * @version V1.1.1 00006 * @date 13-January-2016 00007 * @brief This file contains definitions for STM32446E_EVAL's LEDs, 00008 * push-buttons and COM ports hardware resources. 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 /* IMPORTANT: in order to compile with RevA following flag shall be defined */ 00040 /* in the preprocessor options: USE_STM32446E_EVAL_REVA !!!!!!!!!! */ 00041 00042 /* Define to prevent recursive inclusion -------------------------------------*/ 00043 #ifndef __STM32446E_EVAL_H 00044 #define __STM32446E_EVAL_H 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 /* USE_STM32446E_EVAL_REVA must USE USE_IOEXPANDER */ 00051 #if defined(USE_STM32446E_EVAL_REVA) 00052 #ifndef USE_IOEXPANDER 00053 #define USE_IOEXPANDER 00054 #endif // USE_IOEXPANDER 00055 #endif // USE_STM32446E_EVAL_REVA 00056 00057 /* Includes ------------------------------------------------------------------*/ 00058 #include "stm32f4xx_hal.h" 00059 00060 /** @addtogroup BSP 00061 * @{ 00062 */ 00063 00064 /** @addtogroup STM32446E_EVAL 00065 * @{ 00066 */ 00067 00068 /** @defgroup STM32446E_EVAL_LOW_LEVEL STM32446E EVAL LOW LEVEL 00069 * @{ 00070 */ 00071 00072 /** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Types STM32446E EVAL LOW LEVEL Exported Types 00073 * @{ 00074 */ 00075 typedef enum 00076 { 00077 #if defined(USE_IOEXPANDER) 00078 LED1 = 0, 00079 LED_GREEN = LED1, 00080 LED2 = 1, 00081 LED_ORANGE = LED2, 00082 LED3 = 2, 00083 LED_RED = LED3, 00084 LED4 = 3, 00085 LED_BLUE = LED4 00086 #else 00087 LED1 = 0, 00088 LED_GREEN = LED1, 00089 LED3 = 1, 00090 LED_RED = LED3, 00091 #endif /* USE_IOEXPANDER */ 00092 }Led_TypeDef; 00093 00094 00095 typedef enum 00096 { 00097 BUTTON_WAKEUP = 0, 00098 BUTTON_TAMPER = 1, 00099 BUTTON_KEY = 2 00100 }Button_TypeDef; 00101 00102 typedef enum 00103 { 00104 BUTTON_MODE_GPIO = 0, 00105 BUTTON_MODE_EXTI = 1 00106 }ButtonMode_TypeDef; 00107 00108 #if defined(USE_IOEXPANDER) 00109 typedef enum 00110 { 00111 JOY_MODE_GPIO = 0, 00112 JOY_MODE_EXTI = 1 00113 }JOYMode_TypeDef; 00114 00115 typedef enum 00116 { 00117 JOY_NONE = 0, 00118 JOY_SEL = 1, 00119 JOY_DOWN = 2, 00120 JOY_LEFT = 3, 00121 JOY_RIGHT = 4, 00122 JOY_UP = 5 00123 }JOYState_TypeDef; 00124 #endif /* USE_IOEXPANDER */ 00125 00126 typedef enum 00127 { 00128 COM1 = 0, 00129 COM2 = 1 00130 }COM_TypeDef; 00131 /** 00132 * @} 00133 */ 00134 00135 /** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Constants STM32446E EVAL LOW LEVEL Exported Constants 00136 * @{ 00137 */ 00138 00139 /** 00140 * @brief Define for STM32446E_EVAL board 00141 */ 00142 #if !defined (USE_STM32446E_EVAL) 00143 #define USE_STM32446E_EVAL 00144 #endif 00145 00146 /** @addtogroup STM32446E_EVAL_LOW_LEVEL_LED STM32446E EVAL LOW LEVEL LED 00147 * @{ 00148 */ 00149 00150 #if !defined(USE_STM32446E_EVAL_REVA) 00151 00152 #if defined(USE_IOEXPANDER) 00153 #define LEDn ((uint8_t)4) 00154 #define LED2_PIN IO_PIN_21 00155 #define LED4_PIN IO_PIN_23 00156 #else 00157 #define LEDn ((uint8_t)2) 00158 #endif /* USE_IOEXPANDER */ 00159 00160 #define LEDx_GPIO_PORT GPIOB 00161 #define LEDx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00162 #define LEDx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00163 #define LED1_PIN GPIO_PIN_11 00164 #define LED3_PIN GPIO_PIN_4 00165 00166 #else 00167 00168 #define LEDn ((uint8_t)4) 00169 #define LED1_PIN IO_PIN_20 00170 #define LED3_PIN IO_PIN_22 00171 #define LED2_PIN IO_PIN_21 00172 #define LED4_PIN IO_PIN_23 00173 00174 #endif // !USE_STM32446E_EVAL_REVA 00175 00176 00177 /** 00178 * @} 00179 */ 00180 00181 /** @addtogroup STM32446E_EVAL_LOW_LEVEL_BUTTON STM32446E EVAL LOW LEVEL BUTTON 00182 * @{ 00183 */ 00184 /* Joystick pins are connected to IO Expander (accessible through FMPI2C interface) */ 00185 #define BUTTONn ((uint8_t)3) 00186 00187 /** 00188 * @brief Wakeup push-button 00189 */ 00190 #define WAKEUP_BUTTON_PIN GPIO_PIN_13 00191 #define WAKEUP_BUTTON_GPIO_PORT GPIOC 00192 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00193 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00194 #define WAKEUP_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00195 00196 /** 00197 * @brief Tamper push-button 00198 */ 00199 #define TAMPER_BUTTON_PIN GPIO_PIN_13 00200 #define TAMPER_BUTTON_GPIO_PORT GPIOC 00201 #define TAMPER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00202 #define TAMPER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00203 #define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00204 00205 /** 00206 * @brief Key push-button 00207 */ 00208 #define KEY_BUTTON_PIN GPIO_PIN_13 00209 #define KEY_BUTTON_GPIO_PORT GPIOC 00210 #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00211 #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00212 #define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00213 00214 /** 00215 * @brief MFX Irq Out Pin 00216 */ 00217 #define MFX_IRQOUT_PIN GPIO_PIN_0 00218 #define MFX_IRQOUT_GPIO_PORT GPIOA 00219 #define MFX_IRQOUT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00220 #define MFX_IRQOUT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00221 #define MFX_IRQOUT_EXTI_IRQn EXTI0_IRQn 00222 00223 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) {WAKEUP_BUTTON_GPIO_CLK_ENABLE();} else\ 00224 if((__INDEX__) == 1) {TAMPER_BUTTON_GPIO_CLK_ENABLE();} else\ 00225 {KEY_BUTTON_GPIO_CLK_ENABLE(); }} while(0) 00226 00227 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\ 00228 ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE()) 00229 /** 00230 * @} 00231 */ 00232 00233 /** @addtogroup STM32446E_EVAL_LOW_LEVEL_COM STM32446E EVAL LOW LEVEL COM 00234 * @{ 00235 */ 00236 #define COMn ((uint8_t)1) 00237 00238 /** 00239 * @brief Definition for COM port1, connected to USART1 00240 */ 00241 #define EVAL_COM1 USART1 00242 #define EVAL_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE() 00243 #define EVAL_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE() 00244 00245 #define EVAL_COM1_TX_PIN GPIO_PIN_9 00246 #define EVAL_COM1_TX_GPIO_PORT GPIOA 00247 #define EVAL_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00248 #define EVAL_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00249 #define EVAL_COM1_TX_AF GPIO_AF7_USART1 00250 00251 #define EVAL_COM1_RX_PIN GPIO_PIN_10 00252 #define EVAL_COM1_RX_GPIO_PORT GPIOA 00253 #define EVAL_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00254 #define EVAL_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00255 #define EVAL_COM1_RX_AF GPIO_AF7_USART1 00256 00257 #define EVAL_COM1_IRQn USART1_IRQn 00258 00259 #define EVAL_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {EVAL_COM1_CLK_ENABLE();} } while(0) 00260 #define EVAL_COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_CLK_DISABLE() : 0) 00261 00262 #define EVAL_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {EVAL_COM1_TX_GPIO_CLK_ENABLE();} } while(0) 00263 #define EVAL_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() : 0) 00264 00265 #define EVAL_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) {EVAL_COM1_RX_GPIO_CLK_ENABLE();} } while(0) 00266 #define EVAL_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() : 0) 00267 00268 /** 00269 * @brief Joystick Pins definition 00270 */ 00271 #if defined(USE_IOEXPANDER) 00272 00273 #define JOY_SEL_PIN IO_PIN_5 00274 #define JOY_UP_PIN IO_PIN_4 00275 #define JOY_DOWN_PIN IO_PIN_3 00276 #define JOY_LEFT_PIN IO_PIN_2 00277 #define JOY_RIGHT_PIN IO_PIN_1 00278 #define JOY_NONE_PIN JOY_ALL_PINS 00279 #define JOY_ALL_PINS (IO_PIN_5 | IO_PIN_1 | IO_PIN_2 | IO_PIN_3 | IO_PIN_4) 00280 00281 #endif /* USE_IOEXPANDER */ 00282 00283 /** 00284 * @brief Eval Pins definition connected to MFX 00285 */ 00286 00287 #if defined(USE_IOEXPANDER) 00288 00289 #define XSDN_PIN IO_PIN_10 00290 #define RSTI_PIN IO_PIN_11 00291 #define CAM_PLUG_PIN IO_PIN_12 00292 #define AUDIO_INT_PIN IO_PIN_5 00293 #define OTG_FS1_OVER_CURRENT_PIN IO_PIN_6 00294 #define OTG_FS1_POWER_SWITCH_PIN IO_PIN_7 00295 #define OTG_FS2_OVER_CURRENT_PIN IO_PIN_8 00296 #define SD_DETECT_PIN IO_PIN_15 00297 00298 #endif /* USE_IOEXPANDER */ 00299 00300 00301 /* Exported constant IO ------------------------------------------------------*/ 00302 00303 /* The MFX_I2C_ADDR input pin selects the MFX I2C device address 00304 MFX_I2C_ADDR input pin MFX I2C device address 00305 0 b: 1000 010x (0x84) 00306 1 b: 1000 011x (0x86) 00307 This input is sampled during the MFX firmware startup. */ 00308 00309 #define IO_I2C_ADDRESS ((uint16_t)0x84) /*mfx MFX_I2C_ADDR 0*/ 00310 #define IO_I2C_ADDRESS_2 ((uint16_t)0x86) /*mfx MFX_I2C_ADDR 1*/ 00311 #define TS_I2C_ADDRESS ((uint16_t)0x84) /*mfx MFX_I2C_ADDR 0*/ 00312 #define TS_I2C_ADDRESS_2 ((uint16_t)0x86) /*mfx MFX_I2C_ADDR 1*/ 00313 00314 00315 #define CAMERA_I2C_ADDRESS ((uint16_t)0x5A) 00316 #define AUDIO_I2C_ADDRESS ((uint16_t)0x34) 00317 #define EEPROM_I2C_ADDRESS_A01 ((uint16_t)0xA0) 00318 #define EEPROM_I2C_ADDRESS_A02 ((uint16_t)0xA6) 00319 00320 00321 /* User can use this section to tailor I2Cx/I2Cx instance used and associated 00322 resources */ 00323 /* Definition for I2Cx clock resources */ 00324 #define EVAL_I2Cx FMPI2C1 00325 #define EVAL_I2Cx_CLK_ENABLE() __HAL_RCC_FMPI2C1_CLK_ENABLE() 00326 #define EVAL_I2Cx_CLK_DISABLE() __HAL_RCC_FMPI2C1_CLK_DISABLE() 00327 #define EVAL_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00328 #define EVAL_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00329 #define EVAL_I2Cx_SCL_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() 00330 00331 #define EVAL_I2Cx_FORCE_RESET() __HAL_RCC_FMPI2C1_FORCE_RESET() 00332 #define EVAL_I2Cx_RELEASE_RESET() __HAL_RCC_FMPI2C1_RELEASE_RESET() 00333 00334 /* Definition for I2Cx Pins */ 00335 #define EVAL_I2Cx_SCL_PIN GPIO_PIN_12 00336 #define EVAL_I2Cx_SCL_SDA_GPIO_PORT GPIOD 00337 #define EVAL_I2Cx_SCL_SDA_AF GPIO_AF4_FMPI2C1 00338 #define EVAL_I2Cx_SDA_PIN GPIO_PIN_13 00339 00340 /* I2C interrupt requests */ 00341 #define EVAL_I2Cx_EV_IRQn FMPI2C1_EV_IRQn 00342 #define EVAL_I2Cx_ER_IRQn FMPI2C1_ER_IRQn 00343 00344 #ifndef EVAL_I2Cx_TIMING 00345 #define EVAL_I2Cx_TIMING ((uint32_t)0x00805252) 00346 #endif /* EVAL_I2Cx_TIMING */ 00347 00348 00349 /** 00350 * @} 00351 */ 00352 00353 /** 00354 * @} 00355 */ 00356 00357 /** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Macros STM32446E EVAL LOW LEVEL Exported Macros 00358 * @{ 00359 */ 00360 /** 00361 * @} 00362 */ 00363 00364 /** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Functions STM32446E EVAL LOW LEVEL Exported Functions 00365 * @{ 00366 */ 00367 uint32_t BSP_GetVersion(void); 00368 void BSP_LED_Init(Led_TypeDef Led); 00369 void BSP_LED_DeInit(Led_TypeDef Led); 00370 void BSP_LED_On(Led_TypeDef Led); 00371 void BSP_LED_Off(Led_TypeDef Led); 00372 void BSP_LED_Toggle(Led_TypeDef Led); 00373 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); 00374 void BSP_PB_DeInit(Button_TypeDef Button); 00375 uint32_t BSP_PB_GetState(Button_TypeDef Button); 00376 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); 00377 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); 00378 #if defined(USE_IOEXPANDER) 00379 uint8_t BSP_JOY_Init(JOYMode_TypeDef JoyMode); 00380 void BSP_JOY_DeInit(void); 00381 JOYState_TypeDef BSP_JOY_GetState(void); 00382 void BSP_MFX_reg_access_for_debug(void); 00383 #endif /* USE_IOEXPANDER */ 00384 00385 /** 00386 * @} 00387 */ 00388 00389 /** 00390 * @} 00391 */ 00392 00393 /** 00394 * @} 00395 */ 00396 00397 /** 00398 * @} 00399 */ 00400 00401 #ifdef __cplusplus 00402 } 00403 #endif 00404 00405 #endif /* __STM32446E_EVAL_H */ 00406 00407 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Jan 15 2016 10:06:21 for STM32446E_EVAL BSP User Manual by 1.7.6.1