STM32756G_EVAL BSP User Manual
|
stm32756g_eval.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32756g_eval.h 00004 * @author MCD Application Team 00005 * @version V1.0.0 00006 * @date 22-May-2015 00007 * @brief This file contains definitions for STM32756G_EVAL and STM32746G_EVAL 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 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 #ifndef __STM32756G_EVAL_H 00041 #define __STM32756G_EVAL_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* USE_STM32756G_EVAL_REVA must USE USE_IOEXPANDER */ 00048 #if defined(USE_STM32756G_EVAL_REVA) 00049 #ifndef USE_IOEXPANDER 00050 #define USE_IOEXPANDER 00051 #endif /* USE_IOEXPANDER */ 00052 #endif /* USE_STM32756G_EVAL_REVA */ 00053 00054 /* Includes ------------------------------------------------------------------*/ 00055 #include "stm32f7xx_hal.h" 00056 00057 /** @addtogroup BSP 00058 * @{ 00059 */ 00060 00061 /** @addtogroup STM32756G_EVAL 00062 * @{ 00063 */ 00064 00065 /** @addtogroup STM32756G_EVAL_LOW_LEVEL 00066 * @{ 00067 */ 00068 00069 /** @defgroup STM32756G_EVAL_LOW_LEVEL_Exported_Types 00070 * @{ 00071 */ 00072 typedef enum 00073 { 00074 #if defined(USE_IOEXPANDER) 00075 LED1 = 0, 00076 LED_GREEN = LED1, 00077 LED2 = 1, 00078 LED_ORANGE = LED2, 00079 LED3 = 2, 00080 LED_RED = LED3, 00081 LED4 = 3, 00082 LED_BLUE = LED4 00083 #else 00084 LED1 = 0, 00085 LED_GREEN = LED1, 00086 LED3 = 1, 00087 LED_RED = LED3, 00088 #endif /* USE_IOEXPANDER */ 00089 }Led_TypeDef; 00090 00091 typedef enum 00092 { 00093 BUTTON_WAKEUP = 0, 00094 BUTTON_TAMPER = 1, 00095 BUTTON_KEY = 2 00096 }Button_TypeDef; 00097 00098 typedef enum 00099 { 00100 BUTTON_MODE_GPIO = 0, 00101 BUTTON_MODE_EXTI = 1 00102 }ButtonMode_TypeDef; 00103 00104 #if defined(USE_IOEXPANDER) 00105 typedef enum 00106 { 00107 JOY_MODE_GPIO = 0, 00108 JOY_MODE_EXTI = 1 00109 }JOYMode_TypeDef; 00110 00111 typedef enum 00112 { 00113 JOY_NONE = 0, 00114 JOY_SEL = 1, 00115 JOY_DOWN = 2, 00116 JOY_LEFT = 3, 00117 JOY_RIGHT = 4, 00118 JOY_UP = 5 00119 }JOYState_TypeDef; 00120 #endif /* USE_IOEXPANDER */ 00121 00122 typedef enum 00123 { 00124 COM1 = 0, 00125 COM2 = 1 00126 }COM_TypeDef; 00127 /** 00128 * @} 00129 */ 00130 00131 /** @defgroup STM32756G_EVAL_LOW_LEVEL_Exported_Constants 00132 * @{ 00133 */ 00134 00135 /** 00136 * @brief Define for STM32756G_EVAL board 00137 */ 00138 #if !defined (USE_STM32756G_EVAL) 00139 #define USE_STM32756G_EVAL 00140 #endif 00141 00142 /** @addtogroup STM32756G_EVAL_LOW_LEVEL_LED 00143 * @{ 00144 */ 00145 00146 #if !defined(USE_STM32756G_EVAL_REVA) 00147 00148 #if defined(USE_IOEXPANDER) 00149 #define LEDn ((uint8_t)4) 00150 #define LED2_PIN IO_PIN_17 00151 #define LED4_PIN IO_PIN_19 00152 #else 00153 #define LEDn ((uint8_t)2) 00154 #endif /* USE_IOEXPANDER */ 00155 00156 #define LED1_GPIO_PORT GPIOF 00157 #define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE() 00158 #define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE() 00159 #define LED1_PIN GPIO_PIN_10 /* To use LED1, ensure that JP24 is in position 2-3, potentiometer is then no more usable */ 00160 00161 #define LED3_GPIO_PORT GPIOB 00162 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00163 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00164 #define LED3_PIN GPIO_PIN_7 /* To use LED3, ensure that JP23 is in position 2-3, camera is then no more usable */ 00165 00166 #else 00167 00168 #define LEDn ((uint8_t)4) 00169 #define LED1_PIN IO_PIN_16 00170 #define LED2_PIN IO_PIN_17 00171 #define LED3_PIN IO_PIN_18 00172 #define LED4_PIN IO_PIN_19 00173 00174 #endif /* !USE_STM32756G_EVAL_REVA */ 00175 00176 /** 00177 * @} 00178 */ 00179 00180 /** 00181 * @brief MFX_IRQOUt pin 00182 */ 00183 #define MFX_IRQOUT_PIN GPIO_PIN_8 00184 #define MFX_IRQOUT_GPIO_PORT GPIOI 00185 #define MFX_IRQOUT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00186 #define MFX_IRQOUT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00187 #define MFX_IRQOUT_EXTI_IRQn EXTI9_5_IRQn 00188 00189 /** @addtogroup STM32756G_EVAL_LOW_LEVEL_BUTTON 00190 * @{ 00191 */ 00192 /* Joystick pins are connected to IO Expander (accessible through I2C1 interface) */ 00193 #define BUTTONn ((uint8_t)3) 00194 00195 /** 00196 * @brief Wakeup push-button 00197 */ 00198 #define WAKEUP_BUTTON_PIN GPIO_PIN_13 00199 #define WAKEUP_BUTTON_GPIO_PORT GPIOC 00200 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00201 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00202 #define WAKEUP_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00203 00204 /** 00205 * @brief Tamper push-button 00206 */ 00207 #define TAMPER_BUTTON_PIN GPIO_PIN_13 00208 #define TAMPER_BUTTON_GPIO_PORT GPIOC 00209 #define TAMPER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00210 #define TAMPER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00211 #define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00212 00213 /** 00214 * @brief Key push-button 00215 */ 00216 #define KEY_BUTTON_PIN GPIO_PIN_13 00217 #define KEY_BUTTON_GPIO_PORT GPIOC 00218 #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00219 #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00220 #define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00221 00222 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\ 00223 if((__INDEX__) == 1) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\ 00224 KEY_BUTTON_GPIO_CLK_ENABLE(); } while(0) 00225 00226 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\ 00227 ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE()) 00228 /** 00229 * @} 00230 */ 00231 00232 /** @addtogroup STM32756G_EVAL_LOW_LEVEL_COM 00233 * @{ 00234 */ 00235 #define COMn ((uint8_t)1) 00236 00237 /** 00238 * @brief Definition for COM port1, connected to USART1 00239 */ 00240 #define EVAL_COM1 USART1 00241 #define EVAL_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE() 00242 #define EVAL_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE() 00243 00244 #define EVAL_COM1_TX_PIN GPIO_PIN_9 00245 #define EVAL_COM1_TX_GPIO_PORT GPIOA 00246 #define EVAL_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00247 #define EVAL_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00248 #define EVAL_COM1_TX_AF GPIO_AF7_USART1 00249 00250 #define EVAL_COM1_RX_PIN GPIO_PIN_10 00251 #define EVAL_COM1_RX_GPIO_PORT GPIOA 00252 #define EVAL_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00253 #define EVAL_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00254 #define EVAL_COM1_RX_AF GPIO_AF7_USART1 00255 00256 #define EVAL_COM1_IRQn USART1_IRQn 00257 00258 #define EVAL_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_CLK_ENABLE(); } while(0) 00259 #define EVAL_COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_CLK_DISABLE() : 0) 00260 00261 #define EVAL_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_TX_GPIO_CLK_ENABLE(); } while(0) 00262 #define EVAL_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() : 0) 00263 00264 #define EVAL_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_RX_GPIO_CLK_ENABLE(); } while(0) 00265 #define EVAL_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() : 0) 00266 00267 /** 00268 * @brief Joystick Pins definition 00269 */ 00270 #if defined(USE_IOEXPANDER) 00271 #define JOY_SEL_PIN IO_PIN_0 00272 #define JOY_DOWN_PIN IO_PIN_1 00273 #define JOY_LEFT_PIN IO_PIN_2 00274 #define JOY_RIGHT_PIN IO_PIN_3 00275 #define JOY_UP_PIN IO_PIN_4 00276 #define JOY_NONE_PIN JOY_ALL_PINS 00277 #define JOY_ALL_PINS (IO_PIN_0 | IO_PIN_1 | IO_PIN_2 | IO_PIN_3 | IO_PIN_4) 00278 #endif /* USE_IOEXPANDER */ 00279 /** 00280 * @brief Eval Pins definition connected to MFX 00281 */ 00282 00283 #if defined(USE_IOEXPANDER) 00284 #define XSDN_PIN IO_PIN_10 00285 #define MII_INT_PIN IO_PIN_13 00286 #define RSTI_PIN IO_PIN_11 00287 #define CAM_PLUG_PIN IO_PIN_12 00288 #define LCD_INT_PIN IO_PIN_14 00289 #define AUDIO_INT_PIN IO_PIN_5 00290 #define OTG_FS1_OVER_CURRENT_PIN IO_PIN_6 00291 #define OTG_FS1_POWER_SWITCH_PIN IO_PIN_7 00292 #define OTG_FS2_OVER_CURRENT_PIN IO_PIN_8 00293 #define OTG_FS2_POWER_SWITCH_PIN IO_PIN_9 00294 #define SD_DETECT_PIN IO_PIN_15 00295 00296 #endif /* USE_IOEXPANDER */ 00297 00298 00299 /* Exported constant IO ------------------------------------------------------*/ 00300 00301 /* The MFX_I2C_ADDR input pin selects the MFX I2C device address 00302 MFX_I2C_ADDR input pin MFX I2C device address 00303 0 b: 1000 010x (0x84) 00304 1 b: 1000 011x (0x86) 00305 This input is sampled during the MFX firmware startup. */ 00306 #define IO_I2C_ADDRESS ((uint16_t)0x84) /*mfx MFX_I2C_ADDR 0*/ 00307 #define IO_I2C_ADDRESS_2 ((uint16_t)0x86) /*mfx MFX_I2C_ADDR 1*/ 00308 #define TS_I2C_ADDRESS ((uint16_t)0x82) /*stmpe811 used on MB1046 board */ 00309 #define TS3510_I2C_ADDRESS ((uint16_t)0x80) 00310 #define EXC7200_I2C_ADDRESS ((uint16_t)0x08) 00311 #define CAMERA_I2C_ADDRESS ((uint16_t)0x5A) 00312 #define AUDIO_I2C_ADDRESS ((uint16_t)0x34) 00313 #define EEPROM_I2C_ADDRESS_A01 ((uint16_t)0xA0) 00314 #define EEPROM_I2C_ADDRESS_A02 ((uint16_t)0xA6) 00315 /* I2C clock speed configuration (in Hz) 00316 WARNING: 00317 Make sure that this define is not already declared in other files (ie. 00318 stm32756G_eval.h file). It can be used in parallel by other modules. */ 00319 #ifndef I2C_SPEED 00320 #define I2C_SPEED ((uint32_t)100000) 00321 #endif /* I2C_SPEED */ 00322 00323 /* User can use this section to tailor I2Cx/I2Cx instance used and associated 00324 resources */ 00325 /* Definition for I2Cx clock resources */ 00326 #define EVAL_I2Cx I2C1 00327 #define EVAL_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE() 00328 #define EVAL_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00329 #define EVAL_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00330 00331 #define EVAL_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET() 00332 #define EVAL_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET() 00333 00334 /* Definition for I2Cx Pins */ 00335 #define EVAL_I2Cx_SCL_PIN GPIO_PIN_8 00336 #define EVAL_I2Cx_SCL_SDA_GPIO_PORT GPIOB 00337 #define EVAL_I2Cx_SCL_SDA_AF GPIO_AF4_I2C1 00338 #define EVAL_I2Cx_SDA_PIN GPIO_PIN_9 00339 00340 /* I2C interrupt requests */ 00341 #define EVAL_I2Cx_EV_IRQn I2C1_EV_IRQn 00342 #define EVAL_I2Cx_ER_IRQn I2C1_ER_IRQn 00343 00344 /* I2C TIMING Register define when I2C clock source is SYSCLK */ 00345 /* I2C TIMING is calculated from APB1 source clock = 50 MHz */ 00346 /* Due to the big MOFSET capacity for adapting the camera level the rising time is very large (>1us) */ 00347 /* 0x40912732 takes in account the big rising and aims a clock of 100khz */ 00348 /* this value might be adapted when next Rev Birdie board is available */ 00349 #ifndef EVAL_I2Cx_TIMING 00350 #define EVAL_I2Cx_TIMING ((uint32_t)0x40912732) 00351 #endif /* EVAL_I2Cx_TIMING */ 00352 00353 /** 00354 * @} 00355 */ 00356 00357 /** 00358 * @} 00359 */ 00360 00361 /** @defgroup STM32756G_EVAL_LOW_LEVEL_Exported_Macros 00362 * @{ 00363 */ 00364 /** 00365 * @} 00366 */ 00367 00368 /** @defgroup STM32756G_EVAL_LOW_LEVEL_Exported_Functions 00369 * @{ 00370 */ 00371 uint32_t BSP_GetVersion(void); 00372 void BSP_LED_Init(Led_TypeDef Led); 00373 void BSP_LED_DeInit(Led_TypeDef Led); 00374 void BSP_LED_On(Led_TypeDef Led); 00375 void BSP_LED_Off(Led_TypeDef Led); 00376 void BSP_LED_Toggle(Led_TypeDef Led); 00377 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); 00378 void BSP_PB_DeInit(Button_TypeDef Button); 00379 uint32_t BSP_PB_GetState(Button_TypeDef Button); 00380 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); 00381 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); 00382 #if defined(USE_IOEXPANDER) 00383 uint8_t BSP_JOY_Init(JOYMode_TypeDef JoyMode); 00384 void BSP_JOY_DeInit(void); 00385 JOYState_TypeDef BSP_JOY_GetState(void); 00386 uint8_t BSP_TS3510_IsDetected(void); 00387 #endif /* USE_IOEXPANDER */ 00388 00389 /** 00390 * @} 00391 */ 00392 00393 /** 00394 * @} 00395 */ 00396 00397 /** 00398 * @} 00399 */ 00400 00401 /** 00402 * @} 00403 */ 00404 00405 #ifdef __cplusplus 00406 } 00407 #endif 00408 00409 #endif /* __STM32756G_EVAL_H */ 00410 00411 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri May 22 2015 13:59:20 for STM32756G_EVAL BSP User Manual by 1.7.6.1