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