Nenad Djalovic / BSP_DISCO_F469NI

Fork of BSP_DISCO_F469NI by ST

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 V2.0.0
00006   * @date    27-January-2017
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) 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 __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 /** @addtogroup 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 /**
00130   * @}
00131   */
00132 
00133 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Constants STM32469I Discovery LOW LEVEL Exported Constants
00134   * @{
00135   */
00136 
00137 
00138 /** @defgroup STM32469I_Discovery_LOW_LEVEL_LED STM32469I Discovery LOW LEVEL LED
00139   * @{
00140   */
00141 /* Always four leds for all revisions of Discovery boards */
00142 #define LEDn                             ((uint8_t)4)
00143 
00144 
00145 /* 4 Leds are connected to MCU directly on PG6, PD4, PD5, PK3 */
00146 #define LED1_GPIO_PORT                   ((GPIO_TypeDef*)GPIOG)
00147 #define LED2_GPIO_PORT                   ((GPIO_TypeDef*)GPIOD)
00148 #define LED3_GPIO_PORT                   ((GPIO_TypeDef*)GPIOD)
00149 #define LED4_GPIO_PORT                   ((GPIO_TypeDef*)GPIOK)
00150 
00151 #define LED1_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOG_CLK_ENABLE()
00152 #define LED1_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOG_CLK_DISABLE()
00153 #define LED2_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOD_CLK_ENABLE()
00154 #define LED2_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOD_CLK_DISABLE()
00155 #define LED3_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOD_CLK_ENABLE()
00156 #define LED3_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOD_CLK_DISABLE()
00157 #define LED4_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOK_CLK_ENABLE()
00158 #define LED4_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOK_CLK_DISABLE()
00159 
00160 #define LED1_PIN                         ((uint32_t)GPIO_PIN_6)
00161 #define LED2_PIN                         ((uint32_t)GPIO_PIN_4)
00162 #define LED3_PIN                         ((uint32_t)GPIO_PIN_5)
00163 #define LED4_PIN                         ((uint32_t)GPIO_PIN_3)
00164 /**
00165   * @}
00166   */
00167 
00168 /** @addtogroup STM32469I_Discovery_LOW_LEVEL_BUTTON STM32469I Discovery LOW LEVEL BUTTON
00169   * @{
00170   */
00171 /* Only one User/Wakeup button */
00172 #define BUTTONn                             ((uint8_t)1)
00173 
00174 /**
00175   * @brief Wakeup push-button
00176   */
00177 #define WAKEUP_BUTTON_PIN                   GPIO_PIN_0
00178 #define WAKEUP_BUTTON_GPIO_PORT             GPIOA
00179 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()
00180 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()
00181 #define WAKEUP_BUTTON_EXTI_IRQn             EXTI0_IRQn
00182 
00183 /* Define the USER button as an alias of the Wakeup button */
00184 #define USER_BUTTON_PIN                   WAKEUP_BUTTON_PIN
00185 #define USER_BUTTON_GPIO_PORT             WAKEUP_BUTTON_GPIO_PORT
00186 #define USER_BUTTON_GPIO_CLK_ENABLE()     WAKEUP_BUTTON_GPIO_CLK_ENABLE()
00187 #define USER_BUTTON_GPIO_CLK_DISABLE()    WAKEUP_BUTTON_GPIO_CLK_DISABLE()
00188 #define USER_BUTTON_EXTI_IRQn             WAKEUP_BUTTON_EXTI_IRQn
00189 
00190 #define BUTTON_GPIO_CLK_ENABLE()            __HAL_RCC_GPIOA_CLK_ENABLE()
00191 
00192 /**
00193   * @}
00194   */
00195 
00196 /**
00197   * @brief OTG_FS1 OVER_CURRENT and POWER_SWITCH Pins definition
00198   */
00199 #define AUDIO_INT_PIN                  GPIO_PIN_7
00200 #define AUDIO_INT_PORT                 GPIOB
00201 #define AUDIO_INT_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00202 
00203 #define OTG_FS1_OVER_CURRENT_PIN                  GPIO_PIN_7
00204 #define OTG_FS1_OVER_CURRENT_PORT                 GPIOB
00205 #define OTG_FS1_OVER_CURRENT_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00206 
00207 #define OTG_FS1_POWER_SWITCH_PIN                  GPIO_PIN_2
00208 #define OTG_FS1_POWER_SWITCH_PORT                 GPIOB
00209 #define OTG_FS1_POWER_SWITCH_PORT_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00210 
00211 /**
00212   * @brief SD-detect signal
00213   */
00214 #define SD_DETECT_PIN                        ((uint32_t)GPIO_PIN_2)
00215 #define SD_DETECT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOG)
00216 #define SD_DETECT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOG_CLK_ENABLE()
00217 #define SD_DETECT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOG_CLK_DISABLE()
00218 #define SD_DETECT_EXTI_IRQn                  EXTI2_IRQn
00219 
00220 /**
00221   * @brief TS_INT signal from TouchScreen when it is configured in interrupt mode
00222   */
00223 #define TS_INT_PIN                        ((uint32_t)GPIO_PIN_5)
00224 #define TS_INT_GPIO_PORT                  ((GPIO_TypeDef*)GPIOJ)
00225 #define TS_INT_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOJ_CLK_ENABLE()
00226 #define TS_INT_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOJ_CLK_DISABLE()
00227 #define TS_INT_EXTI_IRQn                  EXTI9_5_IRQn
00228 
00229 /**
00230   * @brief TouchScreen FT6206 Slave I2C address 1
00231   */
00232 #define TS_I2C_ADDRESS                   ((uint16_t)0x54)
00233 
00234 /**
00235   * @brief TouchScreen FT6336G Slave I2C address 2
00236   */
00237 #define TS_I2C_ADDRESS_A02               ((uint16_t)0x70)
00238 
00239 
00240 /**
00241   * @brief Audio I2C Slave address
00242   */
00243 #define AUDIO_I2C_ADDRESS                ((uint16_t)0x94)
00244 
00245 /**
00246   * @brief EEPROM I2C Slave address 1
00247   */
00248 #define EEPROM_I2C_ADDRESS_A01           ((uint16_t)0xA0)
00249 
00250 /**
00251   * @brief EEPROM I2C Slave address 2
00252   */
00253 #define EEPROM_I2C_ADDRESS_A02           ((uint16_t)0xA6)
00254 
00255 /**
00256   * @brief I2C clock speed configuration (in Hz)
00257   * WARNING:
00258   * Make sure that this define is not already declared in other files
00259   * It can be used in parallel by other modules.
00260   */
00261 #ifndef I2C1_SCL_FREQ_KHZ
00262 #define I2C1_SCL_FREQ_KHZ                  400000 /*!< f(I2C_SCL) = 400 kHz */
00263 #endif /* I2C1_SCL_FREQ_KHZ */
00264 
00265 /**
00266   * @brief User can use this section to tailor I2C1/I2C1 instance used and associated
00267   * resources.
00268   * Definition for I2C1 clock resources
00269   */
00270 #define DISCO_I2C1                             I2C1
00271 #define DISCO_I2C1_CLK_ENABLE()                __HAL_RCC_I2C1_CLK_ENABLE()
00272 #define DISCO_DMAx_CLK_ENABLE()                __HAL_RCC_DMA1_CLK_ENABLE()
00273 #define DISCO_I2C1_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOB_CLK_ENABLE()
00274 
00275 #define DISCO_I2C1_FORCE_RESET()               __HAL_RCC_I2C1_FORCE_RESET()
00276 #define DISCO_I2C1_RELEASE_RESET()             __HAL_RCC_I2C1_RELEASE_RESET()
00277 
00278 /** @brief Definition for I2C1 Pins
00279   */
00280 #define DISCO_I2C1_SCL_PIN                     GPIO_PIN_8 /*!< PB8 */
00281 #define DISCO_I2C1_SCL_SDA_GPIO_PORT           GPIOB
00282 #define DISCO_I2C1_SCL_SDA_AF                  GPIO_AF4_I2C1
00283 #define DISCO_I2C1_SDA_PIN                     GPIO_PIN_9 /*!< PB9 */
00284 
00285 /** @brief Definition of I2C interrupt requests
00286   */
00287 #define DISCO_I2C1_EV_IRQn                     I2C1_EV_IRQn
00288 #define DISCO_I2C1_ER_IRQn                     I2C1_ER_IRQn
00289 
00290 
00291 
00292 /**
00293   * @brief I2C2 clock speed configuration (in Hz)
00294   * WARNING:
00295   * Make sure that this define is not already declared in other files
00296   * It can be used in parallel by other modules.
00297   */
00298 #ifndef I2C2_SCL_FREQ_KHZ
00299 #define I2C2_SCL_FREQ_KHZ                  100000 /*!< f(I2C2_SCL) < 100 kHz */
00300 #endif /* I2C2_SCL_FREQ_KHZ */
00301 
00302 /**
00303   * @brief User can use this section to tailor I2C2/I2C2 instance used and associated
00304   * resources (audio codec).
00305   * Definition for I2C2 clock resources
00306   */
00307 #define DISCO_I2C2                             I2C2
00308 #define DISCO_I2C2_CLK_ENABLE()                __HAL_RCC_I2C2_CLK_ENABLE()
00309 #define DISCO_I2C2_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOH_CLK_ENABLE()
00310 
00311 #define DISCO_I2C2_FORCE_RESET()               __HAL_RCC_I2C2_FORCE_RESET()
00312 #define DISCO_I2C2_RELEASE_RESET()             __HAL_RCC_I2C2_RELEASE_RESET()
00313 
00314 /** @brief Definition for I2C2 Pins
00315   */
00316 #define DISCO_I2C2_SCL_PIN                     GPIO_PIN_4 /*!< PH4 */
00317 #define DISCO_I2C2_SCL_SDA_GPIO_PORT           GPIOH
00318 #define DISCO_I2C2_SCL_SDA_AF                  GPIO_AF4_I2C2
00319 #define DISCO_I2C2_SDA_PIN                     GPIO_PIN_5 /*!< PH5 */
00320 
00321 /** @brief Definition of I2C2 interrupt requests
00322   */
00323 #define DISCO_I2C2_EV_IRQn                     I2C2_EV_IRQn
00324 #define DISCO_I2C2_ER_IRQn                     I2C2_ER_IRQn
00325 
00326 
00327 /**
00328   * @}
00329   */
00330 
00331 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Macros STM32469I Discovery LOW LEVEL Exported Macros
00332   * @{
00333   */
00334 /**
00335   * @}
00336   */
00337 
00338 /** @defgroup STM32469I_Discovery_LOW_LEVEL_Exported_Functions STM32469I Discovery LOW LEVEL Exported Functions
00339   * @{
00340   */
00341 uint32_t         BSP_GetVersion(void);
00342 void             BSP_LED_Init(Led_TypeDef Led);
00343 void             BSP_LED_DeInit(Led_TypeDef Led);
00344 void             BSP_LED_On(Led_TypeDef Led);
00345 void             BSP_LED_Off(Led_TypeDef Led);
00346 void             BSP_LED_Toggle(Led_TypeDef Led);
00347 void             BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
00348 void             BSP_PB_DeInit(Button_TypeDef Button);
00349 uint32_t         BSP_PB_GetState(Button_TypeDef Button);
00350 
00351 /**
00352   * @}
00353   */
00354 
00355 /**
00356   * @}
00357   */
00358 
00359 /**
00360   * @}
00361   */
00362 
00363 /**
00364   * @}
00365   */
00366 
00367 
00368 #ifdef __cplusplus
00369 }
00370 #endif
00371 
00372 #endif /* __STM32469I_DISCOVERY_H */
00373 
00374 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/