.

Fork of BSP_DISCO_F746NG by ST

Committer:
bcostm
Date:
Wed Nov 09 18:26:13 2016 +0100
Revision:
5:5a395e126678
Parent:
0:c9112f0c67e3
Add more MBED comments

Who changed what in which revision?

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