STM32H743I_EVAL BSP User Manual: stm32h743i_eval.h Source File

STM32H743I_EVAL BSP

stm32h743i_eval.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h743i_eval.h
00004   * @author  MCD Application Team
00005   * @version V1.0.0
00006   * @date    21-April-2017
00007   * @brief   This file contains definitions for STM32H743I_EVAL LEDs,
00008   *          push-buttons and COM ports hardware resources.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; 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 __STM32H743I_EVAL_H
00041 #define __STM32H743I_EVAL_H
00042 
00043 #ifdef __cplusplus
00044  extern "C" {
00045 #endif
00046 
00047 /* Includes ------------------------------------------------------------------*/
00048 #include "stm32h7xx_hal.h"
00049 
00050 /** @addtogroup BSP
00051   * @{
00052   */
00053 
00054 /** @addtogroup STM32H743I_EVAL
00055   * @{
00056   */
00057 
00058 /** @defgroup STM32H743I_EVAL_LOW_LEVEL LOW LEVEL
00059   * @{
00060   */
00061 
00062 /** @defgroup STM32H743I_EVAL_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
00063   * @{
00064   */
00065 typedef enum
00066 {
00067 #if defined(USE_IOEXPANDER)
00068 LED1 = 0,
00069 LED_GREEN = LED1,
00070 LED2 = 1,
00071 LED_ORANGE = LED2,
00072 LED3 = 2,
00073 LED_RED = LED3,
00074 LED4 = 3,
00075 LED_BLUE = LED4
00076 #else
00077 LED1 = 0,
00078 LED_GREEN = LED1,
00079 LED3 = 1,
00080 LED_RED = LED3,
00081 #endif /* USE_IOEXPANDER */
00082 }Led_TypeDef;
00083 
00084 typedef enum
00085 {
00086   BUTTON_WAKEUP = 0,
00087   BUTTON_TAMPER = 1,
00088   BUTTON_KEY = 2
00089 }Button_TypeDef;
00090 
00091 typedef enum
00092 {
00093   BUTTON_MODE_GPIO = 0,
00094   BUTTON_MODE_EXTI = 1
00095 }ButtonMode_TypeDef;
00096 
00097 #if defined(USE_IOEXPANDER)
00098 typedef enum
00099 {
00100   JOY_MODE_GPIO = 0,
00101   JOY_MODE_EXTI = 1
00102 }JOYMode_TypeDef;
00103 
00104 typedef enum
00105 {
00106   JOY_NONE  = 0,
00107   JOY_SEL   = 1,
00108   JOY_DOWN  = 2,
00109   JOY_LEFT  = 3,
00110   JOY_RIGHT = 4,
00111   JOY_UP    = 5
00112 }JOYState_TypeDef;
00113 #endif /* USE_IOEXPANDER */
00114 
00115 typedef enum
00116 {
00117   COM1 = 0,
00118   COM2 = 1
00119 }COM_TypeDef;
00120 /**
00121   * @}
00122   */
00123 
00124 /** @defgroup STM32H743I_EVAL_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
00125   * @{
00126   */
00127 
00128 /**
00129   * @brief  Define for STM32H743I_EVAL board
00130   */
00131 #if !defined (USE_STM32H743I_EVAL)
00132  #define USE_STM32H743I_EVAL
00133 #endif
00134 
00135 /** @addtogroup STM32H743I_EVAL_LOW_LEVEL_LED
00136   * @{
00137   */
00138 #if defined(USE_IOEXPANDER)
00139 #define LEDn                             ((uint32_t)4)
00140 #define LED2_PIN                         IO_PIN_10
00141 #define LED4_PIN                         IO_PIN_11
00142 #else
00143 #define LEDn                             ((uint8_t)2)
00144 #endif /* USE_IOEXPANDER */
00145 
00146 #define LED1_GPIO_PORT                   GPIOF
00147 #define LED1_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOF_CLK_ENABLE()
00148 #define LED1_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOF_CLK_DISABLE()
00149 #define LED1_PIN                         GPIO_PIN_10
00150 
00151 #define LED3_GPIO_PORT                   GPIOA
00152 #define LED3_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOA_CLK_ENABLE()
00153 #define LED3_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOA_CLK_DISABLE()
00154 #define LED3_PIN                         GPIO_PIN_4
00155 
00156 /**
00157   * @}
00158   */
00159 
00160 /**
00161   * @brief MFX_IRQOUt pin
00162   */
00163 #define MFX_IRQOUT_PIN                    GPIO_PIN_8
00164 #define MFX_IRQOUT_GPIO_PORT              GPIOI
00165 #define MFX_IRQOUT_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOI_CLK_ENABLE()
00166 #define MFX_IRQOUT_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOI_CLK_DISABLE()
00167 #define MFX_IRQOUT_EXTI_IRQn              EXTI9_5_IRQn
00168 
00169 /** @addtogroup STM32H743I_EVAL_LOW_LEVEL_BUTTON
00170   * @{
00171   */
00172 /* Joystick pins are connected to IO Expander (accessible through I2C1 interface) */
00173 #define BUTTONn                             ((uint8_t)3)
00174 
00175 /**
00176   * @brief Wakeup push-button
00177   */
00178 #define WAKEUP_BUTTON_PIN                   GPIO_PIN_0
00179 #define WAKEUP_BUTTON_GPIO_PORT             GPIOA
00180 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()
00181 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()
00182 #define WAKEUP_BUTTON_EXTI_IRQn             EXTI0_IRQn
00183 
00184 /**
00185   * @brief Tamper push-button
00186   */
00187 #define TAMPER_BUTTON_PIN                    GPIO_PIN_13
00188 #define TAMPER_BUTTON_GPIO_PORT              GPIOC
00189 #define TAMPER_BUTTON_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOC_CLK_ENABLE()
00190 #define TAMPER_BUTTON_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOC_CLK_DISABLE()
00191 #define TAMPER_BUTTON_EXTI_IRQn              EXTI15_10_IRQn
00192 
00193 /**
00194   * @brief Key push-button
00195   */
00196 #define KEY_BUTTON_PIN                       GPIO_PIN_13
00197 #define KEY_BUTTON_GPIO_PORT                 GPIOC
00198 #define KEY_BUTTON_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOC_CLK_ENABLE()
00199 #define KEY_BUTTON_GPIO_CLK_DISABLE()        __HAL_RCC_GPIOC_CLK_DISABLE()
00200 #define KEY_BUTTON_EXTI_IRQn                 EXTI15_10_IRQn
00201 
00202 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == 0) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\
00203                                                    if((__INDEX__) == 1) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\
00204                                                 KEY_BUTTON_GPIO_CLK_ENABLE(); } while(0)
00205 
00206 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__)    (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\
00207                                                 ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE())
00208 /**
00209   * @}
00210   */
00211 
00212 /** @addtogroup STM32H743I_EVAL_LOW_LEVEL_COM
00213   * @{
00214   */
00215 #define COMn                             ((uint8_t)1)
00216 
00217 /**
00218  * @brief Definition for COM port1, connected to USART1
00219  */
00220 #define EVAL_COM1                          USART1
00221 #define EVAL_COM1_CLK_ENABLE()             __HAL_RCC_USART1_CLK_ENABLE()
00222 #define EVAL_COM1_CLK_DISABLE()            __HAL_RCC_USART1_CLK_DISABLE()
00223 
00224 #define EVAL_COM1_TX_PIN                   GPIO_PIN_14
00225 #define EVAL_COM1_TX_GPIO_PORT             GPIOB
00226 #define EVAL_COM1_TX_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00227 #define EVAL_COM1_TX_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOB_CLK_DISABLE()
00228 #define EVAL_COM1_TX_AF                    GPIO_AF4_USART1
00229 
00230 #define EVAL_COM1_RX_PIN                   GPIO_PIN_15
00231 #define EVAL_COM1_RX_GPIO_PORT             GPIOB
00232 #define EVAL_COM1_RX_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00233 #define EVAL_COM1_RX_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOB_CLK_DISABLE()
00234 #define EVAL_COM1_RX_AF                    GPIO_AF4_USART1
00235 
00236 #define EVAL_COM1_IRQn                     USART1_IRQn
00237 
00238 #define EVAL_COMx_CLK_ENABLE(__INDEX__)            do { if((__INDEX__) == COM1) EVAL_COM1_CLK_ENABLE(); } while(0)
00239 #define EVAL_COMx_CLK_DISABLE(__INDEX__)           (((__INDEX__) == 0) ? EVAL_COM1_CLK_DISABLE() : 0)
00240 
00241 #define EVAL_COMx_TX_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == COM1) EVAL_COM1_TX_GPIO_CLK_ENABLE(); } while(0)
00242 #define EVAL_COMx_TX_GPIO_CLK_DISABLE(__INDEX__)   (((__INDEX__) == 0) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() : 0)
00243 
00244 #define EVAL_COMx_RX_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == COM1) EVAL_COM1_RX_GPIO_CLK_ENABLE(); } while(0)
00245 #define EVAL_COMx_RX_GPIO_CLK_DISABLE(__INDEX__)   (((__INDEX__) == 0) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() : 0)
00246 
00247 /**
00248  * @brief Definition for Potentiometer, connected to ADC1
00249  */
00250 #define ADCx                            ADC1
00251 #define ADCx_CLK_ENABLE()               __HAL_RCC_ADC12_CLK_ENABLE()
00252 #define ADCx_CHANNEL_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOA_CLK_ENABLE()
00253 
00254 #define ADCx_FORCE_RESET()              __HAL_RCC_ADC12_FORCE_RESET()
00255 #define ADCx_RELEASE_RESET()            __HAL_RCC_ADC12_RELEASE_RESET()
00256 
00257 /* Definition for ADCx Channel Pin */
00258 #define ADCx_CHANNEL_PIN                GPIO_PIN_0
00259 #define ADCx_CHANNEL_GPIO_PORT          GPIOA
00260 
00261 /* Definition for ADCx's Channel */
00262 #define ADCx_CHANNEL                    ADC_CHANNEL_0
00263 #define ADCx_POLL_TIMEOUT               10
00264 
00265 #if defined(USE_IOEXPANDER)
00266 /**
00267   * @brief Joystick Pins definition
00268   */
00269 #define JOY_SEL_PIN                    IO_PIN_0
00270 #define JOY_DOWN_PIN                   IO_PIN_1
00271 #define JOY_LEFT_PIN                   IO_PIN_2
00272 #define JOY_RIGHT_PIN                  IO_PIN_3
00273 #define JOY_UP_PIN                     IO_PIN_4
00274 #define JOY_NONE_PIN                   JOY_ALL_PINS
00275 #define JOY_ALL_PINS                   (IO_PIN_0 | IO_PIN_1 | IO_PIN_2 | IO_PIN_3 | IO_PIN_4)
00276 
00277 /**
00278   * @brief Eval Pins definition connected to MFX
00279   */
00280 #define TS_INT_PIN                     IO_PIN_14
00281 
00282 /**
00283   * @brief Eval Pins definition connected to MFX
00284   */
00285 
00286 #define XSDN_PIN                       IO_PIN_10
00287 #define SD_LDO_SEL_PIN                 IO_PIN_13
00288 #define RSTI_PIN                       IO_PIN_11
00289 #define CAM_PLUG_PIN                   IO_PIN_12
00290 #define LCD_INT_PIN                    IO_PIN_14
00291 #define AUDIO_INT_PIN                  IO_PIN_5
00292 #define OTG_FS1_OVER_CURRENT_PIN       IO_PIN_6
00293 #define OTG_FS1_POWER_SWITCH_PIN       IO_PIN_7
00294 #define OTG_FS2_OVER_CURRENT_PIN       IO_PIN_8
00295 #define OTG_FS2_POWER_SWITCH_PIN       IO_PIN_9
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 #define IO_I2C_ADDRESS                   ((uint16_t)0x84)  /*mfx MFX_I2C_ADDR 0*/
00309 #define IO_I2C_ADDRESS_2                 ((uint16_t)0x86)  /*mfx MFX_I2C_ADDR 1*/
00310 #define TS_I2C_ADDRESS                   ((uint16_t)0x82)  /*stmpe811 used on MB1046 board */
00311 #define TS3510_I2C_ADDRESS               ((uint16_t)0x80)
00312 #define EXC7200_I2C_ADDRESS              ((uint16_t)0x08)
00313 #define AUDIO_I2C_ADDRESS                ((uint16_t)0x34)
00314 #define EEPROM_I2C_ADDRESS_A01           ((uint16_t)0xA0)
00315 #define EEPROM_I2C_ADDRESS_A02           ((uint16_t)0xA6)
00316 /* I2C clock speed configuration (in Hz)
00317    WARNING:
00318    Make sure that this define is not already declared in other files (ie.
00319    stm32h743i_eval.h file). It can be used in parallel by other modules. */
00320 #ifndef I2C_SPEED
00321  #define I2C_SPEED                        ((uint32_t)100000)
00322 #endif /* I2C_SPEED */
00323 
00324 /* User can use this section to tailor I2Cx/I2Cx instance used and associated
00325    resources */
00326 /* Definition for I2Cx clock resources */
00327 #define EVAL_I2Cx                             I2C1
00328 #define EVAL_I2Cx_CLK_ENABLE()                __HAL_RCC_I2C1_CLK_ENABLE()
00329 #define EVAL_DMAx_CLK_ENABLE()                __HAL_RCC_DMA1_CLK_ENABLE()
00330 #define EVAL_I2Cx_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOB_CLK_ENABLE()
00331 
00332 #define EVAL_I2Cx_FORCE_RESET()               __HAL_RCC_I2C1_FORCE_RESET()
00333 #define EVAL_I2Cx_RELEASE_RESET()             __HAL_RCC_I2C1_RELEASE_RESET()
00334 
00335 /* Definition for I2Cx Pins */
00336 #define EVAL_I2Cx_SCL_PIN                     GPIO_PIN_6
00337 #define EVAL_I2Cx_SCL_SDA_GPIO_PORT           GPIOB
00338 #define EVAL_I2Cx_SCL_SDA_AF                  GPIO_AF4_I2C1
00339 #define EVAL_I2Cx_SDA_PIN                     GPIO_PIN_7
00340 
00341 /* I2C interrupt requests */
00342 #define EVAL_I2Cx_EV_IRQn                     I2C1_EV_IRQn
00343 #define EVAL_I2Cx_ER_IRQn                     I2C1_ER_IRQn
00344 
00345 /* I2C TIMING Register define when I2C clock source is SYSCLK */
00346 /* I2C TIMING is calculated from APB1 source clock = 50 MHz */
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 /** @addtogroup STM32H743I_EVAL_LCD_TIM
00361   * @{
00362   */
00363 /**
00364  * @brief Definition for LCD Timer used to control the Brightnes
00365  */
00366 #define LCD_TIMx                           TIM3
00367 #define LCD_TIMx_CLK_ENABLE()              __HAL_RCC_TIM3_CLK_ENABLE()
00368 #define LCD_TIMx_CLK_DISABLE()             __HAL_RCC_TIM3_CLK_DISABLE()
00369 #define LCD_TIMx_CHANNEL                   TIM_CHANNEL_1
00370 #define LCD_TIMx_CHANNEL_AF                GPIO_AF2_TIM3
00371 #define LCD_TIMX_PERIOD_VALUE              ((uint32_t)50000) /* Period Value    */
00372 #define LCD_TIMX_PRESCALER_VALUE           ((uint32_t)4)     /* Prescaler Value */
00373 
00374 /**
00375   * @}
00376   */
00377 
00378 /**
00379   * @}
00380   */
00381 
00382 /** @defgroup STM32H743I_EVAL_LOW_LEVEL_Exported_Macros LOW LEVEL Exported Macros
00383   * @{
00384   */
00385 /**
00386   * @}
00387   */
00388 
00389 /** @defgroup STM32H743I_EVAL_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
00390   * @{
00391   */
00392 uint32_t         BSP_GetVersion(void);
00393 void             BSP_LED_Init(Led_TypeDef Led);
00394 void             BSP_LED_DeInit(Led_TypeDef Led);
00395 void             BSP_LED_On(Led_TypeDef Led);
00396 void             BSP_LED_Off(Led_TypeDef Led);
00397 void             BSP_LED_Toggle(Led_TypeDef Led);
00398 void             BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
00399 void             BSP_PB_DeInit(Button_TypeDef Button);
00400 uint32_t         BSP_PB_GetState(Button_TypeDef Button);
00401 void             BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
00402 void             BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
00403 void             BSP_POTENTIOMETER_Init(void);
00404 uint32_t         BSP_POTENTIOMETER_GetLevel(void);
00405 #if defined(USE_IOEXPANDER)
00406 uint8_t          BSP_JOY_Init(JOYMode_TypeDef JoyMode);
00407 void             BSP_JOY_DeInit(void);
00408 JOYState_TypeDef BSP_JOY_GetState(void);
00409 uint8_t          BSP_TS3510_IsDetected(void);
00410 #endif /* USE_IOEXPANDER */
00411 
00412 /**
00413   * @}
00414   */
00415 
00416 /**
00417   * @}
00418   */
00419 
00420 /**
00421   * @}
00422   */
00423 
00424 /**
00425   * @}
00426   */
00427 
00428 #ifdef __cplusplus
00429 }
00430 #endif
00431 
00432 #endif /* __STM32H743I_EVAL_H */
00433 
00434 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Wed Aug 23 2017 17:45:13 for STM32H743I_EVAL BSP User Manual by   doxygen 1.7.6.1