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