BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32h747i_discovery.h Source File

stm32h747i_discovery.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h747i_discovery.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains definitions for STM32H747I-Discovery LEDs,
00006   *          push-buttons hardware resources.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
00011   * All rights reserved.</center></h2>
00012   *
00013   * This software component is licensed by ST under BSD 3-Clause license,
00014   * the "License"; You may not use this file except in compliance with the
00015   * License. You may obtain a copy of the License at:
00016   *                        opensource.org/licenses/BSD-3-Clause
00017   *
00018   ******************************************************************************
00019   */
00020 
00021 /* Define to prevent recursive inclusion -------------------------------------*/
00022 #ifndef __STM32H747I_DISCOVERY_H
00023 #define __STM32H747I_DISCOVERY_H
00024 
00025 #ifdef __cplusplus
00026  extern "C" {
00027 #endif
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include "stm32h7xx_hal.h"
00031 #if defined(BSP_USE_CMSIS_OS)
00032 #include "cmsis_os.h"
00033 #endif
00034 
00035 /** @addtogroup BSP
00036   * @{
00037   */
00038 
00039 /** @addtogroup STM32H747I_DISCOVERY
00040   * @{
00041   */
00042 
00043 /** @addtogroup STM32H747I_DISCOVERY_LOW_LEVEL
00044   * @{
00045   */
00046 
00047 /** @defgroup STM32H747I_DISCOVERY_LOW_LEVEL_Exported_Types Exported Types
00048  * @{
00049  */
00050 
00051 /** @brief Led_TypeDef
00052   *  STM32H747I_DISCOVERY board leds definitions.
00053   */
00054 typedef enum
00055 {
00056   DISCO_LED1 = 0,
00057   LED_GREEN = DISCO_LED1,
00058   DISCO_LED2 = 1,
00059   LED_ORANGE = DISCO_LED2,
00060   DISCO_LED3 = 2,
00061   LED_RED = DISCO_LED3,
00062   DISCO_LED4 = 3,
00063   LED_BLUE = DISCO_LED4
00064 } Led_TypeDef;
00065 
00066 /** @brief Button_TypeDef
00067   *  STM32H747I_DISCOVERY board Buttons definitions.
00068   */
00069 typedef enum
00070 {
00071   BUTTON_WAKEUP = 0,
00072 } Button_TypeDef;
00073 
00074 #define BUTTON_USER BUTTON_WAKEUP
00075 
00076 /** @brief ButtonMode_TypeDef
00077   *  STM32H747I_DISCOVERY board Buttons Modes definitions.
00078   */
00079 typedef enum
00080 {
00081   BUTTON_MODE_GPIO = 0,
00082   BUTTON_MODE_EXTI = 1
00083 } ButtonMode_TypeDef;
00084 
00085 
00086 typedef enum
00087 {
00088   PB_SET = 0,
00089   PB_RESET = !PB_SET
00090 } ButtonValue_TypeDef;
00091 
00092 typedef enum
00093 {
00094   JOY_MODE_GPIO = 0,
00095   JOY_MODE_EXTI = 1
00096 } JOYMode_TypeDef;
00097 
00098 typedef enum
00099 {
00100   JOY_SEL   = 0,
00101   JOY_DOWN  = 1,
00102   JOY_LEFT  = 2,
00103   JOY_RIGHT = 3,
00104   JOY_UP    = 4,
00105   JOY_NONE  = 5
00106 } JOYState_TypeDef;
00107 
00108 /** @brief DISCO_Status_TypeDef
00109   *  STM32H747I_DISCO board Status return possible values.
00110   */
00111 typedef enum
00112 {
00113   DISCO_OK    = 0,
00114   DISCO_ERROR = 1
00115 } DISCO_Status_TypeDef;
00116 
00117 /**
00118   * @}
00119   */
00120 
00121 /** @defgroup STM32H747I_DISCOVERY_LOW_LEVEL_Exported_Constants Exported Constants
00122   * @{
00123   */
00124 
00125 /**
00126   * @brief  Define for STM32H747I_DISCOVERY board
00127   */
00128 #if !defined (USE_STM32H747I_DISCO)
00129  #define USE_STM32H747I_DISCO
00130 #endif
00131 
00132 #define LEDn                             ((uint32_t)4)
00133 
00134 #define LED1_GPIO_PORT                   GPIOI
00135 #define LED1_PIN                         GPIO_PIN_12
00136 
00137 #define LED2_GPIO_PORT                   GPIOI
00138 #define LED2_PIN                         GPIO_PIN_13
00139 
00140 #define LED3_GPIO_PORT                   GPIOI
00141 #define LED3_PIN                         GPIO_PIN_14
00142 
00143 #define LED4_GPIO_PORT                   GPIOI
00144 #define LED4_PIN                         GPIO_PIN_15
00145 
00146 #define LEDx_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOI_CLK_ENABLE()
00147 #define LEDx_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOI_CLK_DISABLE()
00148 
00149 /* Only one User/Wakeup button */
00150 #define BUTTONn                             ((uint8_t)1)
00151 
00152 /**
00153   * @brief Wakeup push-button
00154   */
00155 #define WAKEUP_BUTTON_PIN                   GPIO_PIN_13
00156 #define WAKEUP_BUTTON_GPIO_PORT             GPIOC
00157 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOC_CLK_ENABLE()
00158 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOC_CLK_DISABLE()
00159 #define WAKEUP_BUTTON_EXTI_IRQn             EXTI15_10_IRQn
00160 
00161 /* Define the USER button as an alias of the Wakeup button */
00162 #define USER_BUTTON_PIN                   WAKEUP_BUTTON_PIN
00163 #define USER_BUTTON_GPIO_PORT             WAKEUP_BUTTON_GPIO_PORT
00164 #define USER_BUTTON_GPIO_CLK_ENABLE()     WAKEUP_BUTTON_GPIO_CLK_ENABLE()
00165 #define USER_BUTTON_GPIO_CLK_DISABLE()    WAKEUP_BUTTON_GPIO_CLK_DISABLE()
00166 #define USER_BUTTON_EXTI_IRQn             WAKEUP_BUTTON_EXTI_IRQn
00167 
00168 #define BUTTON_GPIO_CLK_ENABLE()            __HAL_RCC_GPIOC_CLK_ENABLE()
00169 
00170 #define JOYn                              ((uint8_t)5)
00171 
00172 /**
00173  * @brief Joystick Selection push-button
00174  */
00175 #define SEL_JOY_PIN                       GPIO_PIN_2
00176 #define SEL_JOY_GPIO_PORT                 GPIOK
00177 #define SEL_JOY_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOK_CLK_ENABLE()
00178 #define SEL_JOY_GPIO_CLK_DISABLE()        __HAL_RCC_GPIOK_CLK_DISABLE()
00179 #define SEL_JOY_EXTI_IRQn                 EXTI2_IRQn
00180 
00181 /**
00182 * @brief Joystick Down push-button
00183 */
00184 #define DOWN_JOY_PIN                      GPIO_PIN_3
00185 #define DOWN_JOY_GPIO_PORT                GPIOK
00186 #define DOWN_JOY_GPIO_CLK_ENABLE()        __HAL_RCC_GPIOK_CLK_ENABLE()
00187 #define DOWN_JOY_GPIO_CLK_DISABLE()       __HAL_RCC_GPIOK_CLK_DISABLE()
00188 #define DOWN_JOY_EXTI_IRQn                EXTI3_IRQn
00189 
00190 /**
00191 * @brief Joystick Left push-button
00192 */
00193 #define LEFT_JOY_PIN                      GPIO_PIN_4
00194 #define LEFT_JOY_GPIO_PORT                GPIOK
00195 #define LEFT_JOY_GPIO_CLK_ENABLE()        __HAL_RCC_GPIOK_CLK_ENABLE()
00196 #define LEFT_JOY_GPIO_CLK_DISABLE()       __HAL_RCC_GPIOK_CLK_DISABLE()
00197 #define LEFT_JOY_EXTI_IRQn                EXTI4_IRQn
00198 
00199 /**
00200  * @brief Joystick Right push-button
00201  */
00202 #define RIGHT_JOY_PIN                     GPIO_PIN_5
00203 #define RIGHT_JOY_GPIO_PORT               GPIOK
00204 #define RIGHT_JOY_GPIO_CLK_ENABLE()       __HAL_RCC_GPIOK_CLK_ENABLE()
00205 #define RIGHT_JOY_GPIO_CLK_DISABLE()      __HAL_RCC_GPIOK_CLK_DISABLE()
00206 #define RIGHT_JOY_EXTI_IRQn               EXTI9_5_IRQn
00207 
00208 /**
00209 * @brief Joystick Up push-button
00210 */
00211 #define UP_JOY_PIN                        GPIO_PIN_6
00212 #define UP_JOY_GPIO_PORT                  GPIOK
00213 #define UP_JOY_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOK_CLK_ENABLE()
00214 #define UP_JOY_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOK_CLK_DISABLE()
00215 #define UP_JOY_EXTI_IRQn                  EXTI9_5_IRQn
00216 
00217 #define JOYx_GPIO_CLK_ENABLE(__JOY__)     do { if((__JOY__) == JOY_SEL)   { SEL_JOY_GPIO_CLK_ENABLE();   } else \
00218                                                if((__JOY__) == JOY_DOWN)  { DOWN_JOY_GPIO_CLK_ENABLE();  } else \
00219                                                if((__JOY__) == JOY_LEFT)  { LEFT_JOY_GPIO_CLK_ENABLE();  } else \
00220                                                if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_ENABLE(); } else \
00221                                                if((__JOY__) == JOY_UP)    { UP_JOY_GPIO_CLK_ENABLE(); }  } while(0)
00222 
00223 #define JOYx_GPIO_CLK_DISABLE(__JOY__)    do { if((__JOY__) == JOY_SEL)   { SEL_JOY_GPIO_CLK_DISABLE();   } else \
00224                                                if((__JOY__) == JOY_DOWN)  { DOWN_JOY_GPIO_CLK_DISABLE();  } else \
00225                                                if((__JOY__) == JOY_LEFT)  { LEFT_JOY_GPIO_CLK_DISABLE();  } else \
00226                                                if((__JOY__) == JOY_RIGHT) { RIGHT_JOY_GPIO_CLK_DISABLE(); } else \
00227                                                if((__JOY__) == JOY_UP)    { UP_JOY_GPIO_CLK_DISABLE(); }  } while(0)
00228 
00229 #define JOY_ALL_PINS                      (RIGHT_JOY_PIN | LEFT_JOY_PIN | UP_JOY_PIN | DOWN_JOY_PIN | SEL_JOY_PIN)
00230 
00231 
00232 /**
00233   * @brief USB OTG HS Over Current signal
00234   */
00235 #define OTG_HS_OVER_CURRENT_PIN                  GPIO_PIN_1
00236 #define OTG_HS_OVER_CURRENT_PORT                 GPIOJ
00237 #define OTG_HS_OVER_CURRENT_PORT_CLK_ENABLE()    __HAL_RCC_GPIOJ_CLK_ENABLE()
00238 
00239 /**
00240   * @brief SD-detect signal
00241   */
00242 #define SD_DETECT_PIN                        ((uint32_t)GPIO_PIN_8)
00243 #define SD_DETECT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOI)
00244 #define SD_DETECT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOI_CLK_ENABLE()
00245 #define SD_DETECT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOI_CLK_DISABLE()
00246 #define SD_DETECT_EXTI_IRQn                  EXTI9_5_IRQn
00247 
00248 /**
00249   * @brief TS_INT signal from TouchScreen when it is configured in interrupt mode
00250   * GPIOI13 is used for that purpose on Manta Dragon Discovery board
00251   */
00252 #define TS_INT_PIN                        ((uint32_t)GPIO_PIN_7)
00253 #define TS_INT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOK)
00254 #define TS_INT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOK_CLK_ENABLE()
00255 #define TS_INT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOK_CLK_DISABLE()
00256 #define TS_INT_EXTI_IRQn                  EXTI9_5_IRQn
00257 
00258 /**
00259   * @brief TouchScreen FT6206 Slave I2C address 1
00260   */
00261 #define TS_I2C_ADDRESS                   ((uint16_t)0x54)
00262 
00263 /**
00264   * @brief TouchScreen FT6336G Slave I2C address 2
00265   */
00266 #define TS_I2C_ADDRESS_A02               ((uint16_t)0x70)
00267 
00268 /**
00269   * @brief LCD DSI Slave I2C address 1
00270   */
00271 #define LCD_DSI_ADDRESS                  TS_I2C_ADDRESS
00272 
00273 /**
00274   * @brief LCD DSI Slave I2C address 2
00275   */
00276 #define LCD_DSI_ADDRESS_A02              TS_I2C_ADDRESS_A02
00277 
00278 /**
00279   * @brief Audio I2C Slave address
00280   */
00281 #define AUDIO_I2C_ADDRESS                ((uint16_t)0x34)
00282 
00283 #define CAMERA_I2C_ADDRESS               ((uint16_t)0x60)
00284 
00285 /**
00286   * @brief User can use this section to tailor I2C4/I2C4 instance used and associated
00287   * resources (audio codec).
00288   * Definition for I2C4 clock resources
00289   */
00290 #define DISCOVERY_I2Cx                             I2C4
00291 #define DISCOVERY_I2Cx_CLK_ENABLE()                __HAL_RCC_I2C4_CLK_ENABLE()
00292 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOD_CLK_ENABLE()
00293 
00294 #define DISCOVERY_I2Cx_FORCE_RESET()               __HAL_RCC_I2C4_FORCE_RESET()
00295 #define DISCOVERY_I2Cx_RELEASE_RESET()             __HAL_RCC_I2C4_RELEASE_RESET()
00296 
00297 /** @brief Definition for I2C4 Pins
00298   */
00299 #define DISCOVERY_I2Cx_SCL_PIN                     GPIO_PIN_12 /*!< PD12 */
00300 #define DISCOVERY_I2Cx_SDA_PIN                     GPIO_PIN_13 /*!< PD13 */
00301 #define DISCOVERY_I2Cx_SCL_SDA_AF                  GPIO_AF4_I2C4
00302 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT           GPIOD
00303 /** @brief Definition of I2C4 interrupt requests
00304   */
00305 #define DISCOVERY_I2Cx_EV_IRQn                     I2C4_EV_IRQn
00306 #define DISCOVERY_I2Cx_ER_IRQn                     I2C4_ER_IRQn
00307 
00308 /* I2C TIMING Register define when I2C clock source is SYSCLK */
00309 /* I2C TIMING is calculated from APB1 source clock = 50 MHz */
00310 /* Due to the big MOFSET capacity for adapting the camera level the rising time is very large (>1us) */
00311 /* 0x40912732 takes in account the big rising and aims a clock of 100khz */
00312 #ifndef DISCOVERY_I2Cx_TIMING
00313 #define DISCOVERY_I2Cx_TIMING                      ((uint32_t)0x40912732)
00314 #endif /* DISCOVERY_I2Cx_TIMING */
00315 
00316 /**
00317   * @}
00318   */
00319 
00320 
00321 /** @addtogroup STM32H747I_DISCOVERY_LOW_LEVEL_Exported_Functions
00322   * @{
00323   */
00324 uint32_t         BSP_GetVersion(void);
00325 void             BSP_LED_Init(Led_TypeDef Led);
00326 void             BSP_LED_DeInit(Led_TypeDef Led);
00327 void             BSP_LED_On(Led_TypeDef Led);
00328 void             BSP_LED_Off(Led_TypeDef Led);
00329 void             BSP_LED_Toggle(Led_TypeDef Led);
00330 void             BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
00331 void             BSP_PB_DeInit(Button_TypeDef Button);
00332 uint32_t         BSP_PB_GetState(Button_TypeDef Button);
00333 uint8_t          BSP_JOY_Init(JOYMode_TypeDef Joy_Mode);
00334 void             BSP_JOY_DeInit(void);
00335 JOYState_TypeDef BSP_JOY_GetState(void);
00336 void             BSP_ErrorNotify(void);
00337 
00338 /**
00339   * @}
00340   */
00341 
00342 /**
00343   * @}
00344   */
00345 
00346 /**
00347   * @}
00348   */
00349 
00350 /**
00351   * @}
00352   */
00353 
00354 
00355 #ifdef __cplusplus
00356 }
00357 #endif
00358 
00359 #endif /* __STM32H747I_DISCOVERY_H */
00360 
00361 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/