Felipe Gomes / BSP_DISCO_F469NI

Dependents:   Aprendendo Final_v3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32469i_discovery.h Source File

stm32469i_discovery.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32469i_discovery.h
00004   * @author  MCD Application Team
00005   * @version V1.0.1
00006   * @date    29-September-2015
00007   * @brief   This file contains definitions for STM32469I-Discovery LEDs,
00008   *          push-buttons hardware resources.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; 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 __STM32469I_DISCOVERY_H
00041 #define __STM32469I_DISCOVERY_H
00042 
00043 #ifdef __cplusplus
00044  extern "C" {
00045 #endif
00046 
00047  /* Includes ------------------------------------------------------------------*/
00048 #include "stm32f4xx_hal.h"
00049 
00050 // mbed
00051 void wait_ms(int ms);
00052 
00053 /** @addtogroup BSP
00054   * @{
00055   */
00056 
00057 /** @addtogroup STM32469I_Discovery
00058   * @{
00059   */
00060 
00061 /** @defgroup STM32469I_Discovery_LOW_LEVEL STM32469I-Discovery LOW LEVEL
00062   * @{
00063   */
00064 
00065 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Types STM32469I Discovery Low Level Exported Types
00066  * @{
00067  */
00068 
00069 /** @brief Led_TypeDef
00070   *  STM32469I_Discovery board leds definitions.
00071   */
00072 typedef enum
00073 {
00074  DISCO_LED1 = 0,
00075  DISCO_LED_GREEN = DISCO_LED1,
00076  DISCO_LED2 = 1,
00077  DISCO_LED_ORANGE = DISCO_LED2,
00078  DISCO_LED3 = 2,
00079  DISCO_LED_RED = DISCO_LED3,
00080  DISCO_LED4 = 3,
00081  DISCO_LED_BLUE = DISCO_LED4
00082 
00083 } Led_TypeDef;
00084 
00085 /** @brief Button_TypeDef
00086   *  STM32469I_Discovery board Buttons definitions.
00087   */
00088 typedef enum
00089 {
00090   BUTTON_WAKEUP = 0
00091 } Button_TypeDef;
00092 
00093 #define BUTTON_USER BUTTON_WAKEUP
00094 
00095 /** @brief ButtonMode_TypeDef
00096   *  STM32469I_Discovery board Buttons Modes definitions.
00097   */
00098 typedef enum
00099 {
00100  BUTTON_MODE_GPIO = 0,
00101  BUTTON_MODE_EXTI = 1
00102 
00103 } ButtonMode_TypeDef;
00104 
00105 /** @addtogroup Exported_types
00106   * @{
00107   */ 
00108 typedef enum 
00109 {
00110   PB_SET = 0, 
00111   PB_RESET = !PB_SET
00112 } ButtonValue_TypeDef;
00113 
00114 
00115 /** @brief DISCO_Status_TypeDef
00116   *  STM32469I_DISCO board Status return possible values.
00117   */
00118 typedef enum
00119 {
00120  DISCO_OK    = 0,
00121  DISCO_ERROR = 1
00122 
00123 } DISCO_Status_TypeDef;
00124 
00125 /**
00126   * @}
00127   */
00128 
00129 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Constants STM32469I Discovery Low Level Exported Constants
00130   * @{
00131   */
00132 
00133 
00134 /** @addtogroup STM32469I_Discovery_LOW_LEVEL_LED STM32469I Discovery Low Level Led
00135   * @{
00136   */
00137 /* Always four leds for all revisions of Discovery boards */
00138 #define LEDn                             ((uint8_t)4)
00139 
00140 
00141 /* 4 Leds are connected to MCU directly on PG6, PD4, PD5, PK3 */
00142 #define LED1_GPIO_PORT                   ((GPIO_TypeDef*)GPIOG)
00143 #define LED2_GPIO_PORT                   ((GPIO_TypeDef*)GPIOD)
00144 #define LED3_GPIO_PORT                   ((GPIO_TypeDef*)GPIOD)
00145 #define LED4_GPIO_PORT                   ((GPIO_TypeDef*)GPIOK)
00146 
00147 #define LED1_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOG_CLK_ENABLE()
00148 #define LED1_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOG_CLK_DISABLE()
00149 #define LED2_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOD_CLK_ENABLE()
00150 #define LED2_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOD_CLK_DISABLE()
00151 #define LED3_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOD_CLK_ENABLE()
00152 #define LED3_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOD_CLK_DISABLE()
00153 #define LED4_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOK_CLK_ENABLE()
00154 #define LED4_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOK_CLK_DISABLE()
00155 
00156 #define LED1_PIN                         ((uint32_t)GPIO_PIN_6)
00157 #define LED2_PIN                         ((uint32_t)GPIO_PIN_4)
00158 #define LED3_PIN                         ((uint32_t)GPIO_PIN_5)
00159 #define LED4_PIN                         ((uint32_t)GPIO_PIN_3)
00160 /**
00161   * @}
00162   */
00163 
00164 /** @addtogroup STM32469I_Discovery_LOW_LEVEL_BUTTON STM32469I Discovery Low Level Button
00165   * @{
00166   */
00167 /* Only one User/Wakeup button */
00168 #define BUTTONn                             ((uint8_t)1)
00169 
00170 /**
00171   * @brief Wakeup push-button
00172   */
00173 #define WAKEUP_BUTTON_PIN                   GPIO_PIN_0
00174 #define WAKEUP_BUTTON_GPIO_PORT             GPIOA
00175 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()
00176 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()
00177 #define WAKEUP_BUTTON_EXTI_IRQn             EXTI0_IRQn
00178 
00179 /* Define the USER button as an alias of the Wakeup button */
00180 #define USER_BUTTON_PIN                   WAKEUP_BUTTON_PIN
00181 #define USER_BUTTON_GPIO_PORT             WAKEUP_BUTTON_GPIO_PORT
00182 #define USER_BUTTON_GPIO_CLK_ENABLE()     WAKEUP_BUTTON_GPIO_CLK_ENABLE()
00183 #define USER_BUTTON_GPIO_CLK_DISABLE()    WAKEUP_BUTTON_GPIO_CLK_DISABLE()
00184 #define USER_BUTTON_EXTI_IRQn             WAKEUP_BUTTON_EXTI_IRQn
00185 
00186 #define BUTTON_GPIO_CLK_ENABLE()            __HAL_RCC_GPIOA_CLK_ENABLE()
00187 
00188 /**
00189   * @}
00190   */
00191 
00192 /**
00193   * @brief Discovery Pins definition
00194   * TODO : to be modified/reviewed
00195   */
00196 #define AUDIO_INT_PIN                  GPIO_PIN_7
00197 #define AUDIO_INT_PORT                 GPIOB
00198 #define AUDIO_INT_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00199 
00200 #define OTG_FS1_OVER_CURRENT_PIN                  GPIO_PIN_7
00201 #define OTG_FS1_OVER_CURRENT_PORT                 GPIOB
00202 #define OTG_FS1_OVER_CURRENT_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00203 
00204 #define OTG_FS1_POWER_SWITCH_PIN                  GPIO_PIN_2
00205 #define OTG_FS1_POWER_SWITCH_PORT                 GPIOB
00206 #define OTG_FS1_POWER_SWITCH_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00207 
00208 /**
00209   * @brief SD-detect signal
00210   */
00211 #define SD_DETECT_PIN                        ((uint32_t)GPIO_PIN_2)
00212 #define SD_DETECT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOG)
00213 #define SD_DETECT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOG_CLK_ENABLE()
00214 #define SD_DETECT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOG_CLK_DISABLE()
00215 #define SD_DETECT_EXTI_IRQn                  EXTI2_IRQn
00216 
00217 /**
00218   * @brief TS_INT signal from TouchScreen when it is configured in interrupt mode
00219   * GPIOJ5 is used for that purpose on Manta Dragon Discovery board
00220   */
00221 #define TS_INT_PIN                        ((uint32_t)GPIO_PIN_5)
00222 #define TS_INT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOJ)
00223 #define TS_INT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOJ_CLK_ENABLE()
00224 #define TS_INT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOJ_CLK_DISABLE()
00225 #define TS_INT_EXTI_IRQn                  EXTI9_5_IRQn
00226 
00227 /**
00228   * @brief TouchScreen FT6206 Slave I2C address
00229   */
00230 #define TS_I2C_ADDRESS                   ((uint16_t)0x54)
00231 
00232 
00233 /**
00234   * @brief Audio I2C Slave address
00235   */
00236 #define AUDIO_I2C_ADDRESS                ((uint16_t)0x94)
00237 
00238 /**
00239   * @brief EEPROM I2C Slave address 1
00240   */
00241 #define EEPROM_I2C_ADDRESS_A01           ((uint16_t)0xA0)
00242 
00243 /**
00244   * @brief EEPROM I2C Slave address 2
00245   */
00246 #define EEPROM_I2C_ADDRESS_A02           ((uint16_t)0xA6)
00247 
00248 /**
00249   * @brief I2C clock speed configuration (in Hz)
00250   * WARNING:
00251   * Make sure that this define is not already declared in other files
00252   * It can be used in parallel by other modules.
00253   */
00254 #ifndef I2C1_SCL_FREQ_KHZ
00255 #define I2C1_SCL_FREQ_KHZ                  400000 /*!< f(I2C_SCL) = 400 kHz */
00256 #endif /* I2C1_SCL_FREQ_KHZ */
00257 
00258 /**
00259   * @brief User can use this section to tailor I2C1/I2C1 instance used and associated
00260   * resources.
00261   * Definition for I2C1 clock resources
00262   */
00263 #define DISCO_I2C1                             I2C1
00264 #define DISCO_I2C1_CLK_ENABLE()                __HAL_RCC_I2C1_CLK_ENABLE()
00265 #define DISCO_DMAx_CLK_ENABLE()                __HAL_RCC_DMA1_CLK_ENABLE()
00266 #define DISCO_I2C1_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOB_CLK_ENABLE()
00267 
00268 #define DISCO_I2C1_FORCE_RESET()               __HAL_RCC_I2C1_FORCE_RESET()
00269 #define DISCO_I2C1_RELEASE_RESET()             __HAL_RCC_I2C1_RELEASE_RESET()
00270 
00271 /** @brief Definition for I2C1 Pins
00272   */
00273 #define DISCO_I2C1_SCL_PIN                     GPIO_PIN_8 /*!< PB8 */
00274 #define DISCO_I2C1_SCL_SDA_GPIO_PORT           GPIOB
00275 #define DISCO_I2C1_SCL_SDA_AF                  GPIO_AF4_I2C1
00276 #define DISCO_I2C1_SDA_PIN                     GPIO_PIN_9 /*!< PB9 */
00277 
00278 /** @brief Definition of I2C interrupt requests
00279   */
00280 #define DISCO_I2C1_EV_IRQn                     I2C1_EV_IRQn
00281 #define DISCO_I2C1_ER_IRQn                     I2C1_ER_IRQn
00282 
00283 
00284 
00285 /**
00286   * @brief I2C2 clock speed configuration (in Hz)
00287   * WARNING:
00288   * Make sure that this define is not already declared in other files
00289   * It can be used in parallel by other modules.
00290   */
00291 #ifndef I2C2_SCL_FREQ_KHZ
00292 #define I2C2_SCL_FREQ_KHZ                  100000 /*!< f(I2C2_SCL) < 100 kHz */
00293 #endif /* I2C2_SCL_FREQ_KHZ */
00294 
00295 /**
00296   * @brief User can use this section to tailor I2C2/I2C2 instance used and associated
00297   * resources (audio codec).
00298   * Definition for I2C2 clock resources
00299   */
00300 #define DISCO_I2C2                             I2C2
00301 #define DISCO_I2C2_CLK_ENABLE()                __HAL_RCC_I2C2_CLK_ENABLE()
00302 #define DISCO_I2C2_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOH_CLK_ENABLE()
00303 
00304 #define DISCO_I2C2_FORCE_RESET()               __HAL_RCC_I2C2_FORCE_RESET()
00305 #define DISCO_I2C2_RELEASE_RESET()             __HAL_RCC_I2C2_RELEASE_RESET()
00306 
00307 /** @brief Definition for I2C2 Pins
00308   */
00309 #define DISCO_I2C2_SCL_PIN                     GPIO_PIN_4 /*!< PH4 */
00310 #define DISCO_I2C2_SCL_SDA_GPIO_PORT           GPIOH
00311 #define DISCO_I2C2_SCL_SDA_AF                  GPIO_AF4_I2C2
00312 #define DISCO_I2C2_SDA_PIN                     GPIO_PIN_5 /*!< PH5 */
00313 
00314 /** @brief Definition of I2C2 interrupt requests
00315   */
00316 #define DISCO_I2C2_EV_IRQn                     I2C2_EV_IRQn
00317 #define DISCO_I2C2_ER_IRQn                     I2C2_ER_IRQn
00318 
00319 
00320 /**
00321   * @}
00322   */
00323 
00324 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Macros STM32469I Discovery Low Level Exported Macros
00325   * @{
00326   */
00327 /**
00328   * @}
00329   */
00330 
00331 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Functions STM32469I Discovery Low Level Exported Functions
00332   * @{
00333   */
00334 uint32_t         BSP_GetVersion(void);
00335 void             BSP_LED_Init(Led_TypeDef Led);
00336 void             BSP_LED_DeInit(Led_TypeDef Led);
00337 void             BSP_LED_On(Led_TypeDef Led);
00338 void             BSP_LED_Off(Led_TypeDef Led);
00339 void             BSP_LED_Toggle(Led_TypeDef Led);
00340 void             BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
00341 void             BSP_PB_DeInit(Button_TypeDef Button);
00342 uint32_t         BSP_PB_GetState(Button_TypeDef Button);
00343 
00344 /**
00345   * @}
00346   */
00347 
00348 /**
00349   * @}
00350   */
00351 
00352 /**
00353   * @}
00354   */
00355 
00356 /**
00357   * @}
00358   */
00359 
00360 /**
00361   * @}
00362   */
00363 
00364 
00365 #ifdef __cplusplus
00366 }
00367 #endif
00368 
00369 #endif /* __STM32469I_DISCOVERY_H */
00370 
00371 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/