SPKT

Dependencies:   mbed

Committer:
bcostm
Date:
Thu Nov 10 09:57:11 2016 +0100
Revision:
6:e1d9da7fe856
Child:
8:56384bddaba5
Update all files present in STM32CubeF7 V1.5.1. Keep original folders structure.

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
bcostm 6:e1d9da7fe856 121 static I2C_HandleTypeDef hI2cAudioHandler = {0};
bcostm 6:e1d9da7fe856 122 static I2C_HandleTypeDef hI2cExtHandler = {0};
bcostm 6:e1d9da7fe856 123
bcostm 6:e1d9da7fe856 124 /**
bcostm 6:e1d9da7fe856 125 * @}
bcostm 6:e1d9da7fe856 126 */
bcostm 6:e1d9da7fe856 127
bcostm 6:e1d9da7fe856 128 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Private_FunctionPrototypes STM32746G_DISCOVERY_LOW_LEVEL Private Function Prototypes
bcostm 6:e1d9da7fe856 129 * @{
bcostm 6:e1d9da7fe856 130 */
bcostm 6:e1d9da7fe856 131 static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler);
bcostm 6:e1d9da7fe856 132 static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler);
bcostm 6:e1d9da7fe856 133
bcostm 6:e1d9da7fe856 134 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 135 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 136 static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials);
bcostm 6:e1d9da7fe856 137 static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr);
bcostm 6:e1d9da7fe856 138
bcostm 6:e1d9da7fe856 139 /* AUDIO IO functions */
bcostm 6:e1d9da7fe856 140 void AUDIO_IO_Init(void);
bcostm 6:e1d9da7fe856 141 void AUDIO_IO_DeInit(void);
bcostm 6:e1d9da7fe856 142 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
bcostm 6:e1d9da7fe856 143 uint16_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
bcostm 6:e1d9da7fe856 144 void AUDIO_IO_Delay(uint32_t Delay);
bcostm 6:e1d9da7fe856 145
bcostm 6:e1d9da7fe856 146 /* TOUCHSCREEN IO functions */
bcostm 6:e1d9da7fe856 147 void TS_IO_Init(void);
bcostm 6:e1d9da7fe856 148 void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 6:e1d9da7fe856 149 uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 6:e1d9da7fe856 150 void TS_IO_Delay(uint32_t Delay);
bcostm 6:e1d9da7fe856 151
bcostm 6:e1d9da7fe856 152 /* CAMERA IO functions */
bcostm 6:e1d9da7fe856 153 void CAMERA_IO_Init(void);
bcostm 6:e1d9da7fe856 154 void CAMERA_Delay(uint32_t Delay);
bcostm 6:e1d9da7fe856 155 void CAMERA_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 6:e1d9da7fe856 156 uint8_t CAMERA_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 6:e1d9da7fe856 157
bcostm 6:e1d9da7fe856 158 /* I2C EEPROM IO function */
bcostm 6:e1d9da7fe856 159 void EEPROM_IO_Init(void);
bcostm 6:e1d9da7fe856 160 HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
bcostm 6:e1d9da7fe856 161 HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
bcostm 6:e1d9da7fe856 162 HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
bcostm 6:e1d9da7fe856 163 /**
bcostm 6:e1d9da7fe856 164 * @}
bcostm 6:e1d9da7fe856 165 */
bcostm 6:e1d9da7fe856 166
bcostm 6:e1d9da7fe856 167 /** @defgroup STM32746G_DISCOVERY_LOW_LEVEL_Exported_Functions STM32746G_DISCOVERY_LOW_LEVELSTM32746G_DISCOVERY_LOW_LEVEL Exported Functions
bcostm 6:e1d9da7fe856 168 * @{
bcostm 6:e1d9da7fe856 169 */
bcostm 6:e1d9da7fe856 170
bcostm 6:e1d9da7fe856 171 /**
bcostm 6:e1d9da7fe856 172 * @brief This method returns the STM32746G DISCOVERY BSP Driver revision
bcostm 6:e1d9da7fe856 173 * @retval version: 0xXYZR (8bits for each decimal, R for RC)
bcostm 6:e1d9da7fe856 174 */
bcostm 6:e1d9da7fe856 175 uint32_t BSP_GetVersion(void)
bcostm 6:e1d9da7fe856 176 {
bcostm 6:e1d9da7fe856 177 return __STM32746G_DISCO_BSP_VERSION;
bcostm 6:e1d9da7fe856 178 }
bcostm 6:e1d9da7fe856 179
bcostm 6:e1d9da7fe856 180 /**
bcostm 6:e1d9da7fe856 181 * @brief Configures LED on GPIO.
bcostm 6:e1d9da7fe856 182 * @param Led: LED to be configured.
bcostm 6:e1d9da7fe856 183 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 184 * @arg LED1
bcostm 6:e1d9da7fe856 185 * @retval None
bcostm 6:e1d9da7fe856 186 */
bcostm 6:e1d9da7fe856 187 void BSP_LED_Init(Led_TypeDef Led)
bcostm 6:e1d9da7fe856 188 {
bcostm 6:e1d9da7fe856 189 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 190 GPIO_TypeDef* gpio_led;
bcostm 6:e1d9da7fe856 191
bcostm 6:e1d9da7fe856 192 if (Led == DISCO_LED1) // MBED
bcostm 6:e1d9da7fe856 193 {
bcostm 6:e1d9da7fe856 194 gpio_led = LED1_GPIO_PORT;
bcostm 6:e1d9da7fe856 195 /* Enable the GPIO_LED clock */
bcostm 6:e1d9da7fe856 196 LED1_GPIO_CLK_ENABLE();
bcostm 6:e1d9da7fe856 197
bcostm 6:e1d9da7fe856 198 /* Configure the GPIO_LED pin */
bcostm 6:e1d9da7fe856 199 gpio_init_structure.Pin = GPIO_PIN[Led];
bcostm 6:e1d9da7fe856 200 gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
bcostm 6:e1d9da7fe856 201 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 202 gpio_init_structure.Speed = GPIO_SPEED_HIGH;
bcostm 6:e1d9da7fe856 203
bcostm 6:e1d9da7fe856 204 HAL_GPIO_Init(gpio_led, &gpio_init_structure);
bcostm 6:e1d9da7fe856 205
bcostm 6:e1d9da7fe856 206 /* By default, turn off LED */
bcostm 6:e1d9da7fe856 207 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 6:e1d9da7fe856 208 }
bcostm 6:e1d9da7fe856 209 }
bcostm 6:e1d9da7fe856 210
bcostm 6:e1d9da7fe856 211 /**
bcostm 6:e1d9da7fe856 212 * @brief DeInit LEDs.
bcostm 6:e1d9da7fe856 213 * @param Led: LED to be configured.
bcostm 6:e1d9da7fe856 214 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 215 * @arg LED1
bcostm 6:e1d9da7fe856 216 * @note Led DeInit does not disable the GPIO clock
bcostm 6:e1d9da7fe856 217 * @retval None
bcostm 6:e1d9da7fe856 218 */
bcostm 6:e1d9da7fe856 219 void BSP_LED_DeInit(Led_TypeDef Led)
bcostm 6:e1d9da7fe856 220 {
bcostm 6:e1d9da7fe856 221 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 222 GPIO_TypeDef* gpio_led;
bcostm 6:e1d9da7fe856 223
bcostm 6:e1d9da7fe856 224 if (Led == DISCO_LED1) // MBED
bcostm 6:e1d9da7fe856 225 {
bcostm 6:e1d9da7fe856 226 gpio_led = LED1_GPIO_PORT;
bcostm 6:e1d9da7fe856 227 /* Turn off LED */
bcostm 6:e1d9da7fe856 228 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 6:e1d9da7fe856 229 /* Configure the GPIO_LED pin */
bcostm 6:e1d9da7fe856 230 gpio_init_structure.Pin = GPIO_PIN[Led];
bcostm 6:e1d9da7fe856 231 HAL_GPIO_DeInit(gpio_led, gpio_init_structure.Pin);
bcostm 6:e1d9da7fe856 232 }
bcostm 6:e1d9da7fe856 233 }
bcostm 6:e1d9da7fe856 234
bcostm 6:e1d9da7fe856 235 /**
bcostm 6:e1d9da7fe856 236 * @brief Turns selected LED On.
bcostm 6:e1d9da7fe856 237 * @param Led: LED to be set on
bcostm 6:e1d9da7fe856 238 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 239 * @arg LED1
bcostm 6:e1d9da7fe856 240 * @retval None
bcostm 6:e1d9da7fe856 241 */
bcostm 6:e1d9da7fe856 242 void BSP_LED_On(Led_TypeDef Led)
bcostm 6:e1d9da7fe856 243 {
bcostm 6:e1d9da7fe856 244 GPIO_TypeDef* gpio_led;
bcostm 6:e1d9da7fe856 245
bcostm 6:e1d9da7fe856 246 if (Led == DISCO_LED1) /* Switch On LED connected to GPIO */ // MBED
bcostm 6:e1d9da7fe856 247 {
bcostm 6:e1d9da7fe856 248 gpio_led = LED1_GPIO_PORT;
bcostm 6:e1d9da7fe856 249 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_SET);
bcostm 6:e1d9da7fe856 250 }
bcostm 6:e1d9da7fe856 251 }
bcostm 6:e1d9da7fe856 252
bcostm 6:e1d9da7fe856 253 /**
bcostm 6:e1d9da7fe856 254 * @brief Turns selected LED Off.
bcostm 6:e1d9da7fe856 255 * @param Led: LED to be set off
bcostm 6:e1d9da7fe856 256 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 257 * @arg LED1
bcostm 6:e1d9da7fe856 258 * @retval None
bcostm 6:e1d9da7fe856 259 */
bcostm 6:e1d9da7fe856 260 void BSP_LED_Off(Led_TypeDef Led)
bcostm 6:e1d9da7fe856 261 {
bcostm 6:e1d9da7fe856 262 GPIO_TypeDef* gpio_led;
bcostm 6:e1d9da7fe856 263
bcostm 6:e1d9da7fe856 264 if (Led == DISCO_LED1) /* Switch Off LED connected to GPIO */ // MBED
bcostm 6:e1d9da7fe856 265 {
bcostm 6:e1d9da7fe856 266 gpio_led = LED1_GPIO_PORT;
bcostm 6:e1d9da7fe856 267 HAL_GPIO_WritePin(gpio_led, GPIO_PIN[Led], GPIO_PIN_RESET);
bcostm 6:e1d9da7fe856 268 }
bcostm 6:e1d9da7fe856 269 }
bcostm 6:e1d9da7fe856 270
bcostm 6:e1d9da7fe856 271 /**
bcostm 6:e1d9da7fe856 272 * @brief Toggles the selected LED.
bcostm 6:e1d9da7fe856 273 * @param Led: LED to be toggled
bcostm 6:e1d9da7fe856 274 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 275 * @arg LED1
bcostm 6:e1d9da7fe856 276 * @retval None
bcostm 6:e1d9da7fe856 277 */
bcostm 6:e1d9da7fe856 278 void BSP_LED_Toggle(Led_TypeDef Led)
bcostm 6:e1d9da7fe856 279 {
bcostm 6:e1d9da7fe856 280 GPIO_TypeDef* gpio_led;
bcostm 6:e1d9da7fe856 281
bcostm 6:e1d9da7fe856 282 if (Led == DISCO_LED1) /* Toggle LED connected to GPIO */ // MBED
bcostm 6:e1d9da7fe856 283 {
bcostm 6:e1d9da7fe856 284 gpio_led = LED1_GPIO_PORT;
bcostm 6:e1d9da7fe856 285 HAL_GPIO_TogglePin(gpio_led, GPIO_PIN[Led]);
bcostm 6:e1d9da7fe856 286 }
bcostm 6:e1d9da7fe856 287 }
bcostm 6:e1d9da7fe856 288
bcostm 6:e1d9da7fe856 289 /**
bcostm 6:e1d9da7fe856 290 * @brief Configures button GPIO and EXTI Line.
bcostm 6:e1d9da7fe856 291 * @param Button: Button to be configured
bcostm 6:e1d9da7fe856 292 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 293 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 6:e1d9da7fe856 294 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 6:e1d9da7fe856 295 * @arg BUTTON_KEY: Key Push Button
bcostm 6:e1d9da7fe856 296 * @param ButtonMode: Button mode
bcostm 6:e1d9da7fe856 297 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 298 * @arg BUTTON_MODE_GPIO: Button will be used as simple IO
bcostm 6:e1d9da7fe856 299 * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
bcostm 6:e1d9da7fe856 300 * with interrupt generation capability
bcostm 6:e1d9da7fe856 301 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 6:e1d9da7fe856 302 * are mapped on the same push button named "User"
bcostm 6:e1d9da7fe856 303 * on the board serigraphy.
bcostm 6:e1d9da7fe856 304 * @retval None
bcostm 6:e1d9da7fe856 305 */
bcostm 6:e1d9da7fe856 306 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
bcostm 6:e1d9da7fe856 307 {
bcostm 6:e1d9da7fe856 308 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 309
bcostm 6:e1d9da7fe856 310 /* Enable the BUTTON clock */
bcostm 6:e1d9da7fe856 311 BUTTONx_GPIO_CLK_ENABLE(Button);
bcostm 6:e1d9da7fe856 312
bcostm 6:e1d9da7fe856 313 if(ButtonMode == BUTTON_MODE_GPIO)
bcostm 6:e1d9da7fe856 314 {
bcostm 6:e1d9da7fe856 315 /* Configure Button pin as input */
bcostm 6:e1d9da7fe856 316 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 6:e1d9da7fe856 317 gpio_init_structure.Mode = GPIO_MODE_INPUT;
bcostm 6:e1d9da7fe856 318 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 319 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 6:e1d9da7fe856 320 HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
bcostm 6:e1d9da7fe856 321 }
bcostm 6:e1d9da7fe856 322
bcostm 6:e1d9da7fe856 323 if(ButtonMode == BUTTON_MODE_EXTI)
bcostm 6:e1d9da7fe856 324 {
bcostm 6:e1d9da7fe856 325 /* Configure Button pin as input with External interrupt */
bcostm 6:e1d9da7fe856 326 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 6:e1d9da7fe856 327 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 328 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 6:e1d9da7fe856 329
bcostm 6:e1d9da7fe856 330 if(Button != BUTTON_WAKEUP)
bcostm 6:e1d9da7fe856 331 {
bcostm 6:e1d9da7fe856 332 gpio_init_structure.Mode = GPIO_MODE_IT_FALLING;
bcostm 6:e1d9da7fe856 333 }
bcostm 6:e1d9da7fe856 334 else
bcostm 6:e1d9da7fe856 335 {
bcostm 6:e1d9da7fe856 336 gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
bcostm 6:e1d9da7fe856 337 }
bcostm 6:e1d9da7fe856 338
bcostm 6:e1d9da7fe856 339 HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
bcostm 6:e1d9da7fe856 340
bcostm 6:e1d9da7fe856 341 /* Enable and set Button EXTI Interrupt to the lowest priority */
bcostm 6:e1d9da7fe856 342 HAL_NVIC_SetPriority((IRQn_Type)(BUTTON_IRQn[Button]), 0x0F, 0x00);
bcostm 6:e1d9da7fe856 343 HAL_NVIC_EnableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
bcostm 6:e1d9da7fe856 344 }
bcostm 6:e1d9da7fe856 345 }
bcostm 6:e1d9da7fe856 346
bcostm 6:e1d9da7fe856 347 /**
bcostm 6:e1d9da7fe856 348 * @brief Push Button DeInit.
bcostm 6:e1d9da7fe856 349 * @param Button: Button to be configured
bcostm 6:e1d9da7fe856 350 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 351 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 6:e1d9da7fe856 352 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 6:e1d9da7fe856 353 * @arg BUTTON_KEY: Key Push Button
bcostm 6:e1d9da7fe856 354 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 6:e1d9da7fe856 355 * are mapped on the same push button named "User"
bcostm 6:e1d9da7fe856 356 * on the board serigraphy.
bcostm 6:e1d9da7fe856 357 * @note PB DeInit does not disable the GPIO clock
bcostm 6:e1d9da7fe856 358 * @retval None
bcostm 6:e1d9da7fe856 359 */
bcostm 6:e1d9da7fe856 360 void BSP_PB_DeInit(Button_TypeDef Button)
bcostm 6:e1d9da7fe856 361 {
bcostm 6:e1d9da7fe856 362 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 363
bcostm 6:e1d9da7fe856 364 gpio_init_structure.Pin = BUTTON_PIN[Button];
bcostm 6:e1d9da7fe856 365 HAL_NVIC_DisableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
bcostm 6:e1d9da7fe856 366 HAL_GPIO_DeInit(BUTTON_PORT[Button], gpio_init_structure.Pin);
bcostm 6:e1d9da7fe856 367 }
bcostm 6:e1d9da7fe856 368
bcostm 6:e1d9da7fe856 369
bcostm 6:e1d9da7fe856 370 /**
bcostm 6:e1d9da7fe856 371 * @brief Returns the selected button state.
bcostm 6:e1d9da7fe856 372 * @param Button: Button to be checked
bcostm 6:e1d9da7fe856 373 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 374 * @arg BUTTON_WAKEUP: Wakeup Push Button
bcostm 6:e1d9da7fe856 375 * @arg BUTTON_TAMPER: Tamper Push Button
bcostm 6:e1d9da7fe856 376 * @arg BUTTON_KEY: Key Push Button
bcostm 6:e1d9da7fe856 377 * @note On STM32746G-Discovery board, the three buttons (Wakeup, Tamper and key buttons)
bcostm 6:e1d9da7fe856 378 * are mapped on the same push button named "User"
bcostm 6:e1d9da7fe856 379 * on the board serigraphy.
bcostm 6:e1d9da7fe856 380 * @retval The Button GPIO pin value
bcostm 6:e1d9da7fe856 381 */
bcostm 6:e1d9da7fe856 382 uint32_t BSP_PB_GetState(Button_TypeDef Button)
bcostm 6:e1d9da7fe856 383 {
bcostm 6:e1d9da7fe856 384 return HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
bcostm 6:e1d9da7fe856 385 }
bcostm 6:e1d9da7fe856 386
bcostm 6:e1d9da7fe856 387 /**
bcostm 6:e1d9da7fe856 388 * @brief Configures COM port.
bcostm 6:e1d9da7fe856 389 * @param COM: COM port to be configured.
bcostm 6:e1d9da7fe856 390 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 391 * @arg COM1
bcostm 6:e1d9da7fe856 392 * @arg COM2
bcostm 6:e1d9da7fe856 393 * @param huart: Pointer to a UART_HandleTypeDef structure that contains the
bcostm 6:e1d9da7fe856 394 * configuration information for the specified USART peripheral.
bcostm 6:e1d9da7fe856 395 * @retval None
bcostm 6:e1d9da7fe856 396 */
bcostm 6:e1d9da7fe856 397 void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *huart)
bcostm 6:e1d9da7fe856 398 {
bcostm 6:e1d9da7fe856 399 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 400
bcostm 6:e1d9da7fe856 401 /* Enable GPIO clock */
bcostm 6:e1d9da7fe856 402 DISCOVERY_COMx_TX_GPIO_CLK_ENABLE(COM);
bcostm 6:e1d9da7fe856 403 DISCOVERY_COMx_RX_GPIO_CLK_ENABLE(COM);
bcostm 6:e1d9da7fe856 404
bcostm 6:e1d9da7fe856 405 /* Enable USART clock */
bcostm 6:e1d9da7fe856 406 DISCOVERY_COMx_CLK_ENABLE(COM);
bcostm 6:e1d9da7fe856 407
bcostm 6:e1d9da7fe856 408 /* Configure USART Tx as alternate function */
bcostm 6:e1d9da7fe856 409 gpio_init_structure.Pin = COM_TX_PIN[COM];
bcostm 6:e1d9da7fe856 410 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 411 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 6:e1d9da7fe856 412 gpio_init_structure.Pull = GPIO_PULLUP;
bcostm 6:e1d9da7fe856 413 gpio_init_structure.Alternate = COM_TX_AF[COM];
bcostm 6:e1d9da7fe856 414 HAL_GPIO_Init(COM_TX_PORT[COM], &gpio_init_structure);
bcostm 6:e1d9da7fe856 415
bcostm 6:e1d9da7fe856 416 /* Configure USART Rx as alternate function */
bcostm 6:e1d9da7fe856 417 gpio_init_structure.Pin = COM_RX_PIN[COM];
bcostm 6:e1d9da7fe856 418 gpio_init_structure.Mode = GPIO_MODE_AF_PP;
bcostm 6:e1d9da7fe856 419 gpio_init_structure.Alternate = COM_RX_AF[COM];
bcostm 6:e1d9da7fe856 420 HAL_GPIO_Init(COM_RX_PORT[COM], &gpio_init_structure);
bcostm 6:e1d9da7fe856 421
bcostm 6:e1d9da7fe856 422 /* USART configuration */
bcostm 6:e1d9da7fe856 423 huart->Instance = COM_USART[COM];
bcostm 6:e1d9da7fe856 424 HAL_UART_Init(huart);
bcostm 6:e1d9da7fe856 425 }
bcostm 6:e1d9da7fe856 426
bcostm 6:e1d9da7fe856 427 /**
bcostm 6:e1d9da7fe856 428 * @brief DeInit COM port.
bcostm 6:e1d9da7fe856 429 * @param COM: COM port to be configured.
bcostm 6:e1d9da7fe856 430 * This parameter can be one of the following values:
bcostm 6:e1d9da7fe856 431 * @arg COM1
bcostm 6:e1d9da7fe856 432 * @arg COM2
bcostm 6:e1d9da7fe856 433 * @param huart: Pointer to a UART_HandleTypeDef structure that contains the
bcostm 6:e1d9da7fe856 434 * configuration information for the specified USART peripheral.
bcostm 6:e1d9da7fe856 435 * @retval None
bcostm 6:e1d9da7fe856 436 */
bcostm 6:e1d9da7fe856 437 void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart)
bcostm 6:e1d9da7fe856 438 {
bcostm 6:e1d9da7fe856 439 /* USART configuration */
bcostm 6:e1d9da7fe856 440 huart->Instance = COM_USART[COM];
bcostm 6:e1d9da7fe856 441 HAL_UART_DeInit(huart);
bcostm 6:e1d9da7fe856 442
bcostm 6:e1d9da7fe856 443 /* Enable USART clock */
bcostm 6:e1d9da7fe856 444 DISCOVERY_COMx_CLK_DISABLE(COM);
bcostm 6:e1d9da7fe856 445
bcostm 6:e1d9da7fe856 446 /* DeInit GPIO pins can be done in the application
bcostm 6:e1d9da7fe856 447 (by surcharging this __weak function) */
bcostm 6:e1d9da7fe856 448
bcostm 6:e1d9da7fe856 449 /* GPIO pins clock, DMA clock can be shut down in the application
bcostm 6:e1d9da7fe856 450 by surcharging this __weak function */
bcostm 6:e1d9da7fe856 451 }
bcostm 6:e1d9da7fe856 452
bcostm 6:e1d9da7fe856 453 /*******************************************************************************
bcostm 6:e1d9da7fe856 454 BUS OPERATIONS
bcostm 6:e1d9da7fe856 455 *******************************************************************************/
bcostm 6:e1d9da7fe856 456
bcostm 6:e1d9da7fe856 457 /******************************* I2C Routines *********************************/
bcostm 6:e1d9da7fe856 458 /**
bcostm 6:e1d9da7fe856 459 * @brief Initializes I2C MSP.
bcostm 6:e1d9da7fe856 460 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 461 * @retval None
bcostm 6:e1d9da7fe856 462 */
bcostm 6:e1d9da7fe856 463 static void I2Cx_MspInit(I2C_HandleTypeDef *i2c_handler)
bcostm 6:e1d9da7fe856 464 {
bcostm 6:e1d9da7fe856 465 GPIO_InitTypeDef gpio_init_structure;
bcostm 6:e1d9da7fe856 466
bcostm 6:e1d9da7fe856 467 if (i2c_handler == (I2C_HandleTypeDef*)(&hI2cAudioHandler))
bcostm 6:e1d9da7fe856 468 {
bcostm 6:e1d9da7fe856 469 /* AUDIO and LCD I2C MSP init */
bcostm 6:e1d9da7fe856 470
bcostm 6:e1d9da7fe856 471 /*** Configure the GPIOs ***/
bcostm 6:e1d9da7fe856 472 /* Enable GPIO clock */
bcostm 6:e1d9da7fe856 473 DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
bcostm 6:e1d9da7fe856 474
bcostm 6:e1d9da7fe856 475 /* Configure I2C Tx as alternate function */
bcostm 6:e1d9da7fe856 476 gpio_init_structure.Pin = DISCOVERY_AUDIO_I2Cx_SCL_PIN;
bcostm 6:e1d9da7fe856 477 gpio_init_structure.Mode = GPIO_MODE_AF_OD;
bcostm 6:e1d9da7fe856 478 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 479 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 6:e1d9da7fe856 480 gpio_init_structure.Alternate = DISCOVERY_AUDIO_I2Cx_SCL_SDA_AF;
bcostm 6:e1d9da7fe856 481 HAL_GPIO_Init(DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 6:e1d9da7fe856 482
bcostm 6:e1d9da7fe856 483 /* Configure I2C Rx as alternate function */
bcostm 6:e1d9da7fe856 484 gpio_init_structure.Pin = DISCOVERY_AUDIO_I2Cx_SDA_PIN;
bcostm 6:e1d9da7fe856 485 HAL_GPIO_Init(DISCOVERY_AUDIO_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 6:e1d9da7fe856 486
bcostm 6:e1d9da7fe856 487 /*** Configure the I2C peripheral ***/
bcostm 6:e1d9da7fe856 488 /* Enable I2C clock */
bcostm 6:e1d9da7fe856 489 DISCOVERY_AUDIO_I2Cx_CLK_ENABLE();
bcostm 6:e1d9da7fe856 490
bcostm 6:e1d9da7fe856 491 /* Force the I2C peripheral clock reset */
bcostm 6:e1d9da7fe856 492 DISCOVERY_AUDIO_I2Cx_FORCE_RESET();
bcostm 6:e1d9da7fe856 493
bcostm 6:e1d9da7fe856 494 /* Release the I2C peripheral clock reset */
bcostm 6:e1d9da7fe856 495 DISCOVERY_AUDIO_I2Cx_RELEASE_RESET();
bcostm 6:e1d9da7fe856 496
bcostm 6:e1d9da7fe856 497 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 6:e1d9da7fe856 498 HAL_NVIC_SetPriority(DISCOVERY_AUDIO_I2Cx_EV_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 499 HAL_NVIC_EnableIRQ(DISCOVERY_AUDIO_I2Cx_EV_IRQn);
bcostm 6:e1d9da7fe856 500
bcostm 6:e1d9da7fe856 501 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 6:e1d9da7fe856 502 HAL_NVIC_SetPriority(DISCOVERY_AUDIO_I2Cx_ER_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 503 HAL_NVIC_EnableIRQ(DISCOVERY_AUDIO_I2Cx_ER_IRQn);
bcostm 6:e1d9da7fe856 504 }
bcostm 6:e1d9da7fe856 505 else
bcostm 6:e1d9da7fe856 506 {
bcostm 6:e1d9da7fe856 507 /* External, camera and Arduino connector I2C MSP init */
bcostm 6:e1d9da7fe856 508
bcostm 6:e1d9da7fe856 509 /*** Configure the GPIOs ***/
bcostm 6:e1d9da7fe856 510 /* Enable GPIO clock */
bcostm 6:e1d9da7fe856 511 DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
bcostm 6:e1d9da7fe856 512
bcostm 6:e1d9da7fe856 513 /* Configure I2C Tx as alternate function */
bcostm 6:e1d9da7fe856 514 gpio_init_structure.Pin = DISCOVERY_EXT_I2Cx_SCL_PIN;
bcostm 6:e1d9da7fe856 515 gpio_init_structure.Mode = GPIO_MODE_AF_OD;
bcostm 6:e1d9da7fe856 516 gpio_init_structure.Pull = GPIO_NOPULL;
bcostm 6:e1d9da7fe856 517 gpio_init_structure.Speed = GPIO_SPEED_FAST;
bcostm 6:e1d9da7fe856 518 gpio_init_structure.Alternate = DISCOVERY_EXT_I2Cx_SCL_SDA_AF;
bcostm 6:e1d9da7fe856 519 HAL_GPIO_Init(DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 6:e1d9da7fe856 520
bcostm 6:e1d9da7fe856 521 /* Configure I2C Rx as alternate function */
bcostm 6:e1d9da7fe856 522 gpio_init_structure.Pin = DISCOVERY_EXT_I2Cx_SDA_PIN;
bcostm 6:e1d9da7fe856 523 HAL_GPIO_Init(DISCOVERY_EXT_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
bcostm 6:e1d9da7fe856 524
bcostm 6:e1d9da7fe856 525 /*** Configure the I2C peripheral ***/
bcostm 6:e1d9da7fe856 526 /* Enable I2C clock */
bcostm 6:e1d9da7fe856 527 DISCOVERY_EXT_I2Cx_CLK_ENABLE();
bcostm 6:e1d9da7fe856 528
bcostm 6:e1d9da7fe856 529 /* Force the I2C peripheral clock reset */
bcostm 6:e1d9da7fe856 530 DISCOVERY_EXT_I2Cx_FORCE_RESET();
bcostm 6:e1d9da7fe856 531
bcostm 6:e1d9da7fe856 532 /* Release the I2C peripheral clock reset */
bcostm 6:e1d9da7fe856 533 DISCOVERY_EXT_I2Cx_RELEASE_RESET();
bcostm 6:e1d9da7fe856 534
bcostm 6:e1d9da7fe856 535 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 6:e1d9da7fe856 536 HAL_NVIC_SetPriority(DISCOVERY_EXT_I2Cx_EV_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 537 HAL_NVIC_EnableIRQ(DISCOVERY_EXT_I2Cx_EV_IRQn);
bcostm 6:e1d9da7fe856 538
bcostm 6:e1d9da7fe856 539 /* Enable and set I2Cx Interrupt to a lower priority */
bcostm 6:e1d9da7fe856 540 HAL_NVIC_SetPriority(DISCOVERY_EXT_I2Cx_ER_IRQn, 0x0F, 0);
bcostm 6:e1d9da7fe856 541 HAL_NVIC_EnableIRQ(DISCOVERY_EXT_I2Cx_ER_IRQn);
bcostm 6:e1d9da7fe856 542 }
bcostm 6:e1d9da7fe856 543 }
bcostm 6:e1d9da7fe856 544
bcostm 6:e1d9da7fe856 545 /**
bcostm 6:e1d9da7fe856 546 * @brief Initializes I2C HAL.
bcostm 6:e1d9da7fe856 547 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 548 * @retval None
bcostm 6:e1d9da7fe856 549 */
bcostm 6:e1d9da7fe856 550 static void I2Cx_Init(I2C_HandleTypeDef *i2c_handler)
bcostm 6:e1d9da7fe856 551 {
bcostm 6:e1d9da7fe856 552 if(HAL_I2C_GetState(i2c_handler) == HAL_I2C_STATE_RESET)
bcostm 6:e1d9da7fe856 553 {
bcostm 6:e1d9da7fe856 554 if (i2c_handler == (I2C_HandleTypeDef*)(&hI2cAudioHandler))
bcostm 6:e1d9da7fe856 555 {
bcostm 6:e1d9da7fe856 556 /* Audio and LCD I2C configuration */
bcostm 6:e1d9da7fe856 557 i2c_handler->Instance = DISCOVERY_AUDIO_I2Cx;
bcostm 6:e1d9da7fe856 558 }
bcostm 6:e1d9da7fe856 559 else
bcostm 6:e1d9da7fe856 560 {
bcostm 6:e1d9da7fe856 561 /* External, camera and Arduino connector I2C configuration */
bcostm 6:e1d9da7fe856 562 i2c_handler->Instance = DISCOVERY_EXT_I2Cx;
bcostm 6:e1d9da7fe856 563 }
bcostm 6:e1d9da7fe856 564 i2c_handler->Init.Timing = DISCOVERY_I2Cx_TIMING;
bcostm 6:e1d9da7fe856 565 i2c_handler->Init.OwnAddress1 = 0;
bcostm 6:e1d9da7fe856 566 i2c_handler->Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
bcostm 6:e1d9da7fe856 567 i2c_handler->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
bcostm 6:e1d9da7fe856 568 i2c_handler->Init.OwnAddress2 = 0;
bcostm 6:e1d9da7fe856 569 i2c_handler->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
bcostm 6:e1d9da7fe856 570 i2c_handler->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
bcostm 6:e1d9da7fe856 571
bcostm 6:e1d9da7fe856 572 /* Init the I2C */
bcostm 6:e1d9da7fe856 573 I2Cx_MspInit(i2c_handler);
bcostm 6:e1d9da7fe856 574 HAL_I2C_Init(i2c_handler);
bcostm 6:e1d9da7fe856 575 }
bcostm 6:e1d9da7fe856 576 }
bcostm 6:e1d9da7fe856 577
bcostm 6:e1d9da7fe856 578 /**
bcostm 6:e1d9da7fe856 579 * @brief Reads multiple data.
bcostm 6:e1d9da7fe856 580 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 581 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 582 * @param Reg: Reg address
bcostm 6:e1d9da7fe856 583 * @param MemAddress: Memory address
bcostm 6:e1d9da7fe856 584 * @param Buffer: Pointer to data buffer
bcostm 6:e1d9da7fe856 585 * @param Length: Length of the data
bcostm 6:e1d9da7fe856 586 * @retval Number of read data
bcostm 6:e1d9da7fe856 587 */
bcostm 6:e1d9da7fe856 588 static HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler,
bcostm 6:e1d9da7fe856 589 uint8_t Addr,
bcostm 6:e1d9da7fe856 590 uint16_t Reg,
bcostm 6:e1d9da7fe856 591 uint16_t MemAddress,
bcostm 6:e1d9da7fe856 592 uint8_t *Buffer,
bcostm 6:e1d9da7fe856 593 uint16_t Length)
bcostm 6:e1d9da7fe856 594 {
bcostm 6:e1d9da7fe856 595 HAL_StatusTypeDef status = HAL_OK;
bcostm 6:e1d9da7fe856 596
bcostm 6:e1d9da7fe856 597 status = HAL_I2C_Mem_Read(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
bcostm 6:e1d9da7fe856 598
bcostm 6:e1d9da7fe856 599 /* Check the communication status */
bcostm 6:e1d9da7fe856 600 if(status != HAL_OK)
bcostm 6:e1d9da7fe856 601 {
bcostm 6:e1d9da7fe856 602 /* I2C error occurred */
bcostm 6:e1d9da7fe856 603 I2Cx_Error(i2c_handler, Addr);
bcostm 6:e1d9da7fe856 604 }
bcostm 6:e1d9da7fe856 605 return status;
bcostm 6:e1d9da7fe856 606 }
bcostm 6:e1d9da7fe856 607
bcostm 6:e1d9da7fe856 608 /**
bcostm 6:e1d9da7fe856 609 * @brief Writes a value in a register of the device through BUS in using DMA mode.
bcostm 6:e1d9da7fe856 610 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 611 * @param Addr: Device address on BUS Bus.
bcostm 6:e1d9da7fe856 612 * @param Reg: The target register address to write
bcostm 6:e1d9da7fe856 613 * @param MemAddress: Memory address
bcostm 6:e1d9da7fe856 614 * @param Buffer: The target register value to be written
bcostm 6:e1d9da7fe856 615 * @param Length: buffer size to be written
bcostm 6:e1d9da7fe856 616 * @retval HAL status
bcostm 6:e1d9da7fe856 617 */
bcostm 6:e1d9da7fe856 618 static HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler,
bcostm 6:e1d9da7fe856 619 uint8_t Addr,
bcostm 6:e1d9da7fe856 620 uint16_t Reg,
bcostm 6:e1d9da7fe856 621 uint16_t MemAddress,
bcostm 6:e1d9da7fe856 622 uint8_t *Buffer,
bcostm 6:e1d9da7fe856 623 uint16_t Length)
bcostm 6:e1d9da7fe856 624 {
bcostm 6:e1d9da7fe856 625 HAL_StatusTypeDef status = HAL_OK;
bcostm 6:e1d9da7fe856 626
bcostm 6:e1d9da7fe856 627 status = HAL_I2C_Mem_Write(i2c_handler, Addr, (uint16_t)Reg, MemAddress, Buffer, Length, 1000);
bcostm 6:e1d9da7fe856 628
bcostm 6:e1d9da7fe856 629 /* Check the communication status */
bcostm 6:e1d9da7fe856 630 if(status != HAL_OK)
bcostm 6:e1d9da7fe856 631 {
bcostm 6:e1d9da7fe856 632 /* Re-Initiaize the I2C Bus */
bcostm 6:e1d9da7fe856 633 I2Cx_Error(i2c_handler, Addr);
bcostm 6:e1d9da7fe856 634 }
bcostm 6:e1d9da7fe856 635 return status;
bcostm 6:e1d9da7fe856 636 }
bcostm 6:e1d9da7fe856 637
bcostm 6:e1d9da7fe856 638 /**
bcostm 6:e1d9da7fe856 639 * @brief Checks if target device is ready for communication.
bcostm 6:e1d9da7fe856 640 * @note This function is used with Memory devices
bcostm 6:e1d9da7fe856 641 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 642 * @param DevAddress: Target device address
bcostm 6:e1d9da7fe856 643 * @param Trials: Number of trials
bcostm 6:e1d9da7fe856 644 * @retval HAL status
bcostm 6:e1d9da7fe856 645 */
bcostm 6:e1d9da7fe856 646 static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials)
bcostm 6:e1d9da7fe856 647 {
bcostm 6:e1d9da7fe856 648 return (HAL_I2C_IsDeviceReady(i2c_handler, DevAddress, Trials, 1000));
bcostm 6:e1d9da7fe856 649 }
bcostm 6:e1d9da7fe856 650
bcostm 6:e1d9da7fe856 651 /**
bcostm 6:e1d9da7fe856 652 * @brief Manages error callback by re-initializing I2C.
bcostm 6:e1d9da7fe856 653 * @param i2c_handler : I2C handler
bcostm 6:e1d9da7fe856 654 * @param Addr: I2C Address
bcostm 6:e1d9da7fe856 655 * @retval None
bcostm 6:e1d9da7fe856 656 */
bcostm 6:e1d9da7fe856 657 static void I2Cx_Error(I2C_HandleTypeDef *i2c_handler, uint8_t Addr)
bcostm 6:e1d9da7fe856 658 {
bcostm 6:e1d9da7fe856 659 /* De-initialize the I2C communication bus */
bcostm 6:e1d9da7fe856 660 HAL_I2C_DeInit(i2c_handler);
bcostm 6:e1d9da7fe856 661
bcostm 6:e1d9da7fe856 662 /* Re-Initialize the I2C communication bus */
bcostm 6:e1d9da7fe856 663 I2Cx_Init(i2c_handler);
bcostm 6:e1d9da7fe856 664 }
bcostm 6:e1d9da7fe856 665
bcostm 6:e1d9da7fe856 666 /*******************************************************************************
bcostm 6:e1d9da7fe856 667 LINK OPERATIONS
bcostm 6:e1d9da7fe856 668 *******************************************************************************/
bcostm 6:e1d9da7fe856 669
bcostm 6:e1d9da7fe856 670 /********************************* LINK AUDIO *********************************/
bcostm 6:e1d9da7fe856 671
bcostm 6:e1d9da7fe856 672 /**
bcostm 6:e1d9da7fe856 673 * @brief Initializes Audio low level.
bcostm 6:e1d9da7fe856 674 * @retval None
bcostm 6:e1d9da7fe856 675 */
bcostm 6:e1d9da7fe856 676 void AUDIO_IO_Init(void)
bcostm 6:e1d9da7fe856 677 {
bcostm 6:e1d9da7fe856 678 I2Cx_Init(&hI2cAudioHandler);
bcostm 6:e1d9da7fe856 679 }
bcostm 6:e1d9da7fe856 680
bcostm 6:e1d9da7fe856 681 /**
bcostm 6:e1d9da7fe856 682 * @brief Deinitializes Audio low level.
bcostm 6:e1d9da7fe856 683 * @retval None
bcostm 6:e1d9da7fe856 684 */
bcostm 6:e1d9da7fe856 685 void AUDIO_IO_DeInit(void)
bcostm 6:e1d9da7fe856 686 {
bcostm 6:e1d9da7fe856 687 }
bcostm 6:e1d9da7fe856 688
bcostm 6:e1d9da7fe856 689 /**
bcostm 6:e1d9da7fe856 690 * @brief Writes a single data.
bcostm 6:e1d9da7fe856 691 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 692 * @param Reg: Reg address
bcostm 6:e1d9da7fe856 693 * @param Value: Data to be written
bcostm 6:e1d9da7fe856 694 * @retval None
bcostm 6:e1d9da7fe856 695 */
bcostm 6:e1d9da7fe856 696 void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
bcostm 6:e1d9da7fe856 697 {
bcostm 6:e1d9da7fe856 698 uint16_t tmp = Value;
bcostm 6:e1d9da7fe856 699
bcostm 6:e1d9da7fe856 700 Value = ((uint16_t)(tmp >> 8) & 0x00FF);
bcostm 6:e1d9da7fe856 701
bcostm 6:e1d9da7fe856 702 Value |= ((uint16_t)(tmp << 8)& 0xFF00);
bcostm 6:e1d9da7fe856 703
bcostm 6:e1d9da7fe856 704 I2Cx_WriteMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_16BIT,(uint8_t*)&Value, 2);
bcostm 6:e1d9da7fe856 705 }
bcostm 6:e1d9da7fe856 706
bcostm 6:e1d9da7fe856 707 /**
bcostm 6:e1d9da7fe856 708 * @brief Reads a single data.
bcostm 6:e1d9da7fe856 709 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 710 * @param Reg: Reg address
bcostm 6:e1d9da7fe856 711 * @retval Data to be read
bcostm 6:e1d9da7fe856 712 */
bcostm 6:e1d9da7fe856 713 uint16_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg)
bcostm 6:e1d9da7fe856 714 {
bcostm 6:e1d9da7fe856 715 uint16_t read_value = 0, tmp = 0;
bcostm 6:e1d9da7fe856 716
bcostm 6:e1d9da7fe856 717 I2Cx_ReadMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_16BIT, (uint8_t*)&read_value, 2);
bcostm 6:e1d9da7fe856 718
bcostm 6:e1d9da7fe856 719 tmp = ((uint16_t)(read_value >> 8) & 0x00FF);
bcostm 6:e1d9da7fe856 720
bcostm 6:e1d9da7fe856 721 tmp |= ((uint16_t)(read_value << 8)& 0xFF00);
bcostm 6:e1d9da7fe856 722
bcostm 6:e1d9da7fe856 723 read_value = tmp;
bcostm 6:e1d9da7fe856 724
bcostm 6:e1d9da7fe856 725 return read_value;
bcostm 6:e1d9da7fe856 726 }
bcostm 6:e1d9da7fe856 727
bcostm 6:e1d9da7fe856 728 /**
bcostm 6:e1d9da7fe856 729 * @brief AUDIO Codec delay
bcostm 6:e1d9da7fe856 730 * @param Delay: Delay in ms
bcostm 6:e1d9da7fe856 731 * @retval None
bcostm 6:e1d9da7fe856 732 */
bcostm 6:e1d9da7fe856 733 void AUDIO_IO_Delay(uint32_t Delay)
bcostm 6:e1d9da7fe856 734 {
bcostm 6:e1d9da7fe856 735 //HAL_Delay(Delay); // MBED
bcostm 6:e1d9da7fe856 736 wait_ms(Delay); // MBED
bcostm 6:e1d9da7fe856 737 }
bcostm 6:e1d9da7fe856 738
bcostm 6:e1d9da7fe856 739 /********************************* LINK CAMERA ********************************/
bcostm 6:e1d9da7fe856 740
bcostm 6:e1d9da7fe856 741 /**
bcostm 6:e1d9da7fe856 742 * @brief Initializes Camera low level.
bcostm 6:e1d9da7fe856 743 * @retval None
bcostm 6:e1d9da7fe856 744 */
bcostm 6:e1d9da7fe856 745 void CAMERA_IO_Init(void)
bcostm 6:e1d9da7fe856 746 {
bcostm 6:e1d9da7fe856 747 I2Cx_Init(&hI2cExtHandler);
bcostm 6:e1d9da7fe856 748 }
bcostm 6:e1d9da7fe856 749
bcostm 6:e1d9da7fe856 750 /**
bcostm 6:e1d9da7fe856 751 * @brief Camera writes single data.
bcostm 6:e1d9da7fe856 752 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 753 * @param Reg: Register address
bcostm 6:e1d9da7fe856 754 * @param Value: Data to be written
bcostm 6:e1d9da7fe856 755 * @retval None
bcostm 6:e1d9da7fe856 756 */
bcostm 6:e1d9da7fe856 757 void CAMERA_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
bcostm 6:e1d9da7fe856 758 {
bcostm 6:e1d9da7fe856 759 I2Cx_WriteMultiple(&hI2cExtHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT,(uint8_t*)&Value, 1);
bcostm 6:e1d9da7fe856 760 }
bcostm 6:e1d9da7fe856 761
bcostm 6:e1d9da7fe856 762 /**
bcostm 6:e1d9da7fe856 763 * @brief Camera reads single data.
bcostm 6:e1d9da7fe856 764 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 765 * @param Reg: Register address
bcostm 6:e1d9da7fe856 766 * @retval Read data
bcostm 6:e1d9da7fe856 767 */
bcostm 6:e1d9da7fe856 768 uint8_t CAMERA_IO_Read(uint8_t Addr, uint8_t Reg)
bcostm 6:e1d9da7fe856 769 {
bcostm 6:e1d9da7fe856 770 uint8_t read_value = 0;
bcostm 6:e1d9da7fe856 771
bcostm 6:e1d9da7fe856 772 I2Cx_ReadMultiple(&hI2cExtHandler, Addr, Reg, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&read_value, 1);
bcostm 6:e1d9da7fe856 773
bcostm 6:e1d9da7fe856 774 return read_value;
bcostm 6:e1d9da7fe856 775 }
bcostm 6:e1d9da7fe856 776
bcostm 6:e1d9da7fe856 777 /**
bcostm 6:e1d9da7fe856 778 * @brief Camera delay
bcostm 6:e1d9da7fe856 779 * @param Delay: Delay in ms
bcostm 6:e1d9da7fe856 780 * @retval None
bcostm 6:e1d9da7fe856 781 */
bcostm 6:e1d9da7fe856 782 void CAMERA_Delay(uint32_t Delay)
bcostm 6:e1d9da7fe856 783 {
bcostm 6:e1d9da7fe856 784 //HAL_Delay(Delay); // MBED
bcostm 6:e1d9da7fe856 785 wait_ms(Delay); // MBED
bcostm 6:e1d9da7fe856 786 }
bcostm 6:e1d9da7fe856 787
bcostm 6:e1d9da7fe856 788 /******************************** LINK I2C EEPROM *****************************/
bcostm 6:e1d9da7fe856 789
bcostm 6:e1d9da7fe856 790 /**
bcostm 6:e1d9da7fe856 791 * @brief Initializes peripherals used by the I2C EEPROM driver.
bcostm 6:e1d9da7fe856 792 * @retval None
bcostm 6:e1d9da7fe856 793 */
bcostm 6:e1d9da7fe856 794 void EEPROM_IO_Init(void)
bcostm 6:e1d9da7fe856 795 {
bcostm 6:e1d9da7fe856 796 I2Cx_Init(&hI2cExtHandler);
bcostm 6:e1d9da7fe856 797 }
bcostm 6:e1d9da7fe856 798
bcostm 6:e1d9da7fe856 799 /**
bcostm 6:e1d9da7fe856 800 * @brief Write data to I2C EEPROM driver in using DMA channel.
bcostm 6:e1d9da7fe856 801 * @param DevAddress: Target device address
bcostm 6:e1d9da7fe856 802 * @param MemAddress: Internal memory address
bcostm 6:e1d9da7fe856 803 * @param pBuffer: Pointer to data buffer
bcostm 6:e1d9da7fe856 804 * @param BufferSize: Amount of data to be sent
bcostm 6:e1d9da7fe856 805 * @retval HAL status
bcostm 6:e1d9da7fe856 806 */
bcostm 6:e1d9da7fe856 807 HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
bcostm 6:e1d9da7fe856 808 {
bcostm 6:e1d9da7fe856 809 return (I2Cx_WriteMultiple(&hI2cExtHandler, DevAddress, MemAddress, I2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
bcostm 6:e1d9da7fe856 810 }
bcostm 6:e1d9da7fe856 811
bcostm 6:e1d9da7fe856 812 /**
bcostm 6:e1d9da7fe856 813 * @brief Read data from I2C EEPROM driver in using DMA channel.
bcostm 6:e1d9da7fe856 814 * @param DevAddress: Target device address
bcostm 6:e1d9da7fe856 815 * @param MemAddress: Internal memory address
bcostm 6:e1d9da7fe856 816 * @param pBuffer: Pointer to data buffer
bcostm 6:e1d9da7fe856 817 * @param BufferSize: Amount of data to be read
bcostm 6:e1d9da7fe856 818 * @retval HAL status
bcostm 6:e1d9da7fe856 819 */
bcostm 6:e1d9da7fe856 820 HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
bcostm 6:e1d9da7fe856 821 {
bcostm 6:e1d9da7fe856 822 return (I2Cx_ReadMultiple(&hI2cExtHandler, DevAddress, MemAddress, I2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
bcostm 6:e1d9da7fe856 823 }
bcostm 6:e1d9da7fe856 824
bcostm 6:e1d9da7fe856 825 /**
bcostm 6:e1d9da7fe856 826 * @brief Checks if target device is ready for communication.
bcostm 6:e1d9da7fe856 827 * @note This function is used with Memory devices
bcostm 6:e1d9da7fe856 828 * @param DevAddress: Target device address
bcostm 6:e1d9da7fe856 829 * @param Trials: Number of trials
bcostm 6:e1d9da7fe856 830 * @retval HAL status
bcostm 6:e1d9da7fe856 831 */
bcostm 6:e1d9da7fe856 832 HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
bcostm 6:e1d9da7fe856 833 {
bcostm 6:e1d9da7fe856 834 return (I2Cx_IsDeviceReady(&hI2cExtHandler, DevAddress, Trials));
bcostm 6:e1d9da7fe856 835 }
bcostm 6:e1d9da7fe856 836
bcostm 6:e1d9da7fe856 837 /********************************* LINK TOUCHSCREEN *********************************/
bcostm 6:e1d9da7fe856 838
bcostm 6:e1d9da7fe856 839 /**
bcostm 6:e1d9da7fe856 840 * @brief Initializes Touchscreen low level.
bcostm 6:e1d9da7fe856 841 * @retval None
bcostm 6:e1d9da7fe856 842 */
bcostm 6:e1d9da7fe856 843 void TS_IO_Init(void)
bcostm 6:e1d9da7fe856 844 {
bcostm 6:e1d9da7fe856 845 I2Cx_Init(&hI2cAudioHandler);
bcostm 6:e1d9da7fe856 846 }
bcostm 6:e1d9da7fe856 847
bcostm 6:e1d9da7fe856 848 /**
bcostm 6:e1d9da7fe856 849 * @brief Writes a single data.
bcostm 6:e1d9da7fe856 850 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 851 * @param Reg: Reg address
bcostm 6:e1d9da7fe856 852 * @param Value: Data to be written
bcostm 6:e1d9da7fe856 853 * @retval None
bcostm 6:e1d9da7fe856 854 */
bcostm 6:e1d9da7fe856 855 void TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
bcostm 6:e1d9da7fe856 856 {
bcostm 6:e1d9da7fe856 857 I2Cx_WriteMultiple(&hI2cAudioHandler, Addr, (uint16_t)Reg, I2C_MEMADD_SIZE_8BIT,(uint8_t*)&Value, 1);
bcostm 6:e1d9da7fe856 858 }
bcostm 6:e1d9da7fe856 859
bcostm 6:e1d9da7fe856 860 /**
bcostm 6:e1d9da7fe856 861 * @brief Reads a single data.
bcostm 6:e1d9da7fe856 862 * @param Addr: I2C address
bcostm 6:e1d9da7fe856 863 * @param Reg: Reg address
bcostm 6:e1d9da7fe856 864 * @retval Data to be read
bcostm 6:e1d9da7fe856 865 */
bcostm 6:e1d9da7fe856 866 uint8_t TS_IO_Read(uint8_t Addr, uint8_t Reg)
bcostm 6:e1d9da7fe856 867 {
bcostm 6:e1d9da7fe856 868 uint8_t read_value = 0;
bcostm 6:e1d9da7fe856 869
bcostm 6:e1d9da7fe856 870 I2Cx_ReadMultiple(&hI2cAudioHandler, Addr, Reg, I2C_MEMADD_SIZE_8BIT, (uint8_t*)&read_value, 1);
bcostm 6:e1d9da7fe856 871
bcostm 6:e1d9da7fe856 872 return read_value;
bcostm 6:e1d9da7fe856 873 }
bcostm 6:e1d9da7fe856 874
bcostm 6:e1d9da7fe856 875 /**
bcostm 6:e1d9da7fe856 876 * @brief TS delay
bcostm 6:e1d9da7fe856 877 * @param Delay: Delay in ms
bcostm 6:e1d9da7fe856 878 * @retval None
bcostm 6:e1d9da7fe856 879 */
bcostm 6:e1d9da7fe856 880 void TS_IO_Delay(uint32_t Delay)
bcostm 6:e1d9da7fe856 881 {
bcostm 6:e1d9da7fe856 882 //HAL_Delay(Delay); // MBED
bcostm 6:e1d9da7fe856 883 wait_ms(Delay); // MBED
bcostm 6:e1d9da7fe856 884 }
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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/