JPA sdcard

Committer:
jeanpierreaulas
Date:
Wed Dec 30 14:46:04 2020 +0000
Revision:
15:435cacf7f874
Parent:
6:e1d9da7fe856
JPA

Who changed what in which revision?

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