Projet

Dependents:   DISCO-F746NG_Scope_copy

Fork of BSP_DISCO_F746NG by ST

Committer:
1536082
Date:
Tue Jun 05 19:44:28 2018 +0000
Revision:
10:32ce84f82a72
Parent:
0:c9112f0c67e3
Child:
5:5a395e126678
Projet

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:c9112f0c67e3 1 /**
bcostm 0:c9112f0c67e3 2 ******************************************************************************
bcostm 0:c9112f0c67e3 3 * @file stm32746g_discovery.c
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 provides a set of firmware functions to manage LEDs,
bcostm 0:c9112f0c67e3 8 * push-buttons and COM ports available on STM32746G-Discovery
bcostm 0:c9112f0c67e3 9 * board(MB1191) from STMicroelectronics.
bcostm 0:c9112f0c67e3 10 ******************************************************************************
bcostm 0:c9112f0c67e3 11 * @attention
bcostm 0:c9112f0c67e3 12 *
bcostm 0:c9112f0c67e3 13 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 0:c9112f0c67e3 14 *
bcostm 0:c9112f0c67e3 15 * Redistribution and use in source and binary forms, with or without modification,
bcostm 0:c9112f0c67e3 16 * are permitted provided that the following conditions are met:
bcostm 0:c9112f0c67e3 17 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 0:c9112f0c67e3 18 * this list of conditions and the following disclaimer.
bcostm 0:c9112f0c67e3 19 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 0:c9112f0c67e3 20 * this list of conditions and the following disclaimer in the documentation
bcostm 0:c9112f0c67e3 21 * and/or other materials provided with the distribution.
bcostm 0:c9112f0c67e3 22 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 0:c9112f0c67e3 23 * may be used to endorse or promote products derived from this software
bcostm 0:c9112f0c67e3 24 * without specific prior written permission.
bcostm 0:c9112f0c67e3 25 *
bcostm 0:c9112f0c67e3 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 0:c9112f0c67e3 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 0:c9112f0c67e3 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 0:c9112f0c67e3 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 0:c9112f0c67e3 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 0:c9112f0c67e3 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 0:c9112f0c67e3 32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 0:c9112f0c67e3 33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 0:c9112f0c67e3 34 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 0:c9112f0c67e3 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 0:c9112f0c67e3 36 *
bcostm 0:c9112f0c67e3 37 ******************************************************************************
bcostm 0:c9112f0c67e3 38 */
bcostm 0:c9112f0c67e3 39
bcostm 0:c9112f0c67e3 40 /* Includes ------------------------------------------------------------------*/
bcostm 0:c9112f0c67e3 41 #include "stm32746g_discovery.h"
bcostm 0:c9112f0c67e3 42
bcostm 0:c9112f0c67e3 43 // mbed function to replace HAL_Delay function
bcostm 0:c9112f0c67e3 44 void wait_ms(int ms);
bcostm 0:c9112f0c67e3 45
bcostm 0:c9112f0c67e3 46 /** @addtogroup BSP
bcostm 0:c9112f0c67e3 47 * @{
bcostm 0:c9112f0c67e3 48 */
bcostm 0:c9112f0c67e3 49
bcostm 0:c9112f0c67e3 50 /** @addtogroup STM32746G_DISCOVERY
bcostm 0:c9112f0c67e3 51 * @{
bcostm 0:c9112f0c67e3 52 */
bcostm 0:c9112f0c67e3 53
bcostm 0:c9112f0c67e3 54 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL STM32746G_DISCOVERY_LOW_LEVEL
bcostm 0:c9112f0c67e3 55 * @{
bcostm 0:c9112f0c67e3 56 */
bcostm 0:c9112f0c67e3 57
bcostm 0:c9112f0c67e3 58 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_TypesDefinitions STM32746G_DISCOVERY_LOW_LEVEL Private Types Definitions
bcostm 0:c9112f0c67e3 59 * @{
bcostm 0:c9112f0c67e3 60 */
bcostm 0:c9112f0c67e3 61 /**
bcostm 0:c9112f0c67e3 62 * @}
bcostm 0:c9112f0c67e3 63 */
bcostm 0:c9112f0c67e3 64
bcostm 0:c9112f0c67e3 65 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_Defines STM32746G_DISCOVERY_LOW_LEVEL Private Defines
bcostm 0:c9112f0c67e3 66 * @{
bcostm 0:c9112f0c67e3 67 */
bcostm 0:c9112f0c67e3 68 /**
bcostm 0:c9112f0c67e3 69 * @brief STM32746G DISCOVERY BSP Driver version number V1.0.0
bcostm 0:c9112f0c67e3 70 */
bcostm 0:c9112f0c67e3 71 #define __STM32746G_DISCO_BSP_VERSION_MAIN (0x01) /*!< [31:24] main version */
bcostm 0:c9112f0c67e3 72 #define __STM32746G_DISCO_BSP_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
bcostm 0:c9112f0c67e3 73 #define __STM32746G_DISCO_BSP_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
bcostm 0:c9112f0c67e3 74 #define __STM32746G_DISCO_BSP_VERSION_RC (0x00) /*!< [7:0] release candidate */
bcostm 0:c9112f0c67e3 75 #define __STM32746G_DISCO_BSP_VERSION ((__STM32746G_DISCO_BSP_VERSION_MAIN << 24)\
bcostm 0:c9112f0c67e3 76 |(__STM32746G_DISCO_BSP_VERSION_SUB1 << 16)\
bcostm 0:c9112f0c67e3 77 |(__STM32746G_DISCO_BSP_VERSION_SUB2 << 8 )\
bcostm 0:c9112f0c67e3 78 |(__STM32746G_DISCO_BSP_VERSION_RC))
bcostm 0:c9112f0c67e3 79 /**
bcostm 0:c9112f0c67e3 80 * @}
bcostm 0:c9112f0c67e3 81 */
bcostm 0:c9112f0c67e3 82
bcostm 0:c9112f0c67e3 83 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_Macros STM32746G_DISCOVERY_LOW_LEVEL Private Macros
bcostm 0:c9112f0c67e3 84 * @{
bcostm 0:c9112f0c67e3 85 */
bcostm 0:c9112f0c67e3 86 /**
bcostm 0:c9112f0c67e3 87 * @}
bcostm 0:c9112f0c67e3 88 */
bcostm 0:c9112f0c67e3 89
bcostm 0:c9112f0c67e3 90 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_Variables STM32746G_DISCOVERY_LOW_LEVEL Private Variables
bcostm 0:c9112f0c67e3 91 * @{
bcostm 0:c9112f0c67e3 92 */
bcostm 0:c9112f0c67e3 93
bcostm 0:c9112f0c67e3 94 const uint32_t GPIO_PIN[LEDn] = {LED1_PIN};
bcostm 0:c9112f0c67e3 95
bcostm 0:c9112f0c67e3 96 GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT,
bcostm 0:c9112f0c67e3 97 TAMPER_BUTTON_GPIO_PORT,
bcostm 0:c9112f0c67e3 98 KEY_BUTTON_GPIO_PORT};
bcostm 0:c9112f0c67e3 99
bcostm 0:c9112f0c67e3 100 const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN,
bcostm 0:c9112f0c67e3 101 TAMPER_BUTTON_PIN,
bcostm 0:c9112f0c67e3 102 KEY_BUTTON_PIN};
bcostm 0:c9112f0c67e3 103
bcostm 0:c9112f0c67e3 104 const uint16_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn,
bcostm 0:c9112f0c67e3 105 TAMPER_BUTTON_EXTI_IRQn,
bcostm 0:c9112f0c67e3 106 KEY_BUTTON_EXTI_IRQn};
bcostm 0:c9112f0c67e3 107
bcostm 0:c9112f0c67e3 108 USART_TypeDef* COM_USART[COMn] = {DISCOVERY_COM1};
bcostm 0:c9112f0c67e3 109
bcostm 0:c9112f0c67e3 110 GPIO_TypeDef* COM_TX_PORT[COMn] = {DISCOVERY_COM1_TX_GPIO_PORT};
bcostm 0:c9112f0c67e3 111
bcostm 0:c9112f0c67e3 112 GPIO_TypeDef* COM_RX_PORT[COMn] = {DISCOVERY_COM1_RX_GPIO_PORT};
bcostm 0:c9112f0c67e3 113
bcostm 0:c9112f0c67e3 114 const uint16_t COM_TX_PIN[COMn] = {DISCOVERY_COM1_TX_PIN};
bcostm 0:c9112f0c67e3 115
bcostm 0:c9112f0c67e3 116 const uint16_t COM_RX_PIN[COMn] = {DISCOVERY_COM1_RX_PIN};
bcostm 0:c9112f0c67e3 117
bcostm 0:c9112f0c67e3 118 const uint16_t COM_TX_AF[COMn] = {DISCOVERY_COM1_TX_AF};
bcostm 0:c9112f0c67e3 119
bcostm 0:c9112f0c67e3 120 const uint16_t COM_RX_AF[COMn] = {DISCOVERY_COM1_RX_AF};
bcostm 0:c9112f0c67e3 121
bcostm 0:c9112f0c67e3 122 static I2C_HandleTypeDef hI2cAudioHandler = {0};
bcostm 0:c9112f0c67e3 123 static I2C_HandleTypeDef hI2cExtHandler = {0};
bcostm 0:c9112f0c67e3 124
bcostm 0:c9112f0c67e3 125 /**
bcostm 0:c9112f0c67e3 126 * @}
bcostm 0:c9112f0c67e3 127 */
bcostm 0:c9112f0c67e3 128
bcostm 0:c9112f0c67e3 129 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_FunctionPrototypes STM32746G_DISCOVERY_LOW_LEVEL Private Function Prototypes
bcostm 0:c9112f0c67e3 130 * @{
bcostm 0:c9112f0c67e3 131 */
bcostm 0:c9112f0c67e3 132 static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler);
bcostm 0:c9112f0c67e3 133 static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler);
bcostm 0:c9112f0c67e3 134
bcostm 0:c9112f0c67e3 135 static HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
bcostm 0:c9112f0c67e3 136 static HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
bcostm 0:c9112f0c67e3 137 static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials);
bcostm 0:c9112f0c67e3 138 static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr);
bcostm 0:c9112f0c67e3 139
bcostm 0:c9112f0c67e3 140 /* AUDIO IO functions */
bcostm 0:c9112f0c67e3 141 void AUDIO_IO_Init(void);
bcostm 0:c9112f0c67e3 142 void AUDIO_IO_DeInit(void);
bcostm 0:c9112f0c67e3 143 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
bcostm 0:c9112f0c67e3 144 uint16_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
bcostm 0:c9112f0c67e3 145 void AUDIO_IO_Delay(uint32_t Delay);
bcostm 0:c9112f0c67e3 146
bcostm 0:c9112f0c67e3 147 /* TOUCHSCREEN IO functions */
bcostm 0:c9112f0c67e3 148 void TS_IO_Init(void);
bcostm 0:c9112f0c67e3 149 void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 0:c9112f0c67e3 150 uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 0:c9112f0c67e3 151 void TS_IO_Delay(uint32_t Delay);
bcostm 0:c9112f0c67e3 152
bcostm 0:c9112f0c67e3 153 /* CAMERA IO functions */
bcostm 0:c9112f0c67e3 154 void CAMERA_IO_Init(void);
bcostm 0:c9112f0c67e3 155 void CAMERA_Delay(uint32_t Delay);
bcostm 0:c9112f0c67e3 156 void CAMERA_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 0:c9112f0c67e3 157 uint8_t CAMERA_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 0:c9112f0c67e3 158
bcostm 0:c9112f0c67e3 159 /* I2C EEPROM IO function */
bcostm 0:c9112f0c67e3 160 void EEPROM_IO_Init(void);
bcostm 0:c9112f0c67e3 161 HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
bcostm 0:c9112f0c67e3 162 HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
bcostm 0:c9112f0c67e3 163 HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
bcostm 0:c9112f0c67e3 164 /**
bcostm 0:c9112f0c67e3 165 * @}
bcostm 0:c9112f0c67e3 166 */
bcostm 0:c9112f0c67e3 167
bcostm 0:c9112f0c67e3 168 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Functions STM32746G_DISCOVERY_LOW_LEVELSTM32746G_DISCOVERY_LOW_LEVEL Exported Functions
bcostm 0:c9112f0c67e3 169 * @{
bcostm 0:c9112f0c67e3 170 */
bcostm 0:c9112f0c67e3 171
bcostm 0:c9112f0c67e3 172 /**
bcostm 0:c9112f0c67e3 173 * @brief This method returns the STM32746G DISCOVERY BSP Driver revision
bcostm 0:c9112f0c67e3 174 * @retval version: 0xXYZR (8bits for each decimal, R for RC)
bcostm 0:c9112f0c67e3 175 */
bcostm 0:c9112f0c67e3 176 uint32_t BSP_GetVersion(void)
bcostm 0:c9112f0c67e3 177 {
bcostm 0:c9112f0c67e3 178 return __STM32746G_DISCO_BSP_VERSION;
bcostm 0:c9112f0c67e3 179 }
bcostm 0:c9112f0c67e3 180
bcostm 0:c9112f0c67e3 181 /**
bcostm 0:c9112f0c67e3 182 * @brief Configures LED on GPIO.
bcostm 0:c9112f0c67e3 183 * @param Led: LED to be configured.
bcostm 0:c9112f0c67e3 184 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 185 * @arg LED1
bcostm 0:c9112f0c67e3 186 * @retval None
bcostm 0:c9112f0c67e3 187 */
bcostm 0:c9112f0c67e3 188 void BSP_LED_Init(Led_TypeDef Led)
bcostm 0:c9112f0c67e3 189 {
bcostm 0:c9112f0c67e3 190 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 191 GPIO_TypeDef* gpio_led;
bcostm 0:c9112f0c67e3 192
bcostm 0:c9112f0c67e3 193 if (Led == DISCO_LED1)
bcostm 0:c9112f0c67e3 194 {
bcostm 0:c9112f0c67e3 195 gpio_led = LED1_GPIO_PORT;
bcostm 0:c9112f0c67e3 196 /* Enable the GPIO_LED clock */
bcostm 0:c9112f0c67e3 197 LED1_GPIO_CLK_ENABLE();
bcostm 0:c9112f0c67e3 198
bcostm 0:c9112f0c67e3 199 /* Configure the GPIO_LED pin */
bcostm 0:c9112f0c67e3 200 gpio_init_structure.Pin = GPIO_PIN[Led];
bcostm 0:c9112f0c67e3 201 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
bcostm 0:c9112f0c67e3 202 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 0:c9112f0c67e3 203 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 0:c9112f0c67e3 204
bcostm 0:c9112f0c67e3 205 HAL_GPIO_Init(gpio_led, &gpio_init_structure);
bcostm 0:c9112f0c67e3 206
bcostm 0:c9112f0c67e3 207 /* By default, turn off LED */
bcostm 0:c9112f0c67e3 208 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 0:c9112f0c67e3 209 }
bcostm 0:c9112f0c67e3 210 }
bcostm 0:c9112f0c67e3 211
bcostm 0:c9112f0c67e3 212 /**
bcostm 0:c9112f0c67e3 213 * @brief DeInit LEDs.
bcostm 0:c9112f0c67e3 214 * @param Led: LED to be configured.
bcostm 0:c9112f0c67e3 215 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 216 * @arg LED1
bcostm 0:c9112f0c67e3 217 * @note Led DeInit does not disable the GPIO clock
bcostm 0:c9112f0c67e3 218 * @retval None
bcostm 0:c9112f0c67e3 219 */
bcostm 0:c9112f0c67e3 220 void BSP_LED_DeInit(Led_TypeDef Led)
bcostm 0:c9112f0c67e3 221 {
bcostm 0:c9112f0c67e3 222 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 223 GPIO_TypeDef* gpio_led;
bcostm 0:c9112f0c67e3 224
bcostm 0:c9112f0c67e3 225 if (Led == DISCO_LED1)
bcostm 0:c9112f0c67e3 226 {
bcostm 0:c9112f0c67e3 227 gpio_led = LED1_GPIO_PORT;
bcostm 0:c9112f0c67e3 228 /* Turn off LED */
bcostm 0:c9112f0c67e3 229 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 0:c9112f0c67e3 230 /* Configure the GPIO_LED pin */
bcostm 0:c9112f0c67e3 231 gpio_init_structure.Pin = GPIO_PIN[Led];
bcostm 0:c9112f0c67e3 232 HAL_GPIO_DeInit(gpio_led, gpio_init_structure.Pin);
bcostm 0:c9112f0c67e3 233 }
bcostm 0:c9112f0c67e3 234 }
bcostm 0:c9112f0c67e3 235
bcostm 0:c9112f0c67e3 236 /**
bcostm 0:c9112f0c67e3 237 * @brief Turns selected LED On.
bcostm 0:c9112f0c67e3 238 * @param Led: LED to be set on
bcostm 0:c9112f0c67e3 239 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 240 * @arg LED1
bcostm 0:c9112f0c67e3 241 * @retval None
bcostm 0:c9112f0c67e3 242 */
bcostm 0:c9112f0c67e3 243 void BSP_LED_On(Led_TypeDef Led)
bcostm 0:c9112f0c67e3 244 {
bcostm 0:c9112f0c67e3 245 GPIO_TypeDef* gpio_led;
bcostm 0:c9112f0c67e3 246
bcostm 0:c9112f0c67e3 247 if (Led == DISCO_LED1) /* Switch On LED connected to GPIO */
bcostm 0:c9112f0c67e3 248 {
bcostm 0:c9112f0c67e3 249 gpio_led = LED1_GPIO_PORT;
bcostm 0:c9112f0c67e3 250 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_SET);
bcostm 0:c9112f0c67e3 251 }
bcostm 0:c9112f0c67e3 252 }
bcostm 0:c9112f0c67e3 253
bcostm 0:c9112f0c67e3 254 /**
bcostm 0:c9112f0c67e3 255 * @brief Turns selected LED Off.
bcostm 0:c9112f0c67e3 256 * @param Led: LED to be set off
bcostm 0:c9112f0c67e3 257 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 258 * @arg LED1
bcostm 0:c9112f0c67e3 259 * @retval None
bcostm 0:c9112f0c67e3 260 */
bcostm 0:c9112f0c67e3 261 void BSP_LED_Off(Led_TypeDef Led)
bcostm 0:c9112f0c67e3 262 {
bcostm 0:c9112f0c67e3 263 GPIO_TypeDef* gpio_led;
bcostm 0:c9112f0c67e3 264
bcostm 0:c9112f0c67e3 265 if (Led == DISCO_LED1) /* Switch Off LED connected to GPIO */
bcostm 0:c9112f0c67e3 266 {
bcostm 0:c9112f0c67e3 267 gpio_led = LED1_GPIO_PORT;
bcostm 0:c9112f0c67e3 268 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 0:c9112f0c67e3 269 }
bcostm 0:c9112f0c67e3 270 }
bcostm 0:c9112f0c67e3 271
bcostm 0:c9112f0c67e3 272 /**
bcostm 0:c9112f0c67e3 273 * @brief Toggles the selected LED.
bcostm 0:c9112f0c67e3 274 * @param Led: LED to be toggled
bcostm 0:c9112f0c67e3 275 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 276 * @arg LED1
bcostm 0:c9112f0c67e3 277 * @retval None
bcostm 0:c9112f0c67e3 278 */
bcostm 0:c9112f0c67e3 279 void BSP_LED_Toggle(Led_TypeDef Led)
bcostm 0:c9112f0c67e3 280 {
bcostm 0:c9112f0c67e3 281 GPIO_TypeDef* gpio_led;
bcostm 0:c9112f0c67e3 282
bcostm 0:c9112f0c67e3 283 if (Led == DISCO_LED1) /* Toggle LED connected to GPIO */
bcostm 0:c9112f0c67e3 284 {
bcostm 0:c9112f0c67e3 285 gpio_led = LED1_GPIO_PORT;
bcostm 0:c9112f0c67e3 286 HAL_GPIO_TogglePin(gpio_led, GPIO_PIN[Led]);
bcostm 0:c9112f0c67e3 287 }
bcostm 0:c9112f0c67e3 288 }
bcostm 0:c9112f0c67e3 289
bcostm 0:c9112f0c67e3 290 /**
bcostm 0:c9112f0c67e3 291 * @brief Configures button GPIO and EXTI Line.
bcostm 0:c9112f0c67e3 292 * @param Button: Button to be configured
bcostm 0:c9112f0c67e3 293 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 294 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 0:c9112f0c67e3 295 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 0:c9112f0c67e3 296 * @arg BUTTON_KEY: Key Push Button
bcostm 0:c9112f0c67e3 297 * @param ButtonMode: Button mode
bcostm 0:c9112f0c67e3 298 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 299 * @arg BUTTON_MODE_GPIO: Button will be used as simple IO
bcostm 0:c9112f0c67e3 300 * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
bcostm 0:c9112f0c67e3 301 * with interrupt generation capability
bcostm 0:c9112f0c67e3 302 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 0:c9112f0c67e3 303 * are mapped on the same push button named "User"
bcostm 0:c9112f0c67e3 304 * on the board serigraphy.
bcostm 0:c9112f0c67e3 305 * @retval None
bcostm 0:c9112f0c67e3 306 */
bcostm 0:c9112f0c67e3 307 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
bcostm 0:c9112f0c67e3 308 {
bcostm 0:c9112f0c67e3 309 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 310
bcostm 0:c9112f0c67e3 311 /* Enable the BUTTON clock */
bcostm 0:c9112f0c67e3 312 BUTTONx_GPIO_CLK_ENABLE(Button);
bcostm 0:c9112f0c67e3 313
bcostm 0:c9112f0c67e3 314 if(ButtonMode == BUTTON_MODE_GPIO)
bcostm 0:c9112f0c67e3 315 {
bcostm 0:c9112f0c67e3 316 /* Configure Button pin as input */
bcostm 0:c9112f0c67e3 317 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 0:c9112f0c67e3 318 gpio_init_structure.Mode = GPIO_MODE_INPUT;
bcostm 0:c9112f0c67e3 319 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 0:c9112f0c67e3 320 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 0:c9112f0c67e3 321 HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
bcostm 0:c9112f0c67e3 322 }
bcostm 0:c9112f0c67e3 323
bcostm 0:c9112f0c67e3 324 if(ButtonMode == BUTTON_MODE_EXTI)
bcostm 0:c9112f0c67e3 325 {
bcostm 0:c9112f0c67e3 326 /* Configure Button pin as input with External interrupt */
bcostm 0:c9112f0c67e3 327 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 0:c9112f0c67e3 328 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 0:c9112f0c67e3 329 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 0:c9112f0c67e3 330
bcostm 0:c9112f0c67e3 331 if(Button != BUTTON_WAKEUP)
bcostm 0:c9112f0c67e3 332 {
bcostm 0:c9112f0c67e3 333 gpio_init_structure.Mode = GPIO_MODE_IT_FALLING;
bcostm 0:c9112f0c67e3 334 }
bcostm 0:c9112f0c67e3 335 else
bcostm 0:c9112f0c67e3 336 {
bcostm 0:c9112f0c67e3 337 gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
bcostm 0:c9112f0c67e3 338 }
bcostm 0:c9112f0c67e3 339
bcostm 0:c9112f0c67e3 340 HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
bcostm 0:c9112f0c67e3 341
bcostm 0:c9112f0c67e3 342 /* Enable and set Button EXTI Interrupt to the lowest priority */
bcostm 0:c9112f0c67e3 343 HAL_NVIC_SetPriority((IRQn_Type)(BUTTON_IRQn[Button]), 0x0F, 0x00);
bcostm 0:c9112f0c67e3 344 HAL_NVIC_EnableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
bcostm 0:c9112f0c67e3 345 }
bcostm 0:c9112f0c67e3 346 }
bcostm 0:c9112f0c67e3 347
bcostm 0:c9112f0c67e3 348 /**
bcostm 0:c9112f0c67e3 349 * @brief Push Button DeInit.
bcostm 0:c9112f0c67e3 350 * @param Button: Button to be configured
bcostm 0:c9112f0c67e3 351 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 352 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 0:c9112f0c67e3 353 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 0:c9112f0c67e3 354 * @arg BUTTON_KEY: Key Push Button
bcostm 0:c9112f0c67e3 355 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 0:c9112f0c67e3 356 * are mapped on the same push button named "User"
bcostm 0:c9112f0c67e3 357 * on the board serigraphy.
bcostm 0:c9112f0c67e3 358 * @note PB DeInit does not disable the GPIO clock
bcostm 0:c9112f0c67e3 359 * @retval None
bcostm 0:c9112f0c67e3 360 */
bcostm 0:c9112f0c67e3 361 void BSP_PB_DeInit(Button_TypeDef Button)
bcostm 0:c9112f0c67e3 362 {
bcostm 0:c9112f0c67e3 363 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 364
bcostm 0:c9112f0c67e3 365 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 0:c9112f0c67e3 366 HAL_NVIC_DisableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
bcostm 0:c9112f0c67e3 367 HAL_GPIO_DeInit(BUTTON_PORT[Button], gpio_init_structure.Pin);
bcostm 0:c9112f0c67e3 368 }
bcostm 0:c9112f0c67e3 369
bcostm 0:c9112f0c67e3 370
bcostm 0:c9112f0c67e3 371 /**
bcostm 0:c9112f0c67e3 372 * @brief Returns the selected button state.
bcostm 0:c9112f0c67e3 373 * @param Button: Button to be checked
bcostm 0:c9112f0c67e3 374 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 375 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 0:c9112f0c67e3 376 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 0:c9112f0c67e3 377 * @arg BUTTON_KEY: Key Push Button
bcostm 0:c9112f0c67e3 378 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 0:c9112f0c67e3 379 * are mapped on the same push button named "User"
bcostm 0:c9112f0c67e3 380 * on the board serigraphy.
bcostm 0:c9112f0c67e3 381 * @retval The Button GPIO pin value
bcostm 0:c9112f0c67e3 382 */
bcostm 0:c9112f0c67e3 383 uint32_t BSP_PB_GetState(Button_TypeDef Button)
bcostm 0:c9112f0c67e3 384 {
bcostm 0:c9112f0c67e3 385 return HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
bcostm 0:c9112f0c67e3 386 }
bcostm 0:c9112f0c67e3 387
bcostm 0:c9112f0c67e3 388 /**
bcostm 0:c9112f0c67e3 389 * @brief Configures COM port.
bcostm 0:c9112f0c67e3 390 * @param COM: COM port to be configured.
bcostm 0:c9112f0c67e3 391 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 392 * @arg COM1
bcostm 0:c9112f0c67e3 393 * @arg COM2
bcostm 0:c9112f0c67e3 394 * @param huart: Pointer to a UART_HandleTypeDef structure that contains the
bcostm 0:c9112f0c67e3 395 * configuration information for the specified USART peripheral.
bcostm 0:c9112f0c67e3 396 * @retval None
bcostm 0:c9112f0c67e3 397 */
bcostm 0:c9112f0c67e3 398 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *huart)
bcostm 0:c9112f0c67e3 399 {
bcostm 0:c9112f0c67e3 400 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 401
bcostm 0:c9112f0c67e3 402 /* Enable GPIO clock */
bcostm 0:c9112f0c67e3 403 DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(COM);
bcostm 0:c9112f0c67e3 404 DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(COM);
bcostm 0:c9112f0c67e3 405
bcostm 0:c9112f0c67e3 406 /* Enable USART clock */
bcostm 0:c9112f0c67e3 407 DISCOVERY_COMx_CLK_ENABLE(COM);
bcostm 0:c9112f0c67e3 408
bcostm 0:c9112f0c67e3 409 /* Configure USART Tx as alternate function */
bcostm 0:c9112f0c67e3 410 gpio_init_structure.Pin = COM_TX_PIN[COM];
bcostm 0:c9112f0c67e3 411 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 0:c9112f0c67e3 412 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 0:c9112f0c67e3 413 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 0:c9112f0c67e3 414 gpio_init_structure.Alternate = COM_TX_AF[COM];
bcostm 0:c9112f0c67e3 415 HAL_GPIO_Init(COM_TX_PORT[COM], &gpio_init_structure);
bcostm 0:c9112f0c67e3 416
bcostm 0:c9112f0c67e3 417 /* Configure USART Rx as alternate function */
bcostm 0:c9112f0c67e3 418 gpio_init_structure.Pin = COM_RX_PIN[COM];
bcostm 0:c9112f0c67e3 419 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 0:c9112f0c67e3 420 gpio_init_structure.Alternate = COM_RX_AF[COM];
bcostm 0:c9112f0c67e3 421 HAL_GPIO_Init(COM_RX_PORT[COM], &gpio_init_structure);
bcostm 0:c9112f0c67e3 422
bcostm 0:c9112f0c67e3 423 /* USART configuration */
bcostm 0:c9112f0c67e3 424 huart->Instance = COM_USART[COM];
bcostm 0:c9112f0c67e3 425 HAL_UART_Init(huart);
bcostm 0:c9112f0c67e3 426 }
bcostm 0:c9112f0c67e3 427
bcostm 0:c9112f0c67e3 428 /**
bcostm 0:c9112f0c67e3 429 * @brief DeInit COM port.
bcostm 0:c9112f0c67e3 430 * @param COM: COM port to be configured.
bcostm 0:c9112f0c67e3 431 * This parameter can be one of the following values:
bcostm 0:c9112f0c67e3 432 * @arg COM1
bcostm 0:c9112f0c67e3 433 * @arg COM2
bcostm 0:c9112f0c67e3 434 * @param huart: Pointer to a UART_HandleTypeDef structure that contains the
bcostm 0:c9112f0c67e3 435 * configuration information for the specified USART peripheral.
bcostm 0:c9112f0c67e3 436 * @retval None
bcostm 0:c9112f0c67e3 437 */
bcostm 0:c9112f0c67e3 438 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart)
bcostm 0:c9112f0c67e3 439 {
bcostm 0:c9112f0c67e3 440 /* USART configuration */
bcostm 0:c9112f0c67e3 441 huart->Instance = COM_USART[COM];
bcostm 0:c9112f0c67e3 442 HAL_UART_DeInit(huart);
bcostm 0:c9112f0c67e3 443
bcostm 0:c9112f0c67e3 444 /* Enable USART clock */
bcostm 0:c9112f0c67e3 445 DISCOVERY_COMx_CLK_DISABLE(COM);
bcostm 0:c9112f0c67e3 446
bcostm 0:c9112f0c67e3 447 /* DeInit GPIO pins can be done in the application
bcostm 0:c9112f0c67e3 448 (by surcharging this __weak function) */
bcostm 0:c9112f0c67e3 449
bcostm 0:c9112f0c67e3 450 /* GPIO pins clock, DMA clock can be shut down in the application
bcostm 0:c9112f0c67e3 451 by surcharging this __weak function */
bcostm 0:c9112f0c67e3 452 }
bcostm 0:c9112f0c67e3 453
bcostm 0:c9112f0c67e3 454 /*******************************************************************************
bcostm 0:c9112f0c67e3 455 BUS OPERATIONS
bcostm 0:c9112f0c67e3 456 *******************************************************************************/
bcostm 0:c9112f0c67e3 457
bcostm 0:c9112f0c67e3 458 /******************************* I2C Routines *********************************/
bcostm 0:c9112f0c67e3 459 /**
bcostm 0:c9112f0c67e3 460 * @brief Initializes I2C MSP.
bcostm 0:c9112f0c67e3 461 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 462 * @retval None
bcostm 0:c9112f0c67e3 463 */
bcostm 0:c9112f0c67e3 464 static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler)
bcostm 0:c9112f0c67e3 465 {
bcostm 0:c9112f0c67e3 466 GPIO_InitTypeDef gpio_init_structure;
bcostm 0:c9112f0c67e3 467
bcostm 0:c9112f0c67e3 468 if (i2c_handler == (I2C_HandleTypeDef*)(&hI2cAudioHandler))
bcostm 0:c9112f0c67e3 469 {
bcostm 0:c9112f0c67e3 470 /* AUDIO and LCD I2C MSP init */
bcostm 0:c9112f0c67e3 471
bcostm 0:c9112f0c67e3 472 /*** Configure the GPIOs ***/
bcostm 0:c9112f0c67e3 473 /* Enable GPIO clock */
bcostm 0:c9112f0c67e3 474 DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
bcostm 0:c9112f0c67e3 475
bcostm 0:c9112f0c67e3 476 /* Configure I2C Tx as alternate function */
bcostm 0:c9112f0c67e3 477 gpio_init_structure.Pin = DISCOVERY_AUDIO_I2Cx_SCL_PIN;
bcostm 0:c9112f0c67e3 478 gpio_init_structure.Mode = GPIO_MODE_AF_OD;
bcostm 0:c9112f0c67e3 479 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 0:c9112f0c67e3 480 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 0:c9112f0c67e3 481 gpio_init_structure.Alternate = DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF;
bcostm 0:c9112f0c67e3 482 HAL_GPIO_Init(DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 0:c9112f0c67e3 483
bcostm 0:c9112f0c67e3 484 /* Configure I2C Rx as alternate function */
bcostm 0:c9112f0c67e3 485 gpio_init_structure.Pin = DISCOVERY_AUDIO_I2Cx_SDA_PIN;
bcostm 0:c9112f0c67e3 486 HAL_GPIO_Init(DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 0:c9112f0c67e3 487
bcostm 0:c9112f0c67e3 488 /*** Configure the I2C peripheral ***/
bcostm 0:c9112f0c67e3 489 /* Enable I2C clock */
bcostm 0:c9112f0c67e3 490 DISCOVERY_AUDIO_I2Cx_CLK_ENABLE();
bcostm 0:c9112f0c67e3 491
bcostm 0:c9112f0c67e3 492 /* Force the I2C peripheral clock reset */
bcostm 0:c9112f0c67e3 493 DISCOVERY_AUDIO_I2Cx_FORCE_RESET();
bcostm 0:c9112f0c67e3 494
bcostm 0:c9112f0c67e3 495 /* Release the I2C peripheral clock reset */
bcostm 0:c9112f0c67e3 496 DISCOVERY_AUDIO_I2Cx_RELEASE_RESET();
bcostm 0:c9112f0c67e3 497
bcostm 0:c9112f0c67e3 498 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 0:c9112f0c67e3 499 HAL_NVIC_SetPriority(DISCOVERY_AUDIO_I2Cx_EV_IRQn, 0x05, 0);
bcostm 0:c9112f0c67e3 500 HAL_NVIC_EnableIRQ(DISCOVERY_AUDIO_I2Cx_EV_IRQn);
bcostm 0:c9112f0c67e3 501
bcostm 0:c9112f0c67e3 502 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 0:c9112f0c67e3 503 HAL_NVIC_SetPriority(DISCOVERY_AUDIO_I2Cx_ER_IRQn, 0x05, 0);
bcostm 0:c9112f0c67e3 504 HAL_NVIC_EnableIRQ(DISCOVERY_AUDIO_I2Cx_ER_IRQn);
bcostm 0:c9112f0c67e3 505 }
bcostm 0:c9112f0c67e3 506 else
bcostm 0:c9112f0c67e3 507 {
bcostm 0:c9112f0c67e3 508 /* External, camera and Arduino connector I2C MSP init */
bcostm 0:c9112f0c67e3 509
bcostm 0:c9112f0c67e3 510 /*** Configure the GPIOs ***/
bcostm 0:c9112f0c67e3 511 /* Enable GPIO clock */
bcostm 0:c9112f0c67e3 512 DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
bcostm 0:c9112f0c67e3 513
bcostm 0:c9112f0c67e3 514 /* Configure I2C Tx as alternate function */
bcostm 0:c9112f0c67e3 515 gpio_init_structure.Pin = DISCOVERY_EXT_I2Cx_SCL_PIN;
bcostm 0:c9112f0c67e3 516 gpio_init_structure.Mode = GPIO_MODE_AF_OD;
bcostm 0:c9112f0c67e3 517 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 0:c9112f0c67e3 518 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 0:c9112f0c67e3 519 gpio_init_structure.Alternate = DISCOVERY_EXT_I2Cx_SCL_SDA_AF;
bcostm 0:c9112f0c67e3 520 HAL_GPIO_Init(DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 0:c9112f0c67e3 521
bcostm 0:c9112f0c67e3 522 /* Configure I2C Rx as alternate function */
bcostm 0:c9112f0c67e3 523 gpio_init_structure.Pin = DISCOVERY_EXT_I2Cx_SDA_PIN;
bcostm 0:c9112f0c67e3 524 HAL_GPIO_Init(DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 0:c9112f0c67e3 525
bcostm 0:c9112f0c67e3 526 /*** Configure the I2C peripheral ***/
bcostm 0:c9112f0c67e3 527 /* Enable I2C clock */
bcostm 0:c9112f0c67e3 528 DISCOVERY_EXT_I2Cx_CLK_ENABLE();
bcostm 0:c9112f0c67e3 529
bcostm 0:c9112f0c67e3 530 /* Force the I2C peripheral clock reset */
bcostm 0:c9112f0c67e3 531 DISCOVERY_EXT_I2Cx_FORCE_RESET();
bcostm 0:c9112f0c67e3 532
bcostm 0:c9112f0c67e3 533 /* Release the I2C peripheral clock reset */
bcostm 0:c9112f0c67e3 534 DISCOVERY_EXT_I2Cx_RELEASE_RESET();
bcostm 0:c9112f0c67e3 535
bcostm 0:c9112f0c67e3 536 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 0:c9112f0c67e3 537 HAL_NVIC_SetPriority(DISCOVERY_EXT_I2Cx_EV_IRQn, 0x05, 0);
bcostm 0:c9112f0c67e3 538 HAL_NVIC_EnableIRQ(DISCOVERY_EXT_I2Cx_EV_IRQn);
bcostm 0:c9112f0c67e3 539
bcostm 0:c9112f0c67e3 540 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 0:c9112f0c67e3 541 HAL_NVIC_SetPriority(DISCOVERY_EXT_I2Cx_ER_IRQn, 0x05, 0);
bcostm 0:c9112f0c67e3 542 HAL_NVIC_EnableIRQ(DISCOVERY_EXT_I2Cx_ER_IRQn);
bcostm 0:c9112f0c67e3 543 }
bcostm 0:c9112f0c67e3 544 }
bcostm 0:c9112f0c67e3 545
bcostm 0:c9112f0c67e3 546 /**
bcostm 0:c9112f0c67e3 547 * @brief Initializes I2C HAL.
bcostm 0:c9112f0c67e3 548 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 549 * @retval None
bcostm 0:c9112f0c67e3 550 */
bcostm 0:c9112f0c67e3 551 static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler)
bcostm 0:c9112f0c67e3 552 {
bcostm 0:c9112f0c67e3 553 if(HAL_I2C_GetState(i2c_handler) == HAL_I2C_STATE_RESET)
bcostm 0:c9112f0c67e3 554 {
bcostm 0:c9112f0c67e3 555 if (i2c_handler == (I2C_HandleTypeDef*)(&hI2cAudioHandler))
bcostm 0:c9112f0c67e3 556 {
bcostm 0:c9112f0c67e3 557 /* Audio and LCD I2C configuration */
bcostm 0:c9112f0c67e3 558 i2c_handler->Instance = DISCOVERY_AUDIO_I2Cx;
bcostm 0:c9112f0c67e3 559 }
bcostm 0:c9112f0c67e3 560 else
bcostm 0:c9112f0c67e3 561 {
bcostm 0:c9112f0c67e3 562 /* External, camera and Arduino connector I2C configuration */
bcostm 0:c9112f0c67e3 563 i2c_handler->Instance = DISCOVERY_EXT_I2Cx;
bcostm 0:c9112f0c67e3 564 }
bcostm 0:c9112f0c67e3 565 i2c_handler->Init.Timing = DISCOVERY_I2Cx_TIMING;
bcostm 0:c9112f0c67e3 566 i2c_handler->Init.OwnAddress1 = 0;
bcostm 0:c9112f0c67e3 567 i2c_handler->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
bcostm 0:c9112f0c67e3 568 i2c_handler->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
bcostm 0:c9112f0c67e3 569 i2c_handler->Init.OwnAddress2 = 0;
bcostm 0:c9112f0c67e3 570 i2c_handler->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
bcostm 0:c9112f0c67e3 571 i2c_handler->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
bcostm 0:c9112f0c67e3 572
bcostm 0:c9112f0c67e3 573 /* Init the I2C */
bcostm 0:c9112f0c67e3 574 I2Cx_MspInit(i2c_handler);
bcostm 0:c9112f0c67e3 575 HAL_I2C_Init(i2c_handler);
bcostm 0:c9112f0c67e3 576 }
bcostm 0:c9112f0c67e3 577 }
bcostm 0:c9112f0c67e3 578
bcostm 0:c9112f0c67e3 579 /**
bcostm 0:c9112f0c67e3 580 * @brief Reads multiple data.
bcostm 0:c9112f0c67e3 581 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 582 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 583 * @param Reg: Reg address
bcostm 0:c9112f0c67e3 584 * @param MemAddress: Memory address
bcostm 0:c9112f0c67e3 585 * @param Buffer: Pointer to data buffer
bcostm 0:c9112f0c67e3 586 * @param Length: Length of the data
bcostm 0:c9112f0c67e3 587 * @retval Number of read data
bcostm 0:c9112f0c67e3 588 */
bcostm 0:c9112f0c67e3 589 static HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler,
bcostm 0:c9112f0c67e3 590 uint8_t Addr,
bcostm 0:c9112f0c67e3 591 uint16_t Reg,
bcostm 0:c9112f0c67e3 592 uint16_t MemAddress,
bcostm 0:c9112f0c67e3 593 uint8_t *Buffer,
bcostm 0:c9112f0c67e3 594 uint16_t Length)
bcostm 0:c9112f0c67e3 595 {
bcostm 0:c9112f0c67e3 596 HAL_StatusTypeDef status = HAL_OK;
bcostm 0:c9112f0c67e3 597
bcostm 0:c9112f0c67e3 598 status = HAL_I2C_Mem_Read(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
bcostm 0:c9112f0c67e3 599
bcostm 0:c9112f0c67e3 600 /* Check the communication status */
bcostm 0:c9112f0c67e3 601 if(status != HAL_OK)
bcostm 0:c9112f0c67e3 602 {
bcostm 0:c9112f0c67e3 603 /* I2C error occurred */
bcostm 0:c9112f0c67e3 604 I2Cx_Error(i2c_handler, Addr);
bcostm 0:c9112f0c67e3 605 }
bcostm 0:c9112f0c67e3 606 return status;
bcostm 0:c9112f0c67e3 607 }
bcostm 0:c9112f0c67e3 608
bcostm 0:c9112f0c67e3 609 /**
bcostm 0:c9112f0c67e3 610 * @brief Writes a value in a register of the device through BUS in using DMA mode.
bcostm 0:c9112f0c67e3 611 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 612 * @param Addr: Device address on BUS Bus.
bcostm 0:c9112f0c67e3 613 * @param Reg: The target register address to write
bcostm 0:c9112f0c67e3 614 * @param MemAddress: Memory address
bcostm 0:c9112f0c67e3 615 * @param Buffer: The target register value to be written
bcostm 0:c9112f0c67e3 616 * @param Length: buffer size to be written
bcostm 0:c9112f0c67e3 617 * @retval HAL status
bcostm 0:c9112f0c67e3 618 */
bcostm 0:c9112f0c67e3 619 static HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler,
bcostm 0:c9112f0c67e3 620 uint8_t Addr,
bcostm 0:c9112f0c67e3 621 uint16_t Reg,
bcostm 0:c9112f0c67e3 622 uint16_t MemAddress,
bcostm 0:c9112f0c67e3 623 uint8_t *Buffer,
bcostm 0:c9112f0c67e3 624 uint16_t Length)
bcostm 0:c9112f0c67e3 625 {
bcostm 0:c9112f0c67e3 626 HAL_StatusTypeDef status = HAL_OK;
bcostm 0:c9112f0c67e3 627
bcostm 0:c9112f0c67e3 628 status = HAL_I2C_Mem_Write(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
bcostm 0:c9112f0c67e3 629
bcostm 0:c9112f0c67e3 630 /* Check the communication status */
bcostm 0:c9112f0c67e3 631 if(status != HAL_OK)
bcostm 0:c9112f0c67e3 632 {
bcostm 0:c9112f0c67e3 633 /* Re-Initiaize the I2C Bus */
bcostm 0:c9112f0c67e3 634 I2Cx_Error(i2c_handler, Addr);
bcostm 0:c9112f0c67e3 635 }
bcostm 0:c9112f0c67e3 636 return status;
bcostm 0:c9112f0c67e3 637 }
bcostm 0:c9112f0c67e3 638
bcostm 0:c9112f0c67e3 639 /**
bcostm 0:c9112f0c67e3 640 * @brief Checks if target device is ready for communication.
bcostm 0:c9112f0c67e3 641 * @note This function is used with Memory devices
bcostm 0:c9112f0c67e3 642 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 643 * @param DevAddress: Target device address
bcostm 0:c9112f0c67e3 644 * @param Trials: Number of trials
bcostm 0:c9112f0c67e3 645 * @retval HAL status
bcostm 0:c9112f0c67e3 646 */
bcostm 0:c9112f0c67e3 647 static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials)
bcostm 0:c9112f0c67e3 648 {
bcostm 0:c9112f0c67e3 649 return (HAL_I2C_IsDeviceReady(i2c_handler, DevAddress, Trials, 1000));
bcostm 0:c9112f0c67e3 650 }
bcostm 0:c9112f0c67e3 651
bcostm 0:c9112f0c67e3 652 /**
bcostm 0:c9112f0c67e3 653 * @brief Manages error callback by re-initializing I2C.
bcostm 0:c9112f0c67e3 654 * @param i2c_handler : I2C handler
bcostm 0:c9112f0c67e3 655 * @param Addr: I2C Address
bcostm 0:c9112f0c67e3 656 * @retval None
bcostm 0:c9112f0c67e3 657 */
bcostm 0:c9112f0c67e3 658 static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr)
bcostm 0:c9112f0c67e3 659 {
bcostm 0:c9112f0c67e3 660 /* De-initialize the I2C communication bus */
bcostm 0:c9112f0c67e3 661 HAL_I2C_DeInit(i2c_handler);
bcostm 0:c9112f0c67e3 662
bcostm 0:c9112f0c67e3 663 /* Re-Initialize the I2C communication bus */
bcostm 0:c9112f0c67e3 664 I2Cx_Init(i2c_handler);
bcostm 0:c9112f0c67e3 665 }
bcostm 0:c9112f0c67e3 666
bcostm 0:c9112f0c67e3 667 /*******************************************************************************
bcostm 0:c9112f0c67e3 668 LINK OPERATIONS
bcostm 0:c9112f0c67e3 669 *******************************************************************************/
bcostm 0:c9112f0c67e3 670
bcostm 0:c9112f0c67e3 671 /********************************* LINK AUDIO *********************************/
bcostm 0:c9112f0c67e3 672
bcostm 0:c9112f0c67e3 673 /**
bcostm 0:c9112f0c67e3 674 * @brief Initializes Audio low level.
bcostm 0:c9112f0c67e3 675 * @retval None
bcostm 0:c9112f0c67e3 676 */
bcostm 0:c9112f0c67e3 677 void AUDIO_IO_Init(void)
bcostm 0:c9112f0c67e3 678 {
bcostm 0:c9112f0c67e3 679 I2Cx_Init(&hI2cAudioHandler);
bcostm 0:c9112f0c67e3 680 }
bcostm 0:c9112f0c67e3 681
bcostm 0:c9112f0c67e3 682 /**
bcostm 0:c9112f0c67e3 683 * @brief Deinitializes Audio low level.
bcostm 0:c9112f0c67e3 684 * @retval None
bcostm 0:c9112f0c67e3 685 */
bcostm 0:c9112f0c67e3 686 void AUDIO_IO_DeInit(void)
bcostm 0:c9112f0c67e3 687 {
bcostm 0:c9112f0c67e3 688 }
bcostm 0:c9112f0c67e3 689
bcostm 0:c9112f0c67e3 690 /**
bcostm 0:c9112f0c67e3 691 * @brief Writes a single data.
bcostm 0:c9112f0c67e3 692 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 693 * @param Reg: Reg address
bcostm 0:c9112f0c67e3 694 * @param Value: Data to be written
bcostm 0:c9112f0c67e3 695 * @retval None
bcostm 0:c9112f0c67e3 696 */
bcostm 0:c9112f0c67e3 697 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
bcostm 0:c9112f0c67e3 698 {
bcostm 0:c9112f0c67e3 699 uint16_t tmp = Value;
bcostm 0:c9112f0c67e3 700
bcostm 0:c9112f0c67e3 701 Value = ((uint16_t)(tmp >> 8) & 0x00FF);
bcostm 0:c9112f0c67e3 702
bcostm 0:c9112f0c67e3 703 Value |= ((uint16_t)(tmp << 8)& 0xFF00);
bcostm 0:c9112f0c67e3 704
bcostm 0:c9112f0c67e3 705 I2Cx_WriteMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_16BIT,(uint8_t*)&Value, 2);
bcostm 0:c9112f0c67e3 706 }
bcostm 0:c9112f0c67e3 707
bcostm 0:c9112f0c67e3 708 /**
bcostm 0:c9112f0c67e3 709 * @brief Reads a single data.
bcostm 0:c9112f0c67e3 710 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 711 * @param Reg: Reg address
bcostm 0:c9112f0c67e3 712 * @retval Data to be read
bcostm 0:c9112f0c67e3 713 */
bcostm 0:c9112f0c67e3 714 uint16_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg)
bcostm 0:c9112f0c67e3 715 {
bcostm 0:c9112f0c67e3 716 uint16_t read_value = 0, tmp = 0;
bcostm 0:c9112f0c67e3 717
bcostm 0:c9112f0c67e3 718 I2Cx_ReadMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_16BIT, (uint8_t*)&read_value, 2);
bcostm 0:c9112f0c67e3 719
bcostm 0:c9112f0c67e3 720 tmp = ((uint16_t)(read_value >> 8) & 0x00FF);
bcostm 0:c9112f0c67e3 721
bcostm 0:c9112f0c67e3 722 tmp |= ((uint16_t)(read_value << 8)& 0xFF00);
bcostm 0:c9112f0c67e3 723
bcostm 0:c9112f0c67e3 724 read_value = tmp;
bcostm 0:c9112f0c67e3 725
bcostm 0:c9112f0c67e3 726 return read_value;
bcostm 0:c9112f0c67e3 727 }
bcostm 0:c9112f0c67e3 728
bcostm 0:c9112f0c67e3 729 /**
bcostm 0:c9112f0c67e3 730 * @brief AUDIO Codec delay
bcostm 0:c9112f0c67e3 731 * @param Delay: Delay in ms
bcostm 0:c9112f0c67e3 732 * @retval None
bcostm 0:c9112f0c67e3 733 */
bcostm 0:c9112f0c67e3 734 void AUDIO_IO_Delay(uint32_t Delay)
bcostm 0:c9112f0c67e3 735 {
bcostm 0:c9112f0c67e3 736 //HAL_Delay(Delay);
bcostm 0:c9112f0c67e3 737 wait_ms(Delay);
bcostm 0:c9112f0c67e3 738 }
bcostm 0:c9112f0c67e3 739
bcostm 0:c9112f0c67e3 740 /********************************* LINK CAMERA ********************************/
bcostm 0:c9112f0c67e3 741
bcostm 0:c9112f0c67e3 742 /**
bcostm 0:c9112f0c67e3 743 * @brief Initializes Camera low level.
bcostm 0:c9112f0c67e3 744 * @retval None
bcostm 0:c9112f0c67e3 745 */
bcostm 0:c9112f0c67e3 746 void CAMERA_IO_Init(void)
bcostm 0:c9112f0c67e3 747 {
bcostm 0:c9112f0c67e3 748 I2Cx_Init(&hI2cExtHandler);
bcostm 0:c9112f0c67e3 749 }
bcostm 0:c9112f0c67e3 750
bcostm 0:c9112f0c67e3 751 /**
bcostm 0:c9112f0c67e3 752 * @brief Camera writes single data.
bcostm 0:c9112f0c67e3 753 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 754 * @param Reg: Register address
bcostm 0:c9112f0c67e3 755 * @param Value: Data to be written
bcostm 0:c9112f0c67e3 756 * @retval None
bcostm 0:c9112f0c67e3 757 */
bcostm 0:c9112f0c67e3 758 void CAMERA_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
bcostm 0:c9112f0c67e3 759 {
bcostm 0:c9112f0c67e3 760 I2Cx_WriteMultiple(&hI2cExtHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT,(uint8_t*)&Value, 1);
bcostm 0:c9112f0c67e3 761 }
bcostm 0:c9112f0c67e3 762
bcostm 0:c9112f0c67e3 763 /**
bcostm 0:c9112f0c67e3 764 * @brief Camera reads single data.
bcostm 0:c9112f0c67e3 765 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 766 * @param Reg: Register address
bcostm 0:c9112f0c67e3 767 * @retval Read data
bcostm 0:c9112f0c67e3 768 */
bcostm 0:c9112f0c67e3 769 uint8_t CAMERA_IO_Read(uint8_t Addr, uint8_t Reg)
bcostm 0:c9112f0c67e3 770 {
bcostm 0:c9112f0c67e3 771 uint8_t read_value = 0;
bcostm 0:c9112f0c67e3 772
bcostm 0:c9112f0c67e3 773 I2Cx_ReadMultiple(&hI2cExtHandler, Addr, Reg, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&read_value, 1);
bcostm 0:c9112f0c67e3 774
bcostm 0:c9112f0c67e3 775 return read_value;
bcostm 0:c9112f0c67e3 776 }
bcostm 0:c9112f0c67e3 777
bcostm 0:c9112f0c67e3 778 /**
bcostm 0:c9112f0c67e3 779 * @brief Camera delay
bcostm 0:c9112f0c67e3 780 * @param Delay: Delay in ms
bcostm 0:c9112f0c67e3 781 * @retval None
bcostm 0:c9112f0c67e3 782 */
bcostm 0:c9112f0c67e3 783 void CAMERA_Delay(uint32_t Delay)
bcostm 0:c9112f0c67e3 784 {
bcostm 0:c9112f0c67e3 785 //HAL_Delay(Delay);
bcostm 0:c9112f0c67e3 786 wait_ms(Delay);
bcostm 0:c9112f0c67e3 787 }
bcostm 0:c9112f0c67e3 788
bcostm 0:c9112f0c67e3 789 /******************************** LINK I2C EEPROM *****************************/
bcostm 0:c9112f0c67e3 790
bcostm 0:c9112f0c67e3 791 /**
bcostm 0:c9112f0c67e3 792 * @brief Initializes peripherals used by the I2C EEPROM driver.
bcostm 0:c9112f0c67e3 793 * @retval None
bcostm 0:c9112f0c67e3 794 */
bcostm 0:c9112f0c67e3 795 void EEPROM_IO_Init(void)
bcostm 0:c9112f0c67e3 796 {
bcostm 0:c9112f0c67e3 797 I2Cx_Init(&hI2cExtHandler);
bcostm 0:c9112f0c67e3 798 }
bcostm 0:c9112f0c67e3 799
bcostm 0:c9112f0c67e3 800 /**
bcostm 0:c9112f0c67e3 801 * @brief Write data to I2C EEPROM driver in using DMA channel.
bcostm 0:c9112f0c67e3 802 * @param DevAddress: Target device address
bcostm 0:c9112f0c67e3 803 * @param MemAddress: Internal memory address
bcostm 0:c9112f0c67e3 804 * @param pBuffer: Pointer to data buffer
bcostm 0:c9112f0c67e3 805 * @param BufferSize: Amount of data to be sent
bcostm 0:c9112f0c67e3 806 * @retval HAL status
bcostm 0:c9112f0c67e3 807 */
bcostm 0:c9112f0c67e3 808 HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
bcostm 0:c9112f0c67e3 809 {
bcostm 0:c9112f0c67e3 810 return (I2Cx_WriteMultiple(&hI2cExtHandler, DevAddress, MemAddress, I2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
bcostm 0:c9112f0c67e3 811 }
bcostm 0:c9112f0c67e3 812
bcostm 0:c9112f0c67e3 813 /**
bcostm 0:c9112f0c67e3 814 * @brief Read data from I2C EEPROM driver in using DMA channel.
bcostm 0:c9112f0c67e3 815 * @param DevAddress: Target device address
bcostm 0:c9112f0c67e3 816 * @param MemAddress: Internal memory address
bcostm 0:c9112f0c67e3 817 * @param pBuffer: Pointer to data buffer
bcostm 0:c9112f0c67e3 818 * @param BufferSize: Amount of data to be read
bcostm 0:c9112f0c67e3 819 * @retval HAL status
bcostm 0:c9112f0c67e3 820 */
bcostm 0:c9112f0c67e3 821 HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
bcostm 0:c9112f0c67e3 822 {
bcostm 0:c9112f0c67e3 823 return (I2Cx_ReadMultiple(&hI2cExtHandler, DevAddress, MemAddress, I2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
bcostm 0:c9112f0c67e3 824 }
bcostm 0:c9112f0c67e3 825
bcostm 0:c9112f0c67e3 826 /**
bcostm 0:c9112f0c67e3 827 * @brief Checks if target device is ready for communication.
bcostm 0:c9112f0c67e3 828 * @note This function is used with Memory devices
bcostm 0:c9112f0c67e3 829 * @param DevAddress: Target device address
bcostm 0:c9112f0c67e3 830 * @param Trials: Number of trials
bcostm 0:c9112f0c67e3 831 * @retval HAL status
bcostm 0:c9112f0c67e3 832 */
bcostm 0:c9112f0c67e3 833 HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
bcostm 0:c9112f0c67e3 834 {
bcostm 0:c9112f0c67e3 835 return (I2Cx_IsDeviceReady(&hI2cExtHandler, DevAddress, Trials));
bcostm 0:c9112f0c67e3 836 }
bcostm 0:c9112f0c67e3 837
bcostm 0:c9112f0c67e3 838 /********************************* LINK TOUCHSCREEN *********************************/
bcostm 0:c9112f0c67e3 839
bcostm 0:c9112f0c67e3 840 /**
bcostm 0:c9112f0c67e3 841 * @brief Initializes Touchscreen low level.
bcostm 0:c9112f0c67e3 842 * @retval None
bcostm 0:c9112f0c67e3 843 */
bcostm 0:c9112f0c67e3 844 void TS_IO_Init(void)
bcostm 0:c9112f0c67e3 845 {
bcostm 0:c9112f0c67e3 846 I2Cx_Init(&hI2cAudioHandler);
bcostm 0:c9112f0c67e3 847 }
bcostm 0:c9112f0c67e3 848
bcostm 0:c9112f0c67e3 849 /**
bcostm 0:c9112f0c67e3 850 * @brief Writes a single data.
bcostm 0:c9112f0c67e3 851 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 852 * @param Reg: Reg address
bcostm 0:c9112f0c67e3 853 * @param Value: Data to be written
bcostm 0:c9112f0c67e3 854 * @retval None
bcostm 0:c9112f0c67e3 855 */
bcostm 0:c9112f0c67e3 856 void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
bcostm 0:c9112f0c67e3 857 {
bcostm 0:c9112f0c67e3 858 I2Cx_WriteMultiple(&hI2cAudioHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT,(uint8_t*)&Value, 1);
bcostm 0:c9112f0c67e3 859 }
bcostm 0:c9112f0c67e3 860
bcostm 0:c9112f0c67e3 861 /**
bcostm 0:c9112f0c67e3 862 * @brief Reads a single data.
bcostm 0:c9112f0c67e3 863 * @param Addr: I2C address
bcostm 0:c9112f0c67e3 864 * @param Reg: Reg address
bcostm 0:c9112f0c67e3 865 * @retval Data to be read
bcostm 0:c9112f0c67e3 866 */
bcostm 0:c9112f0c67e3 867 uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg)
bcostm 0:c9112f0c67e3 868 {
bcostm 0:c9112f0c67e3 869 uint8_t read_value = 0;
bcostm 0:c9112f0c67e3 870
bcostm 0:c9112f0c67e3 871 I2Cx_ReadMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&read_value, 1);
bcostm 0:c9112f0c67e3 872
bcostm 0:c9112f0c67e3 873 return read_value;
bcostm 0:c9112f0c67e3 874 }
bcostm 0:c9112f0c67e3 875
bcostm 0:c9112f0c67e3 876 /**
bcostm 0:c9112f0c67e3 877 * @brief TS delay
bcostm 0:c9112f0c67e3 878 * @param Delay: Delay in ms
bcostm 0:c9112f0c67e3 879 * @retval None
bcostm 0:c9112f0c67e3 880 */
bcostm 0:c9112f0c67e3 881 void TS_IO_Delay(uint32_t Delay)
bcostm 0:c9112f0c67e3 882 {
bcostm 0:c9112f0c67e3 883 //HAL_Delay(Delay);
bcostm 0:c9112f0c67e3 884 wait_ms(Delay);
bcostm 0:c9112f0c67e3 885 }
bcostm 0:c9112f0c67e3 886
bcostm 0:c9112f0c67e3 887 /**
bcostm 0:c9112f0c67e3 888 * @}
bcostm 0:c9112f0c67e3 889 */
bcostm 0:c9112f0c67e3 890
bcostm 0:c9112f0c67e3 891 /**
bcostm 0:c9112f0c67e3 892 * @}
bcostm 0:c9112f0c67e3 893 */
bcostm 0:c9112f0c67e3 894
bcostm 0:c9112f0c67e3 895 /**
bcostm 0:c9112f0c67e3 896 * @}
bcostm 0:c9112f0c67e3 897 */
bcostm 0:c9112f0c67e3 898
bcostm 0:c9112f0c67e3 899 /**
bcostm 0:c9112f0c67e3 900 * @}
bcostm 0:c9112f0c67e3 901 */
bcostm 0:c9112f0c67e3 902
bcostm 0:c9112f0c67e3 903 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/