mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
<>
Date:
Fri Sep 30 16:49:46 2016 +0100
Revision:
127:25aea2a3f4e3
Parent:
122:f9eeca106725
Release 127 of the mbed library

Ports for Upcoming Targets

2669: Added u-blox C029 target https://github.com/ARMmbed/mbed-os/pull/2669
2707: [EFM32] Add IAR support for remaining Silicon Labs targets https://github.com/ARMmbed/mbed-os/pull/2707
2819: MultiTech xDot platform support - 09.26.2016 https://github.com/ARMmbed/mbed-os/pull/2819
2827: include MultiTech xDot in mbed 5 releases https://github.com/ARMmbed/mbed-os/pull/2827

Fixes and Changes

2522: Add CThunk for CM7 https://github.com/ARMmbed/mbed-os/pull/2522
2518: Enable uvisor on Beetle https://github.com/ARMmbed/mbed-os/pull/2518
2571: STM32F7 - Add asynchronous serial https://github.com/ARMmbed/mbed-os/pull/2571
2616: STM32F3xx - Add Serial Flow Control pins + enable it https://github.com/ARMmbed/mbed-os/pull/2616
2619: NUCLEO_L152RE - Add Serial Flow Control https://github.com/ARMmbed/mbed-os/pull/2619
2620: NUCLEO_F429ZI - Add SERIAL_FC macro https://github.com/ARMmbed/mbed-os/pull/2620
2666: [EFM32] Microsecond ticker optimization https://github.com/ARMmbed/mbed-os/pull/2666
2681: STM32F0xx - Add support of ADC internal channels https://github.com/ARMmbed/mbed-os/pull/2681
2687: [NRF5] Add fs_data symbol in data secton for gcc https://github.com/ARMmbed/mbed-os/pull/2687
2696: Add device_has to all nrf51 devices https://github.com/ARMmbed/mbed-os/pull/2696
2703: TARGET_NRF5: Changed 'serial_baud' implementation to support special baud rates. https://github.com/ARMmbed/mbed-os/pull/2703
2704: DISCO_L476VG: add SPI nicknames https://github.com/ARMmbed/mbed-os/pull/2704
2723: KSDK serial_api.c: Fix assertion error for ParityEven https://github.com/ARMmbed/mbed-os/pull/2723
2463: [STM32L0] Add asynchronous serial https://github.com/ARMmbed/mbed-os/pull/2463
2572: Fix STM32F407VG target name and LPC11U6X linker errors https://github.com/ARMmbed/mbed-os/pull/2572
2698: DELTA_DFBM_NQ620 target https://github.com/ARMmbed/mbed-os/pull/2698
2542: Dev spi asynch stm32f4 https://github.com/ARMmbed/mbed-os/pull/2542
2650: STM32F3 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2650
2415: [STM32F0] Add asynchronous serial https://github.com/ARMmbed/mbed-os/pull/2415
2585: Added support for ADC only pins in LPC43xx https://github.com/ARMmbed/mbed-os/pull/2585
2622: [STM32F4] Add asynchronous I2C https://github.com/ARMmbed/mbed-os/pull/2622
2719: Updated ARM linker scripts for Kinetis platforms that use SDK 2.0 https://github.com/ARMmbed/mbed-os/pull/2719
2728: Added ethernet and enabled IPV4 feature for the EVK-ODIN-W2/C029 target https://github.com/ARMmbed/mbed-os/pull/2728
2747: [LPC11U68] Fix pin interrupt select offset https://github.com/ARMmbed/mbed-os/pull/2747
2751: STM32L0xx - Add Serial Flow Control https://github.com/ARMmbed/mbed-os/pull/2751
2753: [NUCLEO_F767ZI] Add CAN capability https://github.com/ARMmbed/mbed-os/pull/2753
2759: STM32F0 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2759
2763: STM32L1 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2763
2764: STM32L4 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2764
2771: STM32L4 - Update deepsleep implementation https://github.com/ARMmbed/mbed-os/pull/2771
2775: Update KSDK SDHC driver for K64F & K66F https://github.com/ARMmbed/mbed-os/pull/2775
2792: [NUCLEO_F303ZE] MBED-OS5 capability https://github.com/ARMmbed/mbed-os/pull/2792
2762: STM32L0 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2762
2761: STM32F7 - Add low power timer https://github.com/ARMmbed/mbed-os/pull/2761

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32f7xx_hal_usart.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.1.0
Kojto 122:f9eeca106725 6 * @date 22-April-2016
Kojto 122:f9eeca106725 7 * @brief Header file of USART HAL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32F7xx_HAL_USART_H
Kojto 122:f9eeca106725 40 #define __STM32F7xx_HAL_USART_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32f7xx_hal_def.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 /** @addtogroup USART
Kojto 122:f9eeca106725 54 * @{
Kojto 122:f9eeca106725 55 */
Kojto 122:f9eeca106725 56
Kojto 122:f9eeca106725 57 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 58 /** @defgroup USART_Exported_Types USART Exported Types
Kojto 122:f9eeca106725 59 * @{
Kojto 122:f9eeca106725 60 */
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /**
Kojto 122:f9eeca106725 63 * @brief USART Init Structure definition
Kojto 122:f9eeca106725 64 */
Kojto 122:f9eeca106725 65 typedef struct
Kojto 122:f9eeca106725 66 {
Kojto 122:f9eeca106725 67 uint32_t BaudRate; /*!< This member configures the Usart communication baud rate.
Kojto 122:f9eeca106725 68 The baud rate is computed using the following formula:
Kojto 122:f9eeca106725 69 Baud Rate Register = ((PCLKx) / ((huart->Init.BaudRate))) */
Kojto 122:f9eeca106725 70
Kojto 122:f9eeca106725 71 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
Kojto 122:f9eeca106725 72 This parameter can be a value of @ref USARTEx_Word_Length */
Kojto 122:f9eeca106725 73
Kojto 122:f9eeca106725 74 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
Kojto 122:f9eeca106725 75 This parameter can be a value of @ref USART_Stop_Bits */
Kojto 122:f9eeca106725 76
Kojto 122:f9eeca106725 77 uint32_t Parity; /*!< Specifies the parity mode.
Kojto 122:f9eeca106725 78 This parameter can be a value of @ref USART_Parity
Kojto 122:f9eeca106725 79 @note When parity is enabled, the computed parity is inserted
Kojto 122:f9eeca106725 80 at the MSB position of the transmitted data (9th bit when
Kojto 122:f9eeca106725 81 the word length is set to 9 data bits; 8th bit when the
Kojto 122:f9eeca106725 82 word length is set to 8 data bits). */
Kojto 122:f9eeca106725 83
Kojto 122:f9eeca106725 84 uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
Kojto 122:f9eeca106725 85 This parameter can be a value of @ref USART_Mode */
Kojto 122:f9eeca106725 86
Kojto 122:f9eeca106725 87 uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to fPCLK/8).
Kojto 122:f9eeca106725 88 This parameter can be a value of @ref USART_Over_Sampling */
Kojto 122:f9eeca106725 89
Kojto 122:f9eeca106725 90 uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock.
Kojto 122:f9eeca106725 91 This parameter can be a value of @ref USART_Clock_Polarity */
Kojto 122:f9eeca106725 92
Kojto 122:f9eeca106725 93 uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made.
Kojto 122:f9eeca106725 94 This parameter can be a value of @ref USART_Clock_Phase */
Kojto 122:f9eeca106725 95
Kojto 122:f9eeca106725 96 uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
Kojto 122:f9eeca106725 97 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
Kojto 122:f9eeca106725 98 This parameter can be a value of @ref USART_Last_Bit */
Kojto 122:f9eeca106725 99 }USART_InitTypeDef;
Kojto 122:f9eeca106725 100
Kojto 122:f9eeca106725 101 /**
Kojto 122:f9eeca106725 102 * @brief HAL USART State structures definition
Kojto 122:f9eeca106725 103 */
Kojto 122:f9eeca106725 104 typedef enum
Kojto 122:f9eeca106725 105 {
Kojto 122:f9eeca106725 106 HAL_USART_STATE_RESET = 0x00U, /*!< Peripheral is not initialized */
Kojto 122:f9eeca106725 107 HAL_USART_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
Kojto 122:f9eeca106725 108 HAL_USART_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */
Kojto 122:f9eeca106725 109 HAL_USART_STATE_BUSY_TX = 0x12U, /*!< Data Transmission process is ongoing */
Kojto 122:f9eeca106725 110 HAL_USART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */
Kojto 122:f9eeca106725 111 HAL_USART_STATE_BUSY_TX_RX = 0x32U, /*!< Data Transmission Reception process is ongoing */
Kojto 122:f9eeca106725 112 HAL_USART_STATE_TIMEOUT = 0x03U, /*!< Timeout state */
Kojto 122:f9eeca106725 113 HAL_USART_STATE_ERROR = 0x04U /*!< Error */
Kojto 122:f9eeca106725 114 }HAL_USART_StateTypeDef;
Kojto 122:f9eeca106725 115
Kojto 122:f9eeca106725 116
Kojto 122:f9eeca106725 117 /**
Kojto 122:f9eeca106725 118 * @brief USART clock sources definitions
Kojto 122:f9eeca106725 119 */
Kojto 122:f9eeca106725 120 typedef enum
Kojto 122:f9eeca106725 121 {
Kojto 122:f9eeca106725 122 USART_CLOCKSOURCE_PCLK1 = 0x00U, /*!< PCLK1 clock source */
Kojto 122:f9eeca106725 123 USART_CLOCKSOURCE_PCLK2 = 0x01U, /*!< PCLK2 clock source */
Kojto 122:f9eeca106725 124 USART_CLOCKSOURCE_HSI = 0x02U, /*!< HSI clock source */
Kojto 122:f9eeca106725 125 USART_CLOCKSOURCE_SYSCLK = 0x04U, /*!< SYSCLK clock source */
Kojto 122:f9eeca106725 126 USART_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */
Kojto 122:f9eeca106725 127 USART_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */
Kojto 122:f9eeca106725 128 }USART_ClockSourceTypeDef;
Kojto 122:f9eeca106725 129
Kojto 122:f9eeca106725 130
Kojto 122:f9eeca106725 131 /**
Kojto 122:f9eeca106725 132 * @brief USART handle Structure definition
Kojto 122:f9eeca106725 133 */
Kojto 122:f9eeca106725 134 typedef struct
Kojto 122:f9eeca106725 135 {
Kojto 122:f9eeca106725 136 USART_TypeDef *Instance; /*!< USART registers base address */
Kojto 122:f9eeca106725 137
Kojto 122:f9eeca106725 138 USART_InitTypeDef Init; /*!< USART communication parameters */
Kojto 122:f9eeca106725 139
Kojto 122:f9eeca106725 140 uint8_t *pTxBuffPtr; /*!< Pointer to USART Tx transfer Buffer */
Kojto 122:f9eeca106725 141
Kojto 122:f9eeca106725 142 uint16_t TxXferSize; /*!< USART Tx Transfer size */
Kojto 122:f9eeca106725 143
Kojto 122:f9eeca106725 144 uint16_t TxXferCount; /*!< USART Tx Transfer Counter */
Kojto 122:f9eeca106725 145
Kojto 122:f9eeca106725 146 uint8_t *pRxBuffPtr; /*!< Pointer to USART Rx transfer Buffer */
Kojto 122:f9eeca106725 147
Kojto 122:f9eeca106725 148 uint16_t RxXferSize; /*!< USART Rx Transfer size */
Kojto 122:f9eeca106725 149
Kojto 122:f9eeca106725 150 uint16_t RxXferCount; /*!< USART Rx Transfer Counter */
Kojto 122:f9eeca106725 151
Kojto 122:f9eeca106725 152 uint16_t Mask; /*!< USART Rx RDR register mask */
Kojto 122:f9eeca106725 153
Kojto 122:f9eeca106725 154 DMA_HandleTypeDef *hdmatx; /*!< USART Tx DMA Handle parameters */
Kojto 122:f9eeca106725 155
Kojto 122:f9eeca106725 156 DMA_HandleTypeDef *hdmarx; /*!< USART Rx DMA Handle parameters */
Kojto 122:f9eeca106725 157
Kojto 122:f9eeca106725 158 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 122:f9eeca106725 159
Kojto 122:f9eeca106725 160 HAL_USART_StateTypeDef State; /*!< USART communication state */
Kojto 122:f9eeca106725 161
Kojto 122:f9eeca106725 162 __IO uint32_t ErrorCode; /*!< USART Error code */
Kojto 122:f9eeca106725 163
Kojto 122:f9eeca106725 164 }USART_HandleTypeDef;
Kojto 122:f9eeca106725 165 /**
Kojto 122:f9eeca106725 166 * @}
Kojto 122:f9eeca106725 167 */
Kojto 122:f9eeca106725 168
Kojto 122:f9eeca106725 169 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 170 /** @defgroup USART_Exported_Constants USART Exported Constants
Kojto 122:f9eeca106725 171 * @{
Kojto 122:f9eeca106725 172 */
Kojto 122:f9eeca106725 173
Kojto 122:f9eeca106725 174 /** @defgroup USART_Error_Code USART Error Code
Kojto 122:f9eeca106725 175 * @brief USART Error Code
Kojto 122:f9eeca106725 176 * @{
Kojto 122:f9eeca106725 177 */
Kojto 122:f9eeca106725 178 #define HAL_USART_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
Kojto 122:f9eeca106725 179 #define HAL_USART_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */
Kojto 122:f9eeca106725 180 #define HAL_USART_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */
Kojto 122:f9eeca106725 181 #define HAL_USART_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */
Kojto 122:f9eeca106725 182 #define HAL_USART_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */
Kojto 122:f9eeca106725 183 #define HAL_USART_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */
Kojto 122:f9eeca106725 184 /**
Kojto 122:f9eeca106725 185 * @}
Kojto 122:f9eeca106725 186 */
Kojto 122:f9eeca106725 187
Kojto 122:f9eeca106725 188 /** @defgroup USART_Stop_Bits USART Number of Stop Bits
Kojto 122:f9eeca106725 189 * @{
Kojto 122:f9eeca106725 190 */
Kojto 122:f9eeca106725 191 #define USART_STOPBITS_1 ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 192 #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
Kojto 122:f9eeca106725 193 #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
Kojto 122:f9eeca106725 194 /**
Kojto 122:f9eeca106725 195 * @}
Kojto 122:f9eeca106725 196 */
Kojto 122:f9eeca106725 197
Kojto 122:f9eeca106725 198 /** @defgroup USART_Parity USART Parity
Kojto 122:f9eeca106725 199 * @{
Kojto 122:f9eeca106725 200 */
Kojto 122:f9eeca106725 201 #define USART_PARITY_NONE ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 202 #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
Kojto 122:f9eeca106725 203 #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
Kojto 122:f9eeca106725 204 /**
Kojto 122:f9eeca106725 205 * @}
Kojto 122:f9eeca106725 206 */
Kojto 122:f9eeca106725 207
Kojto 122:f9eeca106725 208 /** @defgroup USART_Mode USART Mode
Kojto 122:f9eeca106725 209 * @{
Kojto 122:f9eeca106725 210 */
Kojto 122:f9eeca106725 211 #define USART_MODE_RX ((uint32_t)USART_CR1_RE)
Kojto 122:f9eeca106725 212 #define USART_MODE_TX ((uint32_t)USART_CR1_TE)
Kojto 122:f9eeca106725 213 #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
Kojto 122:f9eeca106725 214 /**
Kojto 122:f9eeca106725 215 * @}
Kojto 122:f9eeca106725 216 */
Kojto 122:f9eeca106725 217
Kojto 122:f9eeca106725 218 /** @defgroup USART_Over_Sampling USART Over Sampling
Kojto 122:f9eeca106725 219 * @{
Kojto 122:f9eeca106725 220 */
Kojto 122:f9eeca106725 221 #define USART_OVERSAMPLING_16 ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 222 #define USART_OVERSAMPLING_8 ((uint32_t)USART_CR1_OVER8)
Kojto 122:f9eeca106725 223 /**
Kojto 122:f9eeca106725 224 * @}
Kojto 122:f9eeca106725 225 */
Kojto 122:f9eeca106725 226 /** @defgroup USART_Clock USART Clock
Kojto 122:f9eeca106725 227 * @{
Kojto 122:f9eeca106725 228 */
Kojto 122:f9eeca106725 229 #define USART_CLOCK_DISABLE ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 230 #define USART_CLOCK_ENABLE ((uint32_t)USART_CR2_CLKEN)
Kojto 122:f9eeca106725 231 /**
Kojto 122:f9eeca106725 232 * @}
Kojto 122:f9eeca106725 233 */
Kojto 122:f9eeca106725 234
Kojto 122:f9eeca106725 235 /** @defgroup USART_Clock_Polarity USART Clock Polarity
Kojto 122:f9eeca106725 236 * @{
Kojto 122:f9eeca106725 237 */
Kojto 122:f9eeca106725 238 #define USART_POLARITY_LOW ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 239 #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL)
Kojto 122:f9eeca106725 240 /**
Kojto 122:f9eeca106725 241 * @}
Kojto 122:f9eeca106725 242 */
Kojto 122:f9eeca106725 243
Kojto 122:f9eeca106725 244 /** @defgroup USART_Clock_Phase USART Clock Phase
Kojto 122:f9eeca106725 245 * @{
Kojto 122:f9eeca106725 246 */
Kojto 122:f9eeca106725 247 #define USART_PHASE_1EDGE ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 248 #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA)
Kojto 122:f9eeca106725 249 /**
Kojto 122:f9eeca106725 250 * @}
Kojto 122:f9eeca106725 251 */
Kojto 122:f9eeca106725 252
Kojto 122:f9eeca106725 253 /** @defgroup USART_Last_Bit USART Last Bit
Kojto 122:f9eeca106725 254 * @{
Kojto 122:f9eeca106725 255 */
Kojto 122:f9eeca106725 256 #define USART_LASTBIT_DISABLE ((uint32_t)0x0000U)
Kojto 122:f9eeca106725 257 #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL)
Kojto 122:f9eeca106725 258 /**
Kojto 122:f9eeca106725 259 * @}
Kojto 122:f9eeca106725 260 */
Kojto 122:f9eeca106725 261
Kojto 122:f9eeca106725 262 /** @defgroup USART_Request_Parameters USART Request Parameters
Kojto 122:f9eeca106725 263 * @{
Kojto 122:f9eeca106725 264 */
Kojto 122:f9eeca106725 265 #define USART_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
Kojto 122:f9eeca106725 266 #define USART_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
Kojto 122:f9eeca106725 267 /**
Kojto 122:f9eeca106725 268 * @}
Kojto 122:f9eeca106725 269 */
Kojto 122:f9eeca106725 270
Kojto 122:f9eeca106725 271 /** @defgroup USART_Flags USART Flags
Kojto 122:f9eeca106725 272 * Elements values convention: 0xXXXX
Kojto 122:f9eeca106725 273 * - 0xXXXX : Flag mask in the ISR register
Kojto 122:f9eeca106725 274 * @{
Kojto 122:f9eeca106725 275 */
Kojto 122:f9eeca106725 276 #define USART_FLAG_REACK ((uint32_t)0x00400000U)
Kojto 122:f9eeca106725 277 #define USART_FLAG_TEACK ((uint32_t)0x00200000U)
Kojto 122:f9eeca106725 278 #define USART_FLAG_BUSY ((uint32_t)0x00010000U)
Kojto 122:f9eeca106725 279 #define USART_FLAG_CTS ((uint32_t)0x00000400U)
Kojto 122:f9eeca106725 280 #define USART_FLAG_CTSIF ((uint32_t)0x00000200U)
Kojto 122:f9eeca106725 281 #define USART_FLAG_LBDF ((uint32_t)0x00000100U)
Kojto 122:f9eeca106725 282 #define USART_FLAG_TXE ((uint32_t)0x00000080U)
Kojto 122:f9eeca106725 283 #define USART_FLAG_TC ((uint32_t)0x00000040U)
Kojto 122:f9eeca106725 284 #define USART_FLAG_RXNE ((uint32_t)0x00000020U)
Kojto 122:f9eeca106725 285 #define USART_FLAG_IDLE ((uint32_t)0x00000010U)
Kojto 122:f9eeca106725 286 #define USART_FLAG_ORE ((uint32_t)0x00000008U)
Kojto 122:f9eeca106725 287 #define USART_FLAG_NE ((uint32_t)0x00000004U)
Kojto 122:f9eeca106725 288 #define USART_FLAG_FE ((uint32_t)0x00000002U)
Kojto 122:f9eeca106725 289 #define USART_FLAG_PE ((uint32_t)0x00000001U)
Kojto 122:f9eeca106725 290 /**
Kojto 122:f9eeca106725 291 * @}
Kojto 122:f9eeca106725 292 */
Kojto 122:f9eeca106725 293
Kojto 122:f9eeca106725 294 /** @defgroup USART_Interrupt_definition USART Interrupts Definition
Kojto 122:f9eeca106725 295 * Elements values convention: 0000ZZZZ0XXYYYYYb
Kojto 122:f9eeca106725 296 * - YYYYY : Interrupt source position in the XX register (5bits)
Kojto 122:f9eeca106725 297 * - XX : Interrupt source register (2bits)
Kojto 122:f9eeca106725 298 * - 01: CR1 register
Kojto 122:f9eeca106725 299 * - 10: CR2 register
Kojto 122:f9eeca106725 300 * - 11: CR3 register
Kojto 122:f9eeca106725 301 * - ZZZZ : Flag position in the ISR register(4bits)
Kojto 122:f9eeca106725 302 * @{
Kojto 122:f9eeca106725 303 */
Kojto 122:f9eeca106725 304
Kojto 122:f9eeca106725 305 #define USART_IT_PE ((uint16_t)0x0028U)
Kojto 122:f9eeca106725 306 #define USART_IT_TXE ((uint16_t)0x0727U)
Kojto 122:f9eeca106725 307 #define USART_IT_TC ((uint16_t)0x0626U)
Kojto 122:f9eeca106725 308 #define USART_IT_RXNE ((uint16_t)0x0525U)
Kojto 122:f9eeca106725 309 #define USART_IT_IDLE ((uint16_t)0x0424U)
Kojto 122:f9eeca106725 310 #define USART_IT_ERR ((uint16_t)0x0060U)
Kojto 122:f9eeca106725 311
Kojto 122:f9eeca106725 312 #define USART_IT_ORE ((uint16_t)0x0300U)
Kojto 122:f9eeca106725 313 #define USART_IT_NE ((uint16_t)0x0200U)
Kojto 122:f9eeca106725 314 #define USART_IT_FE ((uint16_t)0x0100U)
Kojto 122:f9eeca106725 315 /**
Kojto 122:f9eeca106725 316 * @}
Kojto 122:f9eeca106725 317 */
Kojto 122:f9eeca106725 318
Kojto 122:f9eeca106725 319 /** @defgroup USART_IT_CLEAR_Flags USART Interruption Clear Flags
Kojto 122:f9eeca106725 320 * @{
Kojto 122:f9eeca106725 321 */
Kojto 122:f9eeca106725 322 #define USART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
Kojto 122:f9eeca106725 323 #define USART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
Kojto 122:f9eeca106725 324 #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
Kojto 122:f9eeca106725 325 #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
Kojto 122:f9eeca106725 326 #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
Kojto 122:f9eeca106725 327 #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
Kojto 122:f9eeca106725 328 #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
Kojto 122:f9eeca106725 329 /**
Kojto 122:f9eeca106725 330 * @}
Kojto 122:f9eeca106725 331 */
Kojto 122:f9eeca106725 332
Kojto 122:f9eeca106725 333 /**
Kojto 122:f9eeca106725 334 * @}
Kojto 122:f9eeca106725 335 */
Kojto 122:f9eeca106725 336
Kojto 122:f9eeca106725 337 /* Exported macros -----------------------------------------------------------*/
Kojto 122:f9eeca106725 338 /** @defgroup USART_Exported_Macros USART Exported Macros
Kojto 122:f9eeca106725 339 * @{
Kojto 122:f9eeca106725 340 */
Kojto 122:f9eeca106725 341
Kojto 122:f9eeca106725 342 /** @brief Reset USART handle state
Kojto 122:f9eeca106725 343 * @param __HANDLE__: USART handle.
Kojto 122:f9eeca106725 344 * @retval None
Kojto 122:f9eeca106725 345 */
Kojto 122:f9eeca106725 346 #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET)
Kojto 122:f9eeca106725 347
Kojto 122:f9eeca106725 348 /** @brief Checks whether the specified USART flag is set or not.
Kojto 122:f9eeca106725 349 * @param __HANDLE__: specifies the USART Handle
Kojto 122:f9eeca106725 350 * @param __FLAG__: specifies the flag to check.
Kojto 122:f9eeca106725 351 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 352 * @arg USART_FLAG_REACK: Receive enable acknowledge flag
Kojto 122:f9eeca106725 353 * @arg USART_FLAG_TEACK: Transmit enable acknowledge flag
Kojto 122:f9eeca106725 354 * @arg USART_FLAG_BUSY: Busy flag
Kojto 122:f9eeca106725 355 * @arg USART_FLAG_CTS: CTS Change flag
Kojto 122:f9eeca106725 356 * @arg USART_FLAG_TXE: Transmit data register empty flag
Kojto 122:f9eeca106725 357 * @arg USART_FLAG_TC: Transmission Complete flag
Kojto 122:f9eeca106725 358 * @arg USART_FLAG_RXNE: Receive data register not empty flag
Kojto 122:f9eeca106725 359 * @arg USART_FLAG_IDLE: Idle Line detection flag
Kojto 122:f9eeca106725 360 * @arg USART_FLAG_ORE: OverRun Error flag
Kojto 122:f9eeca106725 361 * @arg USART_FLAG_NE: Noise Error flag
Kojto 122:f9eeca106725 362 * @arg USART_FLAG_FE: Framing Error flag
Kojto 122:f9eeca106725 363 * @arg USART_FLAG_PE: Parity Error flag
Kojto 122:f9eeca106725 364 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 122:f9eeca106725 365 */
Kojto 122:f9eeca106725 366 #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
Kojto 122:f9eeca106725 367
Kojto 122:f9eeca106725 368
Kojto 122:f9eeca106725 369 /** @brief Enables the specified USART interrupt.
Kojto 122:f9eeca106725 370 * @param __HANDLE__: specifies the USART Handle
Kojto 122:f9eeca106725 371 * @param __INTERRUPT__: specifies the USART interrupt source to enable.
Kojto 122:f9eeca106725 372 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 373 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
Kojto 122:f9eeca106725 374 * @arg USART_IT_TC: Transmission complete interrupt
Kojto 122:f9eeca106725 375 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
Kojto 122:f9eeca106725 376 * @arg USART_IT_IDLE: Idle line detection interrupt
Kojto 122:f9eeca106725 377 * @arg USART_IT_PE: Parity Error interrupt
Kojto 122:f9eeca106725 378 * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
Kojto 122:f9eeca106725 379 * @retval None
Kojto 122:f9eeca106725 380 */
Kojto 122:f9eeca106725 381 #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
Kojto 122:f9eeca106725 382 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
Kojto 122:f9eeca106725 383 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))))
Kojto 122:f9eeca106725 384
Kojto 122:f9eeca106725 385 /** @brief Disables the specified USART interrupt.
Kojto 122:f9eeca106725 386 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 387 * @param __INTERRUPT__: specifies the USART interrupt source to disable.
Kojto 122:f9eeca106725 388 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 389 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
Kojto 122:f9eeca106725 390 * @arg USART_IT_TC: Transmission complete interrupt
Kojto 122:f9eeca106725 391 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
Kojto 122:f9eeca106725 392 * @arg USART_IT_IDLE: Idle line detection interrupt
Kojto 122:f9eeca106725 393 * @arg USART_IT_PE: Parity Error interrupt
Kojto 122:f9eeca106725 394 * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
Kojto 122:f9eeca106725 395 * @retval None
Kojto 122:f9eeca106725 396 */
Kojto 122:f9eeca106725 397 #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
Kojto 122:f9eeca106725 398 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \
Kojto 122:f9eeca106725 399 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))))
Kojto 122:f9eeca106725 400
Kojto 122:f9eeca106725 401
Kojto 122:f9eeca106725 402 /** @brief Checks whether the specified USART interrupt has occurred or not.
Kojto 122:f9eeca106725 403 * @param __HANDLE__: specifies the USART Handle
Kojto 122:f9eeca106725 404 * @param __IT__: specifies the USART interrupt source to check.
Kojto 122:f9eeca106725 405 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 406 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
Kojto 122:f9eeca106725 407 * @arg USART_IT_TC: Transmission complete interrupt
Kojto 122:f9eeca106725 408 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
Kojto 122:f9eeca106725 409 * @arg USART_IT_IDLE: Idle line detection interrupt
Kojto 122:f9eeca106725 410 * @arg USART_IT_ORE: OverRun Error interrupt
Kojto 122:f9eeca106725 411 * @arg USART_IT_NE: Noise Error interrupt
Kojto 122:f9eeca106725 412 * @arg USART_IT_FE: Framing Error interrupt
Kojto 122:f9eeca106725 413 * @arg USART_IT_PE: Parity Error interrupt
Kojto 122:f9eeca106725 414 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 122:f9eeca106725 415 */
Kojto 122:f9eeca106725 416 #define __HAL_USART_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
Kojto 122:f9eeca106725 417
Kojto 122:f9eeca106725 418 /** @brief Checks whether the specified USART interrupt source is enabled.
Kojto 122:f9eeca106725 419 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 420 * @param __IT__: specifies the USART interrupt source to check.
Kojto 122:f9eeca106725 421 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 422 * @arg USART_IT_TXE: Transmit Data Register empty interrupt
Kojto 122:f9eeca106725 423 * @arg USART_IT_TC: Transmission complete interrupt
Kojto 122:f9eeca106725 424 * @arg USART_IT_RXNE: Receive Data register not empty interrupt
Kojto 122:f9eeca106725 425 * @arg USART_IT_IDLE: Idle line detection interrupt
Kojto 122:f9eeca106725 426 * @arg USART_IT_ORE: OverRun Error interrupt
Kojto 122:f9eeca106725 427 * @arg USART_IT_NE: Noise Error interrupt
Kojto 122:f9eeca106725 428 * @arg USART_IT_FE: Framing Error interrupt
Kojto 122:f9eeca106725 429 * @arg USART_IT_PE: Parity Error interrupt
Kojto 122:f9eeca106725 430 * @retval The new state of __IT__ (TRUE or FALSE).
Kojto 122:f9eeca106725 431 */
Kojto 122:f9eeca106725 432 #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \
Kojto 122:f9eeca106725 433 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \
Kojto 122:f9eeca106725 434 (((uint16_t)(__IT__)) & USART_IT_MASK)))
Kojto 122:f9eeca106725 435
Kojto 122:f9eeca106725 436
Kojto 122:f9eeca106725 437 /** @brief Clears the specified USART ISR flag, in setting the proper ICR register flag.
Kojto 122:f9eeca106725 438 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 439 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
Kojto 122:f9eeca106725 440 * to clear the corresponding interrupt
Kojto 122:f9eeca106725 441 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 442 * @arg USART_CLEAR_PEF: Parity Error Clear Flag
Kojto 122:f9eeca106725 443 * @arg USART_CLEAR_FEF: Framing Error Clear Flag
Kojto 122:f9eeca106725 444 * @arg USART_CLEAR_NEF: Noise detected Clear Flag
Kojto 122:f9eeca106725 445 * @arg USART_CLEAR_OREF: OverRun Error Clear Flag
Kojto 122:f9eeca106725 446 * @arg USART_CLEAR_IDLEF: IDLE line detected Clear Flag
Kojto 122:f9eeca106725 447 * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag
Kojto 122:f9eeca106725 448 * @arg USART_CLEAR_CTSF: CTS Interrupt Clear Flag
Kojto 122:f9eeca106725 449 * @retval None
Kojto 122:f9eeca106725 450 */
Kojto 122:f9eeca106725 451 #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
Kojto 122:f9eeca106725 452
Kojto 122:f9eeca106725 453 /** @brief Set a specific USART request flag.
Kojto 122:f9eeca106725 454 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 455 * @param __REQ__: specifies the request flag to set
Kojto 122:f9eeca106725 456 * This parameter can be one of the following values:
Kojto 122:f9eeca106725 457 * @arg USART_RXDATA_FLUSH_REQUEST: Receive Data flush Request
Kojto 122:f9eeca106725 458 * @arg USART_TXDATA_FLUSH_REQUEST: Transmit data flush Request
Kojto 122:f9eeca106725 459 *
Kojto 122:f9eeca106725 460 * @retval None
Kojto 122:f9eeca106725 461 */
Kojto 122:f9eeca106725 462 #define __HAL_USART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
Kojto 122:f9eeca106725 463
Kojto 122:f9eeca106725 464 /** @brief Enable USART
Kojto 122:f9eeca106725 465 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 466 * @retval None
Kojto 122:f9eeca106725 467 */
Kojto 122:f9eeca106725 468 #define __HAL_USART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
Kojto 122:f9eeca106725 469
Kojto 122:f9eeca106725 470 /** @brief Disable USART
Kojto 122:f9eeca106725 471 * @param __HANDLE__: specifies the USART Handle.
Kojto 122:f9eeca106725 472 * @retval None
Kojto 122:f9eeca106725 473 */
Kojto 122:f9eeca106725 474 #define __HAL_USART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
Kojto 122:f9eeca106725 475
Kojto 122:f9eeca106725 476 /**
Kojto 122:f9eeca106725 477 * @}
Kojto 122:f9eeca106725 478 */
Kojto 122:f9eeca106725 479 /* Include UART HAL Extension module */
Kojto 122:f9eeca106725 480 #include "stm32f7xx_hal_usart_ex.h"
Kojto 122:f9eeca106725 481
Kojto 122:f9eeca106725 482 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 483 /** @addtogroup USART_Exported_Functions
Kojto 122:f9eeca106725 484 * @{
Kojto 122:f9eeca106725 485 */
Kojto 122:f9eeca106725 486
Kojto 122:f9eeca106725 487 /** @addtogroup USART_Exported_Functions_Group1
Kojto 122:f9eeca106725 488 * @{
Kojto 122:f9eeca106725 489 */
Kojto 122:f9eeca106725 490 /* Initialization/de-initialization functions **********************************/
Kojto 122:f9eeca106725 491 HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 492 HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 493 void HAL_USART_MspInit(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 494 void HAL_USART_MspDeInit(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 495 HAL_StatusTypeDef HAL_USART_CheckIdleState(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 496 /**
Kojto 122:f9eeca106725 497 * @}
Kojto 122:f9eeca106725 498 */
Kojto 122:f9eeca106725 499
Kojto 122:f9eeca106725 500 /** @addtogroup USART_Exported_Functions_Group2
Kojto 122:f9eeca106725 501 * @{
Kojto 122:f9eeca106725 502 */
Kojto 122:f9eeca106725 503 /* IO operation functions *******************************************************/
Kojto 122:f9eeca106725 504 HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout);
Kojto 122:f9eeca106725 505 HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
Kojto 122:f9eeca106725 506 HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
Kojto 122:f9eeca106725 507 HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
Kojto 122:f9eeca106725 508 HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
Kojto 122:f9eeca106725 509 HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
Kojto 122:f9eeca106725 510 HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size);
Kojto 122:f9eeca106725 511 HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size);
Kojto 122:f9eeca106725 512 HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
Kojto 122:f9eeca106725 513 HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 514 HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 515 HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 516 void HAL_USART_IRQHandler(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 517 void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 518 void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 519 void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 520 void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 521 void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 522 void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 523
Kojto 122:f9eeca106725 524 /**
Kojto 122:f9eeca106725 525 * @}
Kojto 122:f9eeca106725 526 */
Kojto 122:f9eeca106725 527
Kojto 122:f9eeca106725 528 /** @addtogroup USART_Exported_Functions_Group3
Kojto 122:f9eeca106725 529 * @{
Kojto 122:f9eeca106725 530 */
Kojto 122:f9eeca106725 531 /* Peripheral State functions ************************************************/
Kojto 122:f9eeca106725 532 HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 533 uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart);
Kojto 122:f9eeca106725 534
Kojto 122:f9eeca106725 535 /**
Kojto 122:f9eeca106725 536 * @}
Kojto 122:f9eeca106725 537 */
Kojto 122:f9eeca106725 538
Kojto 122:f9eeca106725 539 /**
Kojto 122:f9eeca106725 540 * @}
Kojto 122:f9eeca106725 541 */
Kojto 122:f9eeca106725 542 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 543 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 544 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 545 /** @defgroup USART_Private_Constants USART Private Constants
Kojto 122:f9eeca106725 546 * @{
Kojto 122:f9eeca106725 547 */
Kojto 122:f9eeca106725 548 /** @brief USART interruptions flag mask
Kojto 122:f9eeca106725 549 *
Kojto 122:f9eeca106725 550 */
Kojto 122:f9eeca106725 551 #define USART_IT_MASK ((uint16_t)0x001FU)
Kojto 122:f9eeca106725 552
Kojto 122:f9eeca106725 553 /**
Kojto 122:f9eeca106725 554 * @}
Kojto 122:f9eeca106725 555 */
Kojto 122:f9eeca106725 556 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 557 /** @defgroup USART_Private_Macros USART Private Macros
Kojto 122:f9eeca106725 558 * @{
Kojto 122:f9eeca106725 559 */
Kojto 122:f9eeca106725 560 /** @brief Reports the USART clock source.
Kojto 122:f9eeca106725 561 * @param __HANDLE__: specifies the USART Handle
Kojto 122:f9eeca106725 562 * @param __CLOCKSOURCE__ : output variable
Kojto 122:f9eeca106725 563 * @retval the USART clocking source, written in __CLOCKSOURCE__.
Kojto 122:f9eeca106725 564 */
Kojto 122:f9eeca106725 565 #define USART_GETCLOCKSOURCE(__HANDLE__, __CLOCKSOURCE__)\
Kojto 122:f9eeca106725 566 do { \
Kojto 122:f9eeca106725 567 if((__HANDLE__)->Instance == USART1) \
Kojto 122:f9eeca106725 568 { \
Kojto 122:f9eeca106725 569 switch(__HAL_RCC_GET_USART1_SOURCE()) \
Kojto 122:f9eeca106725 570 { \
Kojto 122:f9eeca106725 571 case RCC_USART1CLKSOURCE_PCLK2: \
Kojto 122:f9eeca106725 572 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK2; \
Kojto 122:f9eeca106725 573 break; \
Kojto 122:f9eeca106725 574 case RCC_USART1CLKSOURCE_HSI: \
Kojto 122:f9eeca106725 575 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 122:f9eeca106725 576 break; \
Kojto 122:f9eeca106725 577 case RCC_USART1CLKSOURCE_SYSCLK: \
Kojto 122:f9eeca106725 578 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 122:f9eeca106725 579 break; \
Kojto 122:f9eeca106725 580 case RCC_USART1CLKSOURCE_LSE: \
Kojto 122:f9eeca106725 581 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 122:f9eeca106725 582 break; \
Kojto 122:f9eeca106725 583 default: \
Kojto 122:f9eeca106725 584 break; \
Kojto 122:f9eeca106725 585 } \
Kojto 122:f9eeca106725 586 } \
Kojto 122:f9eeca106725 587 else if((__HANDLE__)->Instance == USART2) \
Kojto 122:f9eeca106725 588 { \
Kojto 122:f9eeca106725 589 switch(__HAL_RCC_GET_USART2_SOURCE()) \
Kojto 122:f9eeca106725 590 { \
Kojto 122:f9eeca106725 591 case RCC_USART2CLKSOURCE_PCLK1: \
Kojto 122:f9eeca106725 592 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 122:f9eeca106725 593 break; \
Kojto 122:f9eeca106725 594 case RCC_USART2CLKSOURCE_HSI: \
Kojto 122:f9eeca106725 595 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 122:f9eeca106725 596 break; \
Kojto 122:f9eeca106725 597 case RCC_USART2CLKSOURCE_SYSCLK: \
Kojto 122:f9eeca106725 598 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 122:f9eeca106725 599 break; \
Kojto 122:f9eeca106725 600 case RCC_USART2CLKSOURCE_LSE: \
Kojto 122:f9eeca106725 601 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 122:f9eeca106725 602 break; \
Kojto 122:f9eeca106725 603 default: \
Kojto 122:f9eeca106725 604 break; \
Kojto 122:f9eeca106725 605 } \
Kojto 122:f9eeca106725 606 } \
Kojto 122:f9eeca106725 607 else if((__HANDLE__)->Instance == USART3) \
Kojto 122:f9eeca106725 608 { \
Kojto 122:f9eeca106725 609 switch(__HAL_RCC_GET_USART3_SOURCE()) \
Kojto 122:f9eeca106725 610 { \
Kojto 122:f9eeca106725 611 case RCC_USART3CLKSOURCE_PCLK1: \
Kojto 122:f9eeca106725 612 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK1; \
Kojto 122:f9eeca106725 613 break; \
Kojto 122:f9eeca106725 614 case RCC_USART3CLKSOURCE_HSI: \
Kojto 122:f9eeca106725 615 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 122:f9eeca106725 616 break; \
Kojto 122:f9eeca106725 617 case RCC_USART3CLKSOURCE_SYSCLK: \
Kojto 122:f9eeca106725 618 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 122:f9eeca106725 619 break; \
Kojto 122:f9eeca106725 620 case RCC_USART3CLKSOURCE_LSE: \
Kojto 122:f9eeca106725 621 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 122:f9eeca106725 622 break; \
Kojto 122:f9eeca106725 623 default: \
Kojto 122:f9eeca106725 624 break; \
Kojto 122:f9eeca106725 625 } \
Kojto 122:f9eeca106725 626 } \
Kojto 122:f9eeca106725 627 else if((__HANDLE__)->Instance == USART6) \
Kojto 122:f9eeca106725 628 { \
Kojto 122:f9eeca106725 629 switch(__HAL_RCC_GET_USART6_SOURCE()) \
Kojto 122:f9eeca106725 630 { \
Kojto 122:f9eeca106725 631 case RCC_USART6CLKSOURCE_PCLK2: \
Kojto 122:f9eeca106725 632 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_PCLK2; \
Kojto 122:f9eeca106725 633 break; \
Kojto 122:f9eeca106725 634 case RCC_USART6CLKSOURCE_HSI: \
Kojto 122:f9eeca106725 635 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_HSI; \
Kojto 122:f9eeca106725 636 break; \
Kojto 122:f9eeca106725 637 case RCC_USART6CLKSOURCE_SYSCLK: \
Kojto 122:f9eeca106725 638 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_SYSCLK; \
Kojto 122:f9eeca106725 639 break; \
Kojto 122:f9eeca106725 640 case RCC_USART6CLKSOURCE_LSE: \
Kojto 122:f9eeca106725 641 (__CLOCKSOURCE__) = USART_CLOCKSOURCE_LSE; \
Kojto 122:f9eeca106725 642 break; \
Kojto 122:f9eeca106725 643 default: \
Kojto 122:f9eeca106725 644 break; \
Kojto 122:f9eeca106725 645 } \
Kojto 122:f9eeca106725 646 } \
Kojto 122:f9eeca106725 647 } while(0)
Kojto 122:f9eeca106725 648
Kojto 122:f9eeca106725 649
Kojto 122:f9eeca106725 650 #define IS_USART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == USART_STOPBITS_1) || \
Kojto 122:f9eeca106725 651 ((__STOPBITS__) == USART_STOPBITS_1_5) || \
Kojto 122:f9eeca106725 652 ((__STOPBITS__) == USART_STOPBITS_2))
Kojto 122:f9eeca106725 653 #define IS_USART_PARITY(__PARITY__) (((__PARITY__) == USART_PARITY_NONE) || \
Kojto 122:f9eeca106725 654 ((__PARITY__) == USART_PARITY_EVEN) || \
Kojto 122:f9eeca106725 655 ((__PARITY__) == USART_PARITY_ODD))
Kojto 122:f9eeca106725 656 #define IS_USART_MODE(__MODE__) ((((__MODE__) & (uint32_t)0xFFFFFFF3U) == 0x00U) && ((__MODE__) != (uint32_t)0x00U))
Kojto 122:f9eeca106725 657 #define IS_USART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == USART_OVERSAMPLING_16) || \
Kojto 122:f9eeca106725 658 ((__SAMPLING__) == USART_OVERSAMPLING_8))
Kojto 122:f9eeca106725 659 #define IS_USART_CLOCK(__CLOCK__) (((__CLOCK__)== USART_CLOCK_DISABLE) || \
Kojto 122:f9eeca106725 660 ((__CLOCK__)== USART_CLOCK_ENABLE))
Kojto 122:f9eeca106725 661 #define IS_USART_POLARITY(__CPOL__) (((__CPOL__) == USART_POLARITY_LOW) || ((__CPOL__) == USART_POLARITY_HIGH))
Kojto 122:f9eeca106725 662 #define IS_USART_PHASE(__CPHA__) (((__CPHA__) == USART_PHASE_1EDGE) || ((__CPHA__) == USART_PHASE_2EDGE))
Kojto 122:f9eeca106725 663 #define IS_USART_LASTBIT(__LASTBIT__) (((__LASTBIT__) == USART_LASTBIT_DISABLE) || \
Kojto 122:f9eeca106725 664 ((__LASTBIT__) == USART_LASTBIT_ENABLE))
Kojto 122:f9eeca106725 665 #define IS_USART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == USART_RXDATA_FLUSH_REQUEST) || \
Kojto 122:f9eeca106725 666 ((__PARAM__) == USART_TXDATA_FLUSH_REQUEST))
Kojto 122:f9eeca106725 667 #define IS_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 9000001)
Kojto 122:f9eeca106725 668
Kojto 122:f9eeca106725 669 /**
Kojto 122:f9eeca106725 670 * @}
Kojto 122:f9eeca106725 671 */
Kojto 122:f9eeca106725 672
Kojto 122:f9eeca106725 673 /* Private functions ---------------------------------------------------------*/
Kojto 122:f9eeca106725 674 /** @defgroup USART_Private_Functions USART Private Functions
Kojto 122:f9eeca106725 675 * @{
Kojto 122:f9eeca106725 676 */
Kojto 122:f9eeca106725 677
Kojto 122:f9eeca106725 678 /**
Kojto 122:f9eeca106725 679 * @}
Kojto 122:f9eeca106725 680 */
Kojto 122:f9eeca106725 681
Kojto 122:f9eeca106725 682 /**
Kojto 122:f9eeca106725 683 * @}
Kojto 122:f9eeca106725 684 */
Kojto 122:f9eeca106725 685
Kojto 122:f9eeca106725 686 /**
Kojto 122:f9eeca106725 687 * @}
Kojto 122:f9eeca106725 688 */
Kojto 122:f9eeca106725 689
Kojto 122:f9eeca106725 690 #ifdef __cplusplus
Kojto 122:f9eeca106725 691 }
Kojto 122:f9eeca106725 692 #endif
Kojto 122:f9eeca106725 693
Kojto 122:f9eeca106725 694 #endif /* __STM32F7xx_HAL_USART_H */
Kojto 122:f9eeca106725 695
Kojto 122:f9eeca106725 696 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/