STM32746G-Discovery BSP User Manual
|
stm32746g_discovery.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32746g_discovery.h 00004 * @author MCD Application Team 00005 * @version V2.0.0 00006 * @date 30-December-2016 00007 * @brief This file contains definitions for STM32746G_DISCOVERY's LEDs, 00008 * push-buttons and COM ports hardware resources. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2016 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 __STM32746G_DISCOVERY_H 00041 #define __STM32746G_DISCOVERY_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* Includes ------------------------------------------------------------------*/ 00048 #include "stm32f7xx_hal.h" 00049 00050 /** @addtogroup BSP 00051 * @{ 00052 */ 00053 00054 /** @addtogroup STM32746G_DISCOVERY 00055 * @{ 00056 */ 00057 00058 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL 00059 * @{ 00060 */ 00061 00062 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Types STM32746G_DISCOVERY_LOW_LEVEL Exported Types 00063 * @{ 00064 */ 00065 typedef enum 00066 { 00067 LED1 = 0, 00068 LED_GREEN = LED1, 00069 }Led_TypeDef; 00070 00071 typedef enum 00072 { 00073 BUTTON_WAKEUP = 0, 00074 BUTTON_TAMPER = 1, 00075 BUTTON_KEY = 2 00076 }Button_TypeDef; 00077 00078 typedef enum 00079 { 00080 BUTTON_MODE_GPIO = 0, 00081 BUTTON_MODE_EXTI = 1 00082 }ButtonMode_TypeDef; 00083 00084 typedef enum 00085 { 00086 COM1 = 0, 00087 COM2 = 1 00088 }COM_TypeDef; 00089 /** 00090 * @} 00091 */ 00092 00093 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Constants STM32746G_DISCOVERY_LOW_LEVEL Exported Constants 00094 * @{ 00095 */ 00096 00097 /** 00098 * @brief Define for STM32746G_DISCOVERY board 00099 */ 00100 #if !defined (USE_STM32746G_DISCO) 00101 #define USE_STM32746G_DISCO 00102 #endif 00103 00104 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_LED 00105 * @{ 00106 */ 00107 00108 #define LEDn ((uint8_t)1) 00109 00110 #define LED1_GPIO_PORT GPIOI 00111 #define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00112 #define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00113 #define LED1_PIN GPIO_PIN_1 00114 00115 /** 00116 * @} 00117 */ 00118 00119 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_BUTTON 00120 * @{ 00121 */ 00122 #define BUTTONn ((uint8_t)3) 00123 00124 /** 00125 * @brief Wakeup push-button 00126 */ 00127 #define WAKEUP_BUTTON_PIN GPIO_PIN_11 00128 #define WAKEUP_BUTTON_GPIO_PORT GPIOI 00129 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00130 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00131 #define WAKEUP_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00132 00133 /** 00134 * @brief Tamper push-button 00135 */ 00136 #define TAMPER_BUTTON_PIN GPIO_PIN_11 00137 #define TAMPER_BUTTON_GPIO_PORT GPIOI 00138 #define TAMPER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00139 #define TAMPER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00140 #define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00141 00142 /** 00143 * @brief Key push-button 00144 */ 00145 #define KEY_BUTTON_PIN GPIO_PIN_11 00146 #define KEY_BUTTON_GPIO_PORT GPIOI 00147 #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00148 #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00149 #define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn 00150 00151 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\ 00152 if((__INDEX__) == 1) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\ 00153 KEY_BUTTON_GPIO_CLK_ENABLE(); } while(0) 00154 00155 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\ 00156 ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE()) 00157 00158 /** 00159 * @} 00160 */ 00161 00162 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_SIGNAL 00163 * @{ 00164 */ 00165 #define SIGNALn ((uint8_t)1) 00166 00167 /** 00168 * @brief SD-detect signal 00169 */ 00170 #define SD_DETECT_PIN GPIO_PIN_13 00171 #define SD_DETECT_GPIO_PORT GPIOC 00172 #define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00173 #define SD_DETECT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00174 #define SD_DETECT_EXTI_IRQn EXTI15_10_IRQn 00175 00176 /** 00177 * @brief Touch screen interrupt signal 00178 */ 00179 #define TS_INT_PIN GPIO_PIN_13 00180 #define TS_INT_GPIO_PORT GPIOI 00181 #define TS_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() 00182 #define TS_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() 00183 #define TS_INT_EXTI_IRQn EXTI15_10_IRQn 00184 00185 /** 00186 * @} 00187 */ 00188 00189 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_COM 00190 * @{ 00191 */ 00192 #define COMn ((uint8_t)1) 00193 00194 /** 00195 * @brief Definition for COM port1, connected to USART1 00196 */ 00197 #define DISCOVERY_COM1 USART1 00198 #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE() 00199 #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE() 00200 00201 #define DISCOVERY_COM1_TX_PIN GPIO_PIN_9 00202 #define DISCOVERY_COM1_TX_GPIO_PORT GPIOA 00203 #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00204 #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00205 #define DISCOVERY_COM1_TX_AF GPIO_AF7_USART1 00206 00207 #define DISCOVERY_COM1_RX_PIN GPIO_PIN_7 00208 #define DISCOVERY_COM1_RX_GPIO_PORT GPIOB 00209 #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00210 #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00211 #define DISCOVERY_COM1_RX_AF GPIO_AF7_USART1 00212 00213 #define DISCOVERY_COM1_IRQn USART1_IRQn 00214 00215 #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_CLK_ENABLE(); } while(0) 00216 #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_CLK_DISABLE() : 0) 00217 00218 #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_TX_GPIO_CLK_ENABLE(); } while(0) 00219 #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() : 0) 00220 00221 #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_RX_GPIO_CLK_ENABLE(); } while(0) 00222 #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() : 0) 00223 00224 /* Exported constant IO ------------------------------------------------------*/ 00225 00226 #define LCD_I2C_ADDRESS ((uint16_t)0x70) 00227 #define CAMERA_I2C_ADDRESS ((uint16_t)0x60) 00228 #define AUDIO_I2C_ADDRESS ((uint16_t)0x34) 00229 #define EEPROM_I2C_ADDRESS_A01 ((uint16_t)0xA0) 00230 #define EEPROM_I2C_ADDRESS_A02 ((uint16_t)0xA6) 00231 #define TS_I2C_ADDRESS ((uint16_t)0x70) 00232 00233 /* I2C clock speed configuration (in Hz) 00234 WARNING: 00235 Make sure that this define is not already declared in other files (ie. 00236 stm32746g_discovery.h file). It can be used in parallel by other modules. */ 00237 #ifndef I2C_SPEED 00238 #define I2C_SPEED ((uint32_t)100000) 00239 #endif /* I2C_SPEED */ 00240 00241 /* User can use this section to tailor I2Cx/I2Cx instance used and associated 00242 resources */ 00243 /* Definition for AUDIO and LCD I2Cx resources */ 00244 #define DISCOVERY_AUDIO_I2Cx I2C3 00245 #define DISCOVERY_AUDIO_I2Cx_CLK_ENABLE() __HAL_RCC_I2C3_CLK_ENABLE() 00246 #define DISCOVERY_AUDIO_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00247 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE() 00248 00249 #define DISCOVERY_AUDIO_I2Cx_FORCE_RESET() __HAL_RCC_I2C3_FORCE_RESET() 00250 #define DISCOVERY_AUDIO_I2Cx_RELEASE_RESET() __HAL_RCC_I2C3_RELEASE_RESET() 00251 00252 /* Definition for I2Cx Pins */ 00253 #define DISCOVERY_AUDIO_I2Cx_SCL_PIN GPIO_PIN_7 00254 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT GPIOH 00255 #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF GPIO_AF4_I2C3 00256 #define DISCOVERY_AUDIO_I2Cx_SDA_PIN GPIO_PIN_8 00257 00258 /* I2C interrupt requests */ 00259 #define DISCOVERY_AUDIO_I2Cx_EV_IRQn I2C3_EV_IRQn 00260 #define DISCOVERY_AUDIO_I2Cx_ER_IRQn I2C3_ER_IRQn 00261 00262 /* Definition for external, camera and Arduino connector I2Cx resources */ 00263 #define DISCOVERY_EXT_I2Cx I2C1 00264 #define DISCOVERY_EXT_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE() 00265 #define DISCOVERY_EXT_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00266 #define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00267 00268 #define DISCOVERY_EXT_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET() 00269 #define DISCOVERY_EXT_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET() 00270 00271 /* Definition for I2Cx Pins */ 00272 #define DISCOVERY_EXT_I2Cx_SCL_PIN GPIO_PIN_8 00273 #define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT GPIOB 00274 #define DISCOVERY_EXT_I2Cx_SCL_SDA_AF GPIO_AF4_I2C1 00275 #define DISCOVERY_EXT_I2Cx_SDA_PIN GPIO_PIN_9 00276 00277 /* I2C interrupt requests */ 00278 #define DISCOVERY_EXT_I2Cx_EV_IRQn I2C1_EV_IRQn 00279 #define DISCOVERY_EXT_I2Cx_ER_IRQn I2C1_ER_IRQn 00280 00281 /* I2C TIMING Register define when I2C clock source is SYSCLK */ 00282 /* I2C TIMING is calculated from APB1 source clock = 50 MHz */ 00283 /* Due to the big MOFSET capacity for adapting the camera level the rising time is very large (>1us) */ 00284 /* 0x40912732 takes in account the big rising and aims a clock of 100khz */ 00285 #ifndef DISCOVERY_I2Cx_TIMING 00286 #define DISCOVERY_I2Cx_TIMING ((uint32_t)0x40912732) 00287 #endif /* DISCOVERY_I2Cx_TIMING */ 00288 00289 /** 00290 * @} 00291 */ 00292 00293 /** 00294 * @} 00295 */ 00296 00297 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Macros STM32746G_DISCOVERY_LOW_LEVEL Exported Macros 00298 * @{ 00299 */ 00300 /** 00301 * @} 00302 */ 00303 00304 /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Functions 00305 * @{ 00306 */ 00307 uint32_t BSP_GetVersion(void); 00308 void BSP_LED_Init(Led_TypeDef Led); 00309 void BSP_LED_DeInit(Led_TypeDef Led); 00310 void BSP_LED_On(Led_TypeDef Led); 00311 void BSP_LED_Off(Led_TypeDef Led); 00312 void BSP_LED_Toggle(Led_TypeDef Led); 00313 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); 00314 void BSP_PB_DeInit(Button_TypeDef Button); 00315 uint32_t BSP_PB_GetState(Button_TypeDef Button); 00316 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); 00317 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); 00318 00319 /** 00320 * @} 00321 */ 00322 00323 /** 00324 * @} 00325 */ 00326 00327 /** 00328 * @} 00329 */ 00330 00331 /** 00332 * @} 00333 */ 00334 00335 #ifdef __cplusplus 00336 } 00337 #endif 00338 00339 #endif /* __STM32746G_DISCOVERY_H */ 00340 00341 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Dec 30 2016 16:31:33 for STM32746G-Discovery BSP User Manual by 1.7.6.1