Clone
Dependents: SignalProcessLab DigitalSignalAlgorithm_Lab DigitalSignal_Lab
Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.h@0:fc80425b677a, 2019-08-26 (annotated)
- Committer:
- ngtkien
- Date:
- Mon Aug 26 16:33:09 2019 +0000
- Revision:
- 0:fc80425b677a
Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngtkien | 0:fc80425b677a | 1 | /** |
ngtkien | 0:fc80425b677a | 2 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 3 | * @file stm32746g_discovery.h |
ngtkien | 0:fc80425b677a | 4 | * @author MCD Application Team |
ngtkien | 0:fc80425b677a | 5 | * @version V2.0.0 |
ngtkien | 0:fc80425b677a | 6 | * @date 30-December-2016 |
ngtkien | 0:fc80425b677a | 7 | * @brief This file contains definitions for STM32746G_DISCOVERY's LEDs, |
ngtkien | 0:fc80425b677a | 8 | * push-buttons and COM ports hardware resources. |
ngtkien | 0:fc80425b677a | 9 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 10 | * @attention |
ngtkien | 0:fc80425b677a | 11 | * |
ngtkien | 0:fc80425b677a | 12 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
ngtkien | 0:fc80425b677a | 13 | * |
ngtkien | 0:fc80425b677a | 14 | * Redistribution and use in source and binary forms, with or without modification, |
ngtkien | 0:fc80425b677a | 15 | * are permitted provided that the following conditions are met: |
ngtkien | 0:fc80425b677a | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
ngtkien | 0:fc80425b677a | 17 | * this list of conditions and the following disclaimer. |
ngtkien | 0:fc80425b677a | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ngtkien | 0:fc80425b677a | 19 | * this list of conditions and the following disclaimer in the documentation |
ngtkien | 0:fc80425b677a | 20 | * and/or other materials provided with the distribution. |
ngtkien | 0:fc80425b677a | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ngtkien | 0:fc80425b677a | 22 | * may be used to endorse or promote products derived from this software |
ngtkien | 0:fc80425b677a | 23 | * without specific prior written permission. |
ngtkien | 0:fc80425b677a | 24 | * |
ngtkien | 0:fc80425b677a | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ngtkien | 0:fc80425b677a | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ngtkien | 0:fc80425b677a | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ngtkien | 0:fc80425b677a | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ngtkien | 0:fc80425b677a | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ngtkien | 0:fc80425b677a | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ngtkien | 0:fc80425b677a | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ngtkien | 0:fc80425b677a | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ngtkien | 0:fc80425b677a | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ngtkien | 0:fc80425b677a | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ngtkien | 0:fc80425b677a | 35 | * |
ngtkien | 0:fc80425b677a | 36 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 37 | */ |
ngtkien | 0:fc80425b677a | 38 | |
ngtkien | 0:fc80425b677a | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
ngtkien | 0:fc80425b677a | 40 | #ifndef __STM32746G_DISCOVERY_H |
ngtkien | 0:fc80425b677a | 41 | #define __STM32746G_DISCOVERY_H |
ngtkien | 0:fc80425b677a | 42 | |
ngtkien | 0:fc80425b677a | 43 | #ifdef __cplusplus |
ngtkien | 0:fc80425b677a | 44 | extern "C" { |
ngtkien | 0:fc80425b677a | 45 | #endif |
ngtkien | 0:fc80425b677a | 46 | |
ngtkien | 0:fc80425b677a | 47 | /* Includes ------------------------------------------------------------------*/ |
ngtkien | 0:fc80425b677a | 48 | #include "stm32f7xx_hal.h" |
ngtkien | 0:fc80425b677a | 49 | #include "cmsis_nvic.h" // MBED |
ngtkien | 0:fc80425b677a | 50 | |
ngtkien | 0:fc80425b677a | 51 | /** @addtogroup BSP |
ngtkien | 0:fc80425b677a | 52 | * @{ |
ngtkien | 0:fc80425b677a | 53 | */ |
ngtkien | 0:fc80425b677a | 54 | |
ngtkien | 0:fc80425b677a | 55 | /** @addtogroup STM32746G_DISCOVERY |
ngtkien | 0:fc80425b677a | 56 | * @{ |
ngtkien | 0:fc80425b677a | 57 | */ |
ngtkien | 0:fc80425b677a | 58 | |
ngtkien | 0:fc80425b677a | 59 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL |
ngtkien | 0:fc80425b677a | 60 | * @{ |
ngtkien | 0:fc80425b677a | 61 | */ |
ngtkien | 0:fc80425b677a | 62 | |
ngtkien | 0:fc80425b677a | 63 | /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Types STM32746G_DISCOVERY_LOW_LEVEL Exported Types |
ngtkien | 0:fc80425b677a | 64 | * @{ |
ngtkien | 0:fc80425b677a | 65 | */ |
ngtkien | 0:fc80425b677a | 66 | typedef enum |
ngtkien | 0:fc80425b677a | 67 | { |
ngtkien | 0:fc80425b677a | 68 | DISCO_LED1 = 0, // MBED |
ngtkien | 0:fc80425b677a | 69 | LED_GREEN = DISCO_LED1, // MBED |
ngtkien | 0:fc80425b677a | 70 | }Led_TypeDef; |
ngtkien | 0:fc80425b677a | 71 | |
ngtkien | 0:fc80425b677a | 72 | typedef enum |
ngtkien | 0:fc80425b677a | 73 | { |
ngtkien | 0:fc80425b677a | 74 | BUTTON_WAKEUP = 0, |
ngtkien | 0:fc80425b677a | 75 | BUTTON_TAMPER = 1, |
ngtkien | 0:fc80425b677a | 76 | BUTTON_KEY = 2 |
ngtkien | 0:fc80425b677a | 77 | }Button_TypeDef; |
ngtkien | 0:fc80425b677a | 78 | |
ngtkien | 0:fc80425b677a | 79 | typedef enum |
ngtkien | 0:fc80425b677a | 80 | { |
ngtkien | 0:fc80425b677a | 81 | BUTTON_MODE_GPIO = 0, |
ngtkien | 0:fc80425b677a | 82 | BUTTON_MODE_EXTI = 1 |
ngtkien | 0:fc80425b677a | 83 | }ButtonMode_TypeDef; |
ngtkien | 0:fc80425b677a | 84 | |
ngtkien | 0:fc80425b677a | 85 | typedef enum |
ngtkien | 0:fc80425b677a | 86 | { |
ngtkien | 0:fc80425b677a | 87 | COM1 = 0, |
ngtkien | 0:fc80425b677a | 88 | COM2 = 1 |
ngtkien | 0:fc80425b677a | 89 | }COM_TypeDef; |
ngtkien | 0:fc80425b677a | 90 | /** |
ngtkien | 0:fc80425b677a | 91 | * @} |
ngtkien | 0:fc80425b677a | 92 | */ |
ngtkien | 0:fc80425b677a | 93 | |
ngtkien | 0:fc80425b677a | 94 | /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Constants STM32746G_DISCOVERY_LOW_LEVEL Exported Constants |
ngtkien | 0:fc80425b677a | 95 | * @{ |
ngtkien | 0:fc80425b677a | 96 | */ |
ngtkien | 0:fc80425b677a | 97 | |
ngtkien | 0:fc80425b677a | 98 | /** |
ngtkien | 0:fc80425b677a | 99 | * @brief Define for STM32746G_DISCOVERY board |
ngtkien | 0:fc80425b677a | 100 | */ |
ngtkien | 0:fc80425b677a | 101 | #if !defined (USE_STM32746G_DISCO) |
ngtkien | 0:fc80425b677a | 102 | #define USE_STM32746G_DISCO |
ngtkien | 0:fc80425b677a | 103 | #endif |
ngtkien | 0:fc80425b677a | 104 | |
ngtkien | 0:fc80425b677a | 105 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_LED |
ngtkien | 0:fc80425b677a | 106 | * @{ |
ngtkien | 0:fc80425b677a | 107 | */ |
ngtkien | 0:fc80425b677a | 108 | |
ngtkien | 0:fc80425b677a | 109 | #define LEDn ((uint8_t)1) |
ngtkien | 0:fc80425b677a | 110 | |
ngtkien | 0:fc80425b677a | 111 | #define LED1_GPIO_PORT GPIOI |
ngtkien | 0:fc80425b677a | 112 | #define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 113 | #define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 114 | #define LED1_PIN GPIO_PIN_1 |
ngtkien | 0:fc80425b677a | 115 | |
ngtkien | 0:fc80425b677a | 116 | /** |
ngtkien | 0:fc80425b677a | 117 | * @} |
ngtkien | 0:fc80425b677a | 118 | */ |
ngtkien | 0:fc80425b677a | 119 | |
ngtkien | 0:fc80425b677a | 120 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_BUTTON |
ngtkien | 0:fc80425b677a | 121 | * @{ |
ngtkien | 0:fc80425b677a | 122 | */ |
ngtkien | 0:fc80425b677a | 123 | #define BUTTONn ((uint8_t)3) |
ngtkien | 0:fc80425b677a | 124 | |
ngtkien | 0:fc80425b677a | 125 | /** |
ngtkien | 0:fc80425b677a | 126 | * @brief Wakeup push-button |
ngtkien | 0:fc80425b677a | 127 | */ |
ngtkien | 0:fc80425b677a | 128 | #define WAKEUP_BUTTON_PIN GPIO_PIN_11 |
ngtkien | 0:fc80425b677a | 129 | #define WAKEUP_BUTTON_GPIO_PORT GPIOI |
ngtkien | 0:fc80425b677a | 130 | #define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 131 | #define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 132 | #define WAKEUP_BUTTON_EXTI_IRQn EXTI15_10_IRQn |
ngtkien | 0:fc80425b677a | 133 | |
ngtkien | 0:fc80425b677a | 134 | /** |
ngtkien | 0:fc80425b677a | 135 | * @brief Tamper push-button |
ngtkien | 0:fc80425b677a | 136 | */ |
ngtkien | 0:fc80425b677a | 137 | #define TAMPER_BUTTON_PIN GPIO_PIN_11 |
ngtkien | 0:fc80425b677a | 138 | #define TAMPER_BUTTON_GPIO_PORT GPIOI |
ngtkien | 0:fc80425b677a | 139 | #define TAMPER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 140 | #define TAMPER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 141 | #define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn |
ngtkien | 0:fc80425b677a | 142 | |
ngtkien | 0:fc80425b677a | 143 | /** |
ngtkien | 0:fc80425b677a | 144 | * @brief Key push-button |
ngtkien | 0:fc80425b677a | 145 | */ |
ngtkien | 0:fc80425b677a | 146 | #define KEY_BUTTON_PIN GPIO_PIN_11 |
ngtkien | 0:fc80425b677a | 147 | #define KEY_BUTTON_GPIO_PORT GPIOI |
ngtkien | 0:fc80425b677a | 148 | #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 149 | #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 150 | #define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn |
ngtkien | 0:fc80425b677a | 151 | |
ngtkien | 0:fc80425b677a | 152 | #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\ |
ngtkien | 0:fc80425b677a | 153 | if((__INDEX__) == 1) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\ |
ngtkien | 0:fc80425b677a | 154 | KEY_BUTTON_GPIO_CLK_ENABLE(); } while(0) |
ngtkien | 0:fc80425b677a | 155 | |
ngtkien | 0:fc80425b677a | 156 | #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\ |
ngtkien | 0:fc80425b677a | 157 | ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE()) |
ngtkien | 0:fc80425b677a | 158 | |
ngtkien | 0:fc80425b677a | 159 | /** |
ngtkien | 0:fc80425b677a | 160 | * @} |
ngtkien | 0:fc80425b677a | 161 | */ |
ngtkien | 0:fc80425b677a | 162 | |
ngtkien | 0:fc80425b677a | 163 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_SIGNAL |
ngtkien | 0:fc80425b677a | 164 | * @{ |
ngtkien | 0:fc80425b677a | 165 | */ |
ngtkien | 0:fc80425b677a | 166 | #define SIGNALn ((uint8_t)1) |
ngtkien | 0:fc80425b677a | 167 | |
ngtkien | 0:fc80425b677a | 168 | /** |
ngtkien | 0:fc80425b677a | 169 | * @brief SD-detect signal |
ngtkien | 0:fc80425b677a | 170 | */ |
ngtkien | 0:fc80425b677a | 171 | #define SD_DETECT_PIN GPIO_PIN_13 |
ngtkien | 0:fc80425b677a | 172 | #define SD_DETECT_GPIO_PORT GPIOC |
ngtkien | 0:fc80425b677a | 173 | #define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 174 | #define SD_DETECT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 175 | #define SD_DETECT_EXTI_IRQn EXTI15_10_IRQn |
ngtkien | 0:fc80425b677a | 176 | |
ngtkien | 0:fc80425b677a | 177 | /** |
ngtkien | 0:fc80425b677a | 178 | * @brief Touch screen interrupt signal |
ngtkien | 0:fc80425b677a | 179 | */ |
ngtkien | 0:fc80425b677a | 180 | #define TS_INT_PIN GPIO_PIN_13 |
ngtkien | 0:fc80425b677a | 181 | #define TS_INT_GPIO_PORT GPIOI |
ngtkien | 0:fc80425b677a | 182 | #define TS_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 183 | #define TS_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 184 | #define TS_INT_EXTI_IRQn EXTI15_10_IRQn |
ngtkien | 0:fc80425b677a | 185 | |
ngtkien | 0:fc80425b677a | 186 | /** |
ngtkien | 0:fc80425b677a | 187 | * @} |
ngtkien | 0:fc80425b677a | 188 | */ |
ngtkien | 0:fc80425b677a | 189 | |
ngtkien | 0:fc80425b677a | 190 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_COM |
ngtkien | 0:fc80425b677a | 191 | * @{ |
ngtkien | 0:fc80425b677a | 192 | */ |
ngtkien | 0:fc80425b677a | 193 | #define COMn ((uint8_t)1) |
ngtkien | 0:fc80425b677a | 194 | |
ngtkien | 0:fc80425b677a | 195 | /** |
ngtkien | 0:fc80425b677a | 196 | * @brief Definition for COM port1, connected to USART1 |
ngtkien | 0:fc80425b677a | 197 | */ |
ngtkien | 0:fc80425b677a | 198 | #define DISCOVERY_COM1 USART1 |
ngtkien | 0:fc80425b677a | 199 | #define DISCOVERY_COM1_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 200 | #define DISCOVERY_COM1_CLK_DISABLE() __HAL_RCC_USART1_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 201 | |
ngtkien | 0:fc80425b677a | 202 | #define DISCOVERY_COM1_TX_PIN GPIO_PIN_9 |
ngtkien | 0:fc80425b677a | 203 | #define DISCOVERY_COM1_TX_GPIO_PORT GPIOA |
ngtkien | 0:fc80425b677a | 204 | #define DISCOVERY_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 205 | #define DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 206 | #define DISCOVERY_COM1_TX_AF GPIO_AF7_USART1 |
ngtkien | 0:fc80425b677a | 207 | |
ngtkien | 0:fc80425b677a | 208 | #define DISCOVERY_COM1_RX_PIN GPIO_PIN_7 |
ngtkien | 0:fc80425b677a | 209 | #define DISCOVERY_COM1_RX_GPIO_PORT GPIOB |
ngtkien | 0:fc80425b677a | 210 | #define DISCOVERY_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 211 | #define DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() |
ngtkien | 0:fc80425b677a | 212 | #define DISCOVERY_COM1_RX_AF GPIO_AF7_USART1 |
ngtkien | 0:fc80425b677a | 213 | |
ngtkien | 0:fc80425b677a | 214 | #define DISCOVERY_COM1_IRQn USART1_IRQn |
ngtkien | 0:fc80425b677a | 215 | |
ngtkien | 0:fc80425b677a | 216 | #define DISCOVERY_COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_CLK_ENABLE(); } while(0) |
ngtkien | 0:fc80425b677a | 217 | #define DISCOVERY_COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_CLK_DISABLE() : 0) |
ngtkien | 0:fc80425b677a | 218 | |
ngtkien | 0:fc80425b677a | 219 | #define DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_TX_GPIO_CLK_ENABLE(); } while(0) |
ngtkien | 0:fc80425b677a | 220 | #define DISCOVERY_COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_TX_GPIO_CLK_DISABLE() : 0) |
ngtkien | 0:fc80425b677a | 221 | |
ngtkien | 0:fc80425b677a | 222 | #define DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) DISCOVERY_COM1_RX_GPIO_CLK_ENABLE(); } while(0) |
ngtkien | 0:fc80425b677a | 223 | #define DISCOVERY_COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? DISCOVERY_COM1_RX_GPIO_CLK_DISABLE() : 0) |
ngtkien | 0:fc80425b677a | 224 | |
ngtkien | 0:fc80425b677a | 225 | /* Exported constant IO ------------------------------------------------------*/ |
ngtkien | 0:fc80425b677a | 226 | |
ngtkien | 0:fc80425b677a | 227 | #define LCD_I2C_ADDRESS ((uint16_t)0x70) |
ngtkien | 0:fc80425b677a | 228 | #define CAMERA_I2C_ADDRESS ((uint16_t)0x60) |
ngtkien | 0:fc80425b677a | 229 | #define AUDIO_I2C_ADDRESS ((uint16_t)0x34) |
ngtkien | 0:fc80425b677a | 230 | #define EEPROM_I2C_ADDRESS_A01 ((uint16_t)0xA0) |
ngtkien | 0:fc80425b677a | 231 | #define EEPROM_I2C_ADDRESS_A02 ((uint16_t)0xA6) |
ngtkien | 0:fc80425b677a | 232 | #define TS_I2C_ADDRESS ((uint16_t)0x70) |
ngtkien | 0:fc80425b677a | 233 | |
ngtkien | 0:fc80425b677a | 234 | /* I2C clock speed configuration (in Hz) |
ngtkien | 0:fc80425b677a | 235 | WARNING: |
ngtkien | 0:fc80425b677a | 236 | Make sure that this define is not already declared in other files (ie. |
ngtkien | 0:fc80425b677a | 237 | stm32746g_discovery.h file). It can be used in parallel by other modules. */ |
ngtkien | 0:fc80425b677a | 238 | #ifndef I2C_SPEED |
ngtkien | 0:fc80425b677a | 239 | #define I2C_SPEED ((uint32_t)100000) |
ngtkien | 0:fc80425b677a | 240 | #endif /* I2C_SPEED */ |
ngtkien | 0:fc80425b677a | 241 | |
ngtkien | 0:fc80425b677a | 242 | /* User can use this section to tailor I2Cx/I2Cx instance used and associated |
ngtkien | 0:fc80425b677a | 243 | resources */ |
ngtkien | 0:fc80425b677a | 244 | /* Definition for AUDIO and LCD I2Cx resources */ |
ngtkien | 0:fc80425b677a | 245 | #define DISCOVERY_AUDIO_I2Cx I2C3 |
ngtkien | 0:fc80425b677a | 246 | #define DISCOVERY_AUDIO_I2Cx_CLK_ENABLE() __HAL_RCC_I2C3_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 247 | #define DISCOVERY_AUDIO_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 248 | #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 249 | |
ngtkien | 0:fc80425b677a | 250 | #define DISCOVERY_AUDIO_I2Cx_FORCE_RESET() __HAL_RCC_I2C3_FORCE_RESET() |
ngtkien | 0:fc80425b677a | 251 | #define DISCOVERY_AUDIO_I2Cx_RELEASE_RESET() __HAL_RCC_I2C3_RELEASE_RESET() |
ngtkien | 0:fc80425b677a | 252 | |
ngtkien | 0:fc80425b677a | 253 | /* Definition for I2Cx Pins */ |
ngtkien | 0:fc80425b677a | 254 | #define DISCOVERY_AUDIO_I2Cx_SCL_PIN GPIO_PIN_7 |
ngtkien | 0:fc80425b677a | 255 | #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT GPIOH |
ngtkien | 0:fc80425b677a | 256 | #define DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF GPIO_AF4_I2C3 |
ngtkien | 0:fc80425b677a | 257 | #define DISCOVERY_AUDIO_I2Cx_SDA_PIN GPIO_PIN_8 |
ngtkien | 0:fc80425b677a | 258 | |
ngtkien | 0:fc80425b677a | 259 | /* I2C interrupt requests */ |
ngtkien | 0:fc80425b677a | 260 | #define DISCOVERY_AUDIO_I2Cx_EV_IRQn I2C3_EV_IRQn |
ngtkien | 0:fc80425b677a | 261 | #define DISCOVERY_AUDIO_I2Cx_ER_IRQn I2C3_ER_IRQn |
ngtkien | 0:fc80425b677a | 262 | |
ngtkien | 0:fc80425b677a | 263 | /* Definition for external, camera and Arduino connector I2Cx resources */ |
ngtkien | 0:fc80425b677a | 264 | #define DISCOVERY_EXT_I2Cx I2C1 |
ngtkien | 0:fc80425b677a | 265 | #define DISCOVERY_EXT_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 266 | #define DISCOVERY_EXT_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 267 | #define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() |
ngtkien | 0:fc80425b677a | 268 | |
ngtkien | 0:fc80425b677a | 269 | #define DISCOVERY_EXT_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET() |
ngtkien | 0:fc80425b677a | 270 | #define DISCOVERY_EXT_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET() |
ngtkien | 0:fc80425b677a | 271 | |
ngtkien | 0:fc80425b677a | 272 | /* Definition for I2Cx Pins */ |
ngtkien | 0:fc80425b677a | 273 | #define DISCOVERY_EXT_I2Cx_SCL_PIN GPIO_PIN_8 |
ngtkien | 0:fc80425b677a | 274 | #define DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT GPIOB |
ngtkien | 0:fc80425b677a | 275 | #define DISCOVERY_EXT_I2Cx_SCL_SDA_AF GPIO_AF4_I2C1 |
ngtkien | 0:fc80425b677a | 276 | #define DISCOVERY_EXT_I2Cx_SDA_PIN GPIO_PIN_9 |
ngtkien | 0:fc80425b677a | 277 | |
ngtkien | 0:fc80425b677a | 278 | /* I2C interrupt requests */ |
ngtkien | 0:fc80425b677a | 279 | #define DISCOVERY_EXT_I2Cx_EV_IRQn I2C1_EV_IRQn |
ngtkien | 0:fc80425b677a | 280 | #define DISCOVERY_EXT_I2Cx_ER_IRQn I2C1_ER_IRQn |
ngtkien | 0:fc80425b677a | 281 | |
ngtkien | 0:fc80425b677a | 282 | /* I2C TIMING Register define when I2C clock source is SYSCLK */ |
ngtkien | 0:fc80425b677a | 283 | /* I2C TIMING is calculated from APB1 source clock = 50 MHz */ |
ngtkien | 0:fc80425b677a | 284 | /* Due to the big MOFSET capacity for adapting the camera level the rising time is very large (>1us) */ |
ngtkien | 0:fc80425b677a | 285 | /* 0x40912732 takes in account the big rising and aims a clock of 100khz */ |
ngtkien | 0:fc80425b677a | 286 | #ifndef DISCOVERY_I2Cx_TIMING |
ngtkien | 0:fc80425b677a | 287 | #define DISCOVERY_I2Cx_TIMING ((uint32_t)0x40912732) |
ngtkien | 0:fc80425b677a | 288 | #endif /* DISCOVERY_I2Cx_TIMING */ |
ngtkien | 0:fc80425b677a | 289 | |
ngtkien | 0:fc80425b677a | 290 | /** |
ngtkien | 0:fc80425b677a | 291 | * @} |
ngtkien | 0:fc80425b677a | 292 | */ |
ngtkien | 0:fc80425b677a | 293 | |
ngtkien | 0:fc80425b677a | 294 | /** |
ngtkien | 0:fc80425b677a | 295 | * @} |
ngtkien | 0:fc80425b677a | 296 | */ |
ngtkien | 0:fc80425b677a | 297 | |
ngtkien | 0:fc80425b677a | 298 | /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Macros STM32746G_DISCOVERY_LOW_LEVEL Exported Macros |
ngtkien | 0:fc80425b677a | 299 | * @{ |
ngtkien | 0:fc80425b677a | 300 | */ |
ngtkien | 0:fc80425b677a | 301 | /** |
ngtkien | 0:fc80425b677a | 302 | * @} |
ngtkien | 0:fc80425b677a | 303 | */ |
ngtkien | 0:fc80425b677a | 304 | |
ngtkien | 0:fc80425b677a | 305 | /** @addtogroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Functions |
ngtkien | 0:fc80425b677a | 306 | * @{ |
ngtkien | 0:fc80425b677a | 307 | */ |
ngtkien | 0:fc80425b677a | 308 | uint32_t BSP_GetVersion(void); |
ngtkien | 0:fc80425b677a | 309 | void BSP_LED_Init(Led_TypeDef Led); |
ngtkien | 0:fc80425b677a | 310 | void BSP_LED_DeInit(Led_TypeDef Led); |
ngtkien | 0:fc80425b677a | 311 | void BSP_LED_On(Led_TypeDef Led); |
ngtkien | 0:fc80425b677a | 312 | void BSP_LED_Off(Led_TypeDef Led); |
ngtkien | 0:fc80425b677a | 313 | void BSP_LED_Toggle(Led_TypeDef Led); |
ngtkien | 0:fc80425b677a | 314 | void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode); |
ngtkien | 0:fc80425b677a | 315 | void BSP_PB_DeInit(Button_TypeDef Button); |
ngtkien | 0:fc80425b677a | 316 | uint32_t BSP_PB_GetState(Button_TypeDef Button); |
ngtkien | 0:fc80425b677a | 317 | void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart); |
ngtkien | 0:fc80425b677a | 318 | void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart); |
ngtkien | 0:fc80425b677a | 319 | |
ngtkien | 0:fc80425b677a | 320 | /** |
ngtkien | 0:fc80425b677a | 321 | * @} |
ngtkien | 0:fc80425b677a | 322 | */ |
ngtkien | 0:fc80425b677a | 323 | |
ngtkien | 0:fc80425b677a | 324 | /** |
ngtkien | 0:fc80425b677a | 325 | * @} |
ngtkien | 0:fc80425b677a | 326 | */ |
ngtkien | 0:fc80425b677a | 327 | |
ngtkien | 0:fc80425b677a | 328 | /** |
ngtkien | 0:fc80425b677a | 329 | * @} |
ngtkien | 0:fc80425b677a | 330 | */ |
ngtkien | 0:fc80425b677a | 331 | |
ngtkien | 0:fc80425b677a | 332 | /** |
ngtkien | 0:fc80425b677a | 333 | * @} |
ngtkien | 0:fc80425b677a | 334 | */ |
ngtkien | 0:fc80425b677a | 335 | |
ngtkien | 0:fc80425b677a | 336 | #ifdef __cplusplus |
ngtkien | 0:fc80425b677a | 337 | } |
ngtkien | 0:fc80425b677a | 338 | #endif |
ngtkien | 0:fc80425b677a | 339 | |
ngtkien | 0:fc80425b677a | 340 | #endif /* __STM32746G_DISCOVERY_H */ |
ngtkien | 0:fc80425b677a | 341 | |
ngtkien | 0:fc80425b677a | 342 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |