2 ******************************************************************************
\r
3 * @file stm32l4xx_hal_uart.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of UART HAL module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef STM32L4xx_HAL_UART_H
\r
22 #define STM32L4xx_HAL_UART_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32l4xx_hal_def.h"
\r
31 /** @addtogroup STM32L4xx_HAL_Driver
\r
35 /** @addtogroup UART
\r
39 /* Exported types ------------------------------------------------------------*/
\r
40 /** @defgroup UART_Exported_Types UART Exported Types
\r
45 * @brief UART Init Structure definition
\r
49 uint32_t BaudRate; /*!< This member configures the UART communication baud rate.
\r
50 The baud rate register is computed using the following formula:
\r
53 Baud Rate Register = ((256 * lpuart_ker_ckpres) / ((huart->Init.BaudRate)))
\r
54 where lpuart_ker_ck_pres is the UART input clock (divided by a prescaler if applicable)
\r
57 - If oversampling is 16 or in LIN mode,
\r
58 Baud Rate Register = ((uart_ker_ckpres) / ((huart->Init.BaudRate)))
\r
59 - If oversampling is 8,
\r
60 Baud Rate Register[15:4] = ((2 * uart_ker_ckpres) / ((huart->Init.BaudRate)))[15:4]
\r
61 Baud Rate Register[3] = 0
\r
62 Baud Rate Register[2:0] = (((2 * uart_ker_ckpres) / ((huart->Init.BaudRate)))[3:0]) >> 1
\r
63 where uart_ker_ck_pres is the UART input clock (divided by a prescaler if applicable) */
\r
65 uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
\r
66 This parameter can be a value of @ref UARTEx_Word_Length. */
\r
68 uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
\r
69 This parameter can be a value of @ref UART_Stop_Bits. */
\r
71 uint32_t Parity; /*!< Specifies the parity mode.
\r
72 This parameter can be a value of @ref UART_Parity
\r
73 @note When parity is enabled, the computed parity is inserted
\r
74 at the MSB position of the transmitted data (9th bit when
\r
75 the word length is set to 9 data bits; 8th bit when the
\r
76 word length is set to 8 data bits). */
\r
78 uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
\r
79 This parameter can be a value of @ref UART_Mode. */
\r
81 uint32_t HwFlowCtl; /*!< Specifies whether the hardware flow control mode is enabled
\r
83 This parameter can be a value of @ref UART_Hardware_Flow_Control. */
\r
85 uint32_t OverSampling; /*!< Specifies whether the Over sampling 8 is enabled or disabled, to achieve higher speed (up to f_PCLK/8).
\r
86 This parameter can be a value of @ref UART_Over_Sampling. */
\r
88 uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
\r
89 Selecting the single sample method increases the receiver tolerance to clock
\r
90 deviations. This parameter can be a value of @ref UART_OneBit_Sampling. */
\r
92 #if defined(USART_PRESC_PRESCALER)
\r
93 uint32_t ClockPrescaler; /*!< Specifies the prescaler value used to divide the UART clock source.
\r
94 This parameter can be a value of @ref UART_ClockPrescaler. */
\r
95 #endif /* USART_PRESC_PRESCALER */
\r
100 * @brief UART Advanced Features initialization structure definition
\r
104 uint32_t AdvFeatureInit; /*!< Specifies which advanced UART features is initialized. Several
\r
105 Advanced Features may be initialized at the same time .
\r
106 This parameter can be a value of @ref UART_Advanced_Features_Initialization_Type. */
\r
108 uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
\r
109 This parameter can be a value of @ref UART_Tx_Inv. */
\r
111 uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
\r
112 This parameter can be a value of @ref UART_Rx_Inv. */
\r
114 uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
\r
115 vs negative/inverted logic).
\r
116 This parameter can be a value of @ref UART_Data_Inv. */
\r
118 uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
\r
119 This parameter can be a value of @ref UART_Rx_Tx_Swap. */
\r
121 uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
\r
122 This parameter can be a value of @ref UART_Overrun_Disable. */
\r
124 uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
\r
125 This parameter can be a value of @ref UART_DMA_Disable_on_Rx_Error. */
\r
127 uint32_t AutoBaudRateEnable; /*!< Specifies whether auto Baud rate detection is enabled.
\r
128 This parameter can be a value of @ref UART_AutoBaudRate_Enable. */
\r
130 uint32_t AutoBaudRateMode; /*!< If auto Baud rate detection is enabled, specifies how the rate
\r
131 detection is carried out.
\r
132 This parameter can be a value of @ref UART_AutoBaud_Rate_Mode. */
\r
134 uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
\r
135 This parameter can be a value of @ref UART_MSB_First. */
\r
136 } UART_AdvFeatureInitTypeDef;
\r
141 * @brief HAL UART State definition
\r
142 * @note HAL UART State value is a combination of 2 different substates: gState and RxState (see @ref UART_State_Definition).
\r
143 * - gState contains UART state information related to global Handle management
\r
144 * and also information related to Tx operations.
\r
145 * gState value coding follow below described bitmap :
\r
146 * b7-b6 Error information
\r
151 * b5 Peripheral initialization status
\r
152 * 0 : Reset (Peripheral not initialized)
\r
153 * 1 : Init done (Peripheral not initialized. HAL UART Init function already called)
\r
155 * xx : Should be set to 00
\r
156 * b2 Intrinsic process state
\r
158 * 1 : Busy (Peripheral busy with some configuration or internal operations)
\r
160 * x : Should be set to 0
\r
162 * 0 : Ready (no Tx operation ongoing)
\r
163 * 1 : Busy (Tx operation ongoing)
\r
164 * - RxState contains information related to Rx operations.
\r
165 * RxState value coding follow below described bitmap :
\r
167 * xx : Should be set to 00
\r
168 * b5 Peripheral initialization status
\r
169 * 0 : Reset (Peripheral not initialized)
\r
170 * 1 : Init done (Peripheral not initialized)
\r
172 * xxx : Should be set to 000
\r
174 * 0 : Ready (no Rx operation ongoing)
\r
175 * 1 : Busy (Rx operation ongoing)
\r
177 * x : Should be set to 0.
\r
179 typedef uint32_t HAL_UART_StateTypeDef;
\r
182 * @brief UART clock sources definition
\r
186 UART_CLOCKSOURCE_PCLK1 = 0x00U, /*!< PCLK1 clock source */
\r
187 UART_CLOCKSOURCE_PCLK2 = 0x01U, /*!< PCLK2 clock source */
\r
188 UART_CLOCKSOURCE_HSI = 0x02U, /*!< HSI clock source */
\r
189 UART_CLOCKSOURCE_SYSCLK = 0x04U, /*!< SYSCLK clock source */
\r
190 UART_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */
\r
191 UART_CLOCKSOURCE_UNDEFINED = 0x10U /*!< Undefined clock source */
\r
192 } UART_ClockSourceTypeDef;
\r
195 * @brief UART handle Structure definition
\r
197 typedef struct __UART_HandleTypeDef
\r
199 USART_TypeDef *Instance; /*!< UART registers base address */
\r
201 UART_InitTypeDef Init; /*!< UART communication parameters */
\r
203 UART_AdvFeatureInitTypeDef AdvancedInit; /*!< UART Advanced Features initialization parameters */
\r
205 uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
\r
207 uint16_t TxXferSize; /*!< UART Tx Transfer size */
\r
209 __IO uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
\r
211 uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
\r
213 uint16_t RxXferSize; /*!< UART Rx Transfer size */
\r
215 __IO uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
\r
217 uint16_t Mask; /*!< UART Rx RDR register mask */
\r
219 #if defined(USART_CR1_FIFOEN)
\r
220 uint32_t FifoMode; /*!< Specifies if the FIFO mode is being used.
\r
221 This parameter can be a value of @ref UARTEx_FIFO_mode. */
\r
223 uint16_t NbRxDataToProcess; /*!< Number of data to process during RX ISR execution */
\r
225 uint16_t NbTxDataToProcess; /*!< Number of data to process during TX ISR execution */
\r
226 #endif /*USART_CR1_FIFOEN */
\r
228 void (*RxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Rx IRQ handler */
\r
230 void (*TxISR)(struct __UART_HandleTypeDef *huart); /*!< Function pointer on Tx IRQ handler */
\r
232 DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
\r
234 DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
\r
236 HAL_LockTypeDef Lock; /*!< Locking object */
\r
238 __IO HAL_UART_StateTypeDef gState; /*!< UART state information related to global Handle management
\r
239 and also related to Tx operations.
\r
240 This parameter can be a value of @ref HAL_UART_StateTypeDef */
\r
242 __IO HAL_UART_StateTypeDef RxState; /*!< UART state information related to Rx operations.
\r
243 This parameter can be a value of @ref HAL_UART_StateTypeDef */
\r
245 __IO uint32_t ErrorCode; /*!< UART Error code */
\r
247 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
248 void (* TxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Half Complete Callback */
\r
249 void (* TxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Complete Callback */
\r
250 void (* RxHalfCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Half Complete Callback */
\r
251 void (* RxCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Complete Callback */
\r
252 void (* ErrorCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Error Callback */
\r
253 void (* AbortCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Complete Callback */
\r
254 void (* AbortTransmitCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Transmit Complete Callback */
\r
255 void (* AbortReceiveCpltCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Abort Receive Complete Callback */
\r
256 void (* WakeupCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Wakeup Callback */
\r
257 #if defined(USART_CR1_FIFOEN)
\r
258 void (* RxFifoFullCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Rx Fifo Full Callback */
\r
259 void (* TxFifoEmptyCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Tx Fifo Empty Callback */
\r
260 #endif /* USART_CR1_FIFOEN */
\r
262 void (* MspInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp Init callback */
\r
263 void (* MspDeInitCallback)(struct __UART_HandleTypeDef *huart); /*!< UART Msp DeInit callback */
\r
264 #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
\r
266 } UART_HandleTypeDef;
\r
268 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
270 * @brief HAL UART Callback ID enumeration definition
\r
274 HAL_UART_TX_HALFCOMPLETE_CB_ID = 0x00U, /*!< UART Tx Half Complete Callback ID */
\r
275 HAL_UART_TX_COMPLETE_CB_ID = 0x01U, /*!< UART Tx Complete Callback ID */
\r
276 HAL_UART_RX_HALFCOMPLETE_CB_ID = 0x02U, /*!< UART Rx Half Complete Callback ID */
\r
277 HAL_UART_RX_COMPLETE_CB_ID = 0x03U, /*!< UART Rx Complete Callback ID */
\r
278 HAL_UART_ERROR_CB_ID = 0x04U, /*!< UART Error Callback ID */
\r
279 HAL_UART_ABORT_COMPLETE_CB_ID = 0x05U, /*!< UART Abort Complete Callback ID */
\r
280 HAL_UART_ABORT_TRANSMIT_COMPLETE_CB_ID = 0x06U, /*!< UART Abort Transmit Complete Callback ID */
\r
281 HAL_UART_ABORT_RECEIVE_COMPLETE_CB_ID = 0x07U, /*!< UART Abort Receive Complete Callback ID */
\r
282 HAL_UART_WAKEUP_CB_ID = 0x08U, /*!< UART Wakeup Callback ID */
\r
283 #if defined(USART_CR1_FIFOEN)
\r
284 HAL_UART_RX_FIFO_FULL_CB_ID = 0x09U, /*!< UART Rx Fifo Full Callback ID */
\r
285 HAL_UART_TX_FIFO_EMPTY_CB_ID = 0x0AU, /*!< UART Tx Fifo Empty Callback ID */
\r
286 #endif /* USART_CR1_FIFOEN */
\r
288 HAL_UART_MSPINIT_CB_ID = 0x0BU, /*!< UART MspInit callback ID */
\r
289 HAL_UART_MSPDEINIT_CB_ID = 0x0CU /*!< UART MspDeInit callback ID */
\r
291 } HAL_UART_CallbackIDTypeDef;
\r
294 * @brief HAL UART Callback pointer definition
\r
296 typedef void (*pUART_CallbackTypeDef)(UART_HandleTypeDef *huart); /*!< pointer to an UART callback function */
\r
298 #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
\r
304 /* Exported constants --------------------------------------------------------*/
\r
305 /** @defgroup UART_Exported_Constants UART Exported Constants
\r
309 /** @defgroup UART_State_Definition UART State Code Definition
\r
312 #define HAL_UART_STATE_RESET 0x00000000U /*!< Peripheral is not initialized
\r
313 Value is allowed for gState and RxState */
\r
314 #define HAL_UART_STATE_READY 0x00000020U /*!< Peripheral Initialized and ready for use
\r
315 Value is allowed for gState and RxState */
\r
316 #define HAL_UART_STATE_BUSY 0x00000024U /*!< an internal process is ongoing
\r
317 Value is allowed for gState only */
\r
318 #define HAL_UART_STATE_BUSY_TX 0x00000021U /*!< Data Transmission process is ongoing
\r
319 Value is allowed for gState only */
\r
320 #define HAL_UART_STATE_BUSY_RX 0x00000022U /*!< Data Reception process is ongoing
\r
321 Value is allowed for RxState only */
\r
322 #define HAL_UART_STATE_BUSY_TX_RX 0x00000023U /*!< Data Transmission and Reception process is ongoing
\r
323 Not to be used for neither gState nor RxState.
\r
324 Value is result of combination (Or) between gState and RxState values */
\r
325 #define HAL_UART_STATE_TIMEOUT 0x000000A0U /*!< Timeout state
\r
326 Value is allowed for gState only */
\r
327 #define HAL_UART_STATE_ERROR 0x000000E0U /*!< Error
\r
328 Value is allowed for gState only */
\r
333 /** @defgroup UART_Error_Definition UART Error Definition
\r
336 #define HAL_UART_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
\r
337 #define HAL_UART_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */
\r
338 #define HAL_UART_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */
\r
339 #define HAL_UART_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */
\r
340 #define HAL_UART_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */
\r
341 #define HAL_UART_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */
\r
342 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
343 #define HAL_UART_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U) /*!< Invalid Callback error */
\r
344 #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
\r
349 /** @defgroup UART_Stop_Bits UART Number of Stop Bits
\r
352 #define UART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< UART frame with 0.5 stop bit */
\r
353 #define UART_STOPBITS_1 0x00000000U /*!< UART frame with 1 stop bit */
\r
354 #define UART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< UART frame with 1.5 stop bits */
\r
355 #define UART_STOPBITS_2 USART_CR2_STOP_1 /*!< UART frame with 2 stop bits */
\r
360 /** @defgroup UART_Parity UART Parity
\r
363 #define UART_PARITY_NONE 0x00000000U /*!< No parity */
\r
364 #define UART_PARITY_EVEN USART_CR1_PCE /*!< Even parity */
\r
365 #define UART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Odd parity */
\r
370 /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
\r
373 #define UART_HWCONTROL_NONE 0x00000000U /*!< No hardware control */
\r
374 #define UART_HWCONTROL_RTS USART_CR3_RTSE /*!< Request To Send */
\r
375 #define UART_HWCONTROL_CTS USART_CR3_CTSE /*!< Clear To Send */
\r
376 #define UART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< Request and Clear To Send */
\r
381 /** @defgroup UART_Mode UART Transfer Mode
\r
384 #define UART_MODE_RX USART_CR1_RE /*!< RX mode */
\r
385 #define UART_MODE_TX USART_CR1_TE /*!< TX mode */
\r
386 #define UART_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< RX and TX mode */
\r
391 /** @defgroup UART_State UART State
\r
394 #define UART_STATE_DISABLE 0x00000000U /*!< UART disabled */
\r
395 #define UART_STATE_ENABLE USART_CR1_UE /*!< UART enabled */
\r
400 /** @defgroup UART_Over_Sampling UART Over Sampling
\r
403 #define UART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */
\r
404 #define UART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */
\r
409 /** @defgroup UART_OneBit_Sampling UART One Bit Sampling Method
\r
412 #define UART_ONE_BIT_SAMPLE_DISABLE 0x00000000U /*!< One-bit sampling disable */
\r
413 #define UART_ONE_BIT_SAMPLE_ENABLE USART_CR3_ONEBIT /*!< One-bit sampling enable */
\r
418 #if defined(USART_PRESC_PRESCALER)
\r
419 /** @defgroup UART_ClockPrescaler UART Clock Prescaler
\r
422 #define UART_PRESCALER_DIV1 0x00000000U /*!< fclk_pres = fclk */
\r
423 #define UART_PRESCALER_DIV2 0x00000001U /*!< fclk_pres = fclk/2 */
\r
424 #define UART_PRESCALER_DIV4 0x00000002U /*!< fclk_pres = fclk/4 */
\r
425 #define UART_PRESCALER_DIV6 0x00000003U /*!< fclk_pres = fclk/6 */
\r
426 #define UART_PRESCALER_DIV8 0x00000004U /*!< fclk_pres = fclk/8 */
\r
427 #define UART_PRESCALER_DIV10 0x00000005U /*!< fclk_pres = fclk/10 */
\r
428 #define UART_PRESCALER_DIV12 0x00000006U /*!< fclk_pres = fclk/12 */
\r
429 #define UART_PRESCALER_DIV16 0x00000007U /*!< fclk_pres = fclk/16 */
\r
430 #define UART_PRESCALER_DIV32 0x00000008U /*!< fclk_pres = fclk/32 */
\r
431 #define UART_PRESCALER_DIV64 0x00000009U /*!< fclk_pres = fclk/64 */
\r
432 #define UART_PRESCALER_DIV128 0x0000000AU /*!< fclk_pres = fclk/128 */
\r
433 #define UART_PRESCALER_DIV256 0x0000000BU /*!< fclk_pres = fclk/256 */
\r
438 #endif /* USART_PRESC_PRESCALER */
\r
439 /** @defgroup UART_AutoBaud_Rate_Mode UART Advanced Feature AutoBaud Rate Mode
\r
442 #define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT 0x00000000U /*!< Auto Baud rate detection on start bit */
\r
443 #define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE USART_CR2_ABRMODE_0 /*!< Auto Baud rate detection on falling edge */
\r
444 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME USART_CR2_ABRMODE_1 /*!< Auto Baud rate detection on 0x7F frame detection */
\r
445 #define UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME USART_CR2_ABRMODE /*!< Auto Baud rate detection on 0x55 frame detection */
\r
450 /** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut
\r
453 #define UART_RECEIVER_TIMEOUT_DISABLE 0x00000000U /*!< UART receiver timeout disable */
\r
454 #define UART_RECEIVER_TIMEOUT_ENABLE USART_CR2_RTOEN /*!< UART receiver timeout enable */
\r
459 /** @defgroup UART_LIN UART Local Interconnection Network mode
\r
462 #define UART_LIN_DISABLE 0x00000000U /*!< Local Interconnect Network disable */
\r
463 #define UART_LIN_ENABLE USART_CR2_LINEN /*!< Local Interconnect Network enable */
\r
468 /** @defgroup UART_LIN_Break_Detection UART LIN Break Detection
\r
471 #define UART_LINBREAKDETECTLENGTH_10B 0x00000000U /*!< LIN 10-bit break detection length */
\r
472 #define UART_LINBREAKDETECTLENGTH_11B USART_CR2_LBDL /*!< LIN 11-bit break detection length */
\r
477 /** @defgroup UART_DMA_Tx UART DMA Tx
\r
480 #define UART_DMA_TX_DISABLE 0x00000000U /*!< UART DMA TX disabled */
\r
481 #define UART_DMA_TX_ENABLE USART_CR3_DMAT /*!< UART DMA TX enabled */
\r
486 /** @defgroup UART_DMA_Rx UART DMA Rx
\r
489 #define UART_DMA_RX_DISABLE 0x00000000U /*!< UART DMA RX disabled */
\r
490 #define UART_DMA_RX_ENABLE USART_CR3_DMAR /*!< UART DMA RX enabled */
\r
495 /** @defgroup UART_Half_Duplex_Selection UART Half Duplex Selection
\r
498 #define UART_HALF_DUPLEX_DISABLE 0x00000000U /*!< UART half-duplex disabled */
\r
499 #define UART_HALF_DUPLEX_ENABLE USART_CR3_HDSEL /*!< UART half-duplex enabled */
\r
504 /** @defgroup UART_WakeUp_Methods UART WakeUp Methods
\r
507 #define UART_WAKEUPMETHOD_IDLELINE 0x00000000U /*!< UART wake-up on idle line */
\r
508 #define UART_WAKEUPMETHOD_ADDRESSMARK USART_CR1_WAKE /*!< UART wake-up on address mark */
\r
513 /** @defgroup UART_Request_Parameters UART Request Parameters
\r
516 #define UART_AUTOBAUD_REQUEST USART_RQR_ABRRQ /*!< Auto-Baud Rate Request */
\r
517 #define UART_SENDBREAK_REQUEST USART_RQR_SBKRQ /*!< Send Break Request */
\r
518 #define UART_MUTE_MODE_REQUEST USART_RQR_MMRQ /*!< Mute Mode Request */
\r
519 #define UART_RXDATA_FLUSH_REQUEST USART_RQR_RXFRQ /*!< Receive Data flush Request */
\r
520 #define UART_TXDATA_FLUSH_REQUEST USART_RQR_TXFRQ /*!< Transmit data flush Request */
\r
525 /** @defgroup UART_Advanced_Features_Initialization_Type UART Advanced Feature Initialization Type
\r
528 #define UART_ADVFEATURE_NO_INIT 0x00000000U /*!< No advanced feature initialization */
\r
529 #define UART_ADVFEATURE_TXINVERT_INIT 0x00000001U /*!< TX pin active level inversion */
\r
530 #define UART_ADVFEATURE_RXINVERT_INIT 0x00000002U /*!< RX pin active level inversion */
\r
531 #define UART_ADVFEATURE_DATAINVERT_INIT 0x00000004U /*!< Binary data inversion */
\r
532 #define UART_ADVFEATURE_SWAP_INIT 0x00000008U /*!< TX/RX pins swap */
\r
533 #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT 0x00000010U /*!< RX overrun disable */
\r
534 #define UART_ADVFEATURE_DMADISABLEONERROR_INIT 0x00000020U /*!< DMA disable on Reception Error */
\r
535 #define UART_ADVFEATURE_AUTOBAUDRATE_INIT 0x00000040U /*!< Auto Baud rate detection initialization */
\r
536 #define UART_ADVFEATURE_MSBFIRST_INIT 0x00000080U /*!< Most significant bit sent/received first */
\r
541 /** @defgroup UART_Tx_Inv UART Advanced Feature TX Pin Active Level Inversion
\r
544 #define UART_ADVFEATURE_TXINV_DISABLE 0x00000000U /*!< TX pin active level inversion disable */
\r
545 #define UART_ADVFEATURE_TXINV_ENABLE USART_CR2_TXINV /*!< TX pin active level inversion enable */
\r
550 /** @defgroup UART_Rx_Inv UART Advanced Feature RX Pin Active Level Inversion
\r
553 #define UART_ADVFEATURE_RXINV_DISABLE 0x00000000U /*!< RX pin active level inversion disable */
\r
554 #define UART_ADVFEATURE_RXINV_ENABLE USART_CR2_RXINV /*!< RX pin active level inversion enable */
\r
559 /** @defgroup UART_Data_Inv UART Advanced Feature Binary Data Inversion
\r
562 #define UART_ADVFEATURE_DATAINV_DISABLE 0x00000000U /*!< Binary data inversion disable */
\r
563 #define UART_ADVFEATURE_DATAINV_ENABLE USART_CR2_DATAINV /*!< Binary data inversion enable */
\r
568 /** @defgroup UART_Rx_Tx_Swap UART Advanced Feature RX TX Pins Swap
\r
571 #define UART_ADVFEATURE_SWAP_DISABLE 0x00000000U /*!< TX/RX pins swap disable */
\r
572 #define UART_ADVFEATURE_SWAP_ENABLE USART_CR2_SWAP /*!< TX/RX pins swap enable */
\r
577 /** @defgroup UART_Overrun_Disable UART Advanced Feature Overrun Disable
\r
580 #define UART_ADVFEATURE_OVERRUN_ENABLE 0x00000000U /*!< RX overrun enable */
\r
581 #define UART_ADVFEATURE_OVERRUN_DISABLE USART_CR3_OVRDIS /*!< RX overrun disable */
\r
586 /** @defgroup UART_AutoBaudRate_Enable UART Advanced Feature Auto BaudRate Enable
\r
589 #define UART_ADVFEATURE_AUTOBAUDRATE_DISABLE 0x00000000U /*!< RX Auto Baud rate detection enable */
\r
590 #define UART_ADVFEATURE_AUTOBAUDRATE_ENABLE USART_CR2_ABREN /*!< RX Auto Baud rate detection disable */
\r
595 /** @defgroup UART_DMA_Disable_on_Rx_Error UART Advanced Feature DMA Disable On Rx Error
\r
598 #define UART_ADVFEATURE_DMA_ENABLEONRXERROR 0x00000000U /*!< DMA enable on Reception Error */
\r
599 #define UART_ADVFEATURE_DMA_DISABLEONRXERROR USART_CR3_DDRE /*!< DMA disable on Reception Error */
\r
604 /** @defgroup UART_MSB_First UART Advanced Feature MSB First
\r
607 #define UART_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U /*!< Most significant bit sent/received first disable */
\r
608 #define UART_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST /*!< Most significant bit sent/received first enable */
\r
613 /** @defgroup UART_Stop_Mode_Enable UART Advanced Feature Stop Mode Enable
\r
616 #define UART_ADVFEATURE_STOPMODE_DISABLE 0x00000000U /*!< UART stop mode disable */
\r
617 #define UART_ADVFEATURE_STOPMODE_ENABLE USART_CR1_UESM /*!< UART stop mode enable */
\r
622 /** @defgroup UART_Mute_Mode UART Advanced Feature Mute Mode Enable
\r
625 #define UART_ADVFEATURE_MUTEMODE_DISABLE 0x00000000U /*!< UART mute mode disable */
\r
626 #define UART_ADVFEATURE_MUTEMODE_ENABLE USART_CR1_MME /*!< UART mute mode enable */
\r
631 /** @defgroup UART_CR2_ADDRESS_LSB_POS UART Address-matching LSB Position In CR2 Register
\r
634 #define UART_CR2_ADDRESS_LSB_POS 24U /*!< UART address-matching LSB position in CR2 register */
\r
639 /** @defgroup UART_WakeUp_from_Stop_Selection UART WakeUp From Stop Selection
\r
642 #define UART_WAKEUP_ON_ADDRESS 0x00000000U /*!< UART wake-up on address */
\r
643 #define UART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< UART wake-up on start bit */
\r
644 #define UART_WAKEUP_ON_READDATA_NONEMPTY USART_CR3_WUS /*!< UART wake-up on receive data register not empty or RXFIFO is not empty */
\r
649 /** @defgroup UART_DriverEnable_Polarity UART DriverEnable Polarity
\r
652 #define UART_DE_POLARITY_HIGH 0x00000000U /*!< Driver enable signal is active high */
\r
653 #define UART_DE_POLARITY_LOW USART_CR3_DEP /*!< Driver enable signal is active low */
\r
658 /** @defgroup UART_CR1_DEAT_ADDRESS_LSB_POS UART Driver Enable Assertion Time LSB Position In CR1 Register
\r
661 #define UART_CR1_DEAT_ADDRESS_LSB_POS 21U /*!< UART Driver Enable assertion time LSB position in CR1 register */
\r
666 /** @defgroup UART_CR1_DEDT_ADDRESS_LSB_POS UART Driver Enable DeAssertion Time LSB Position In CR1 Register
\r
669 #define UART_CR1_DEDT_ADDRESS_LSB_POS 16U /*!< UART Driver Enable de-assertion time LSB position in CR1 register */
\r
674 /** @defgroup UART_Interruption_Mask UART Interruptions Flag Mask
\r
677 #define UART_IT_MASK 0x001FU /*!< UART interruptions flags mask */
\r
682 /** @defgroup UART_TimeOut_Value UART polling-based communications time-out value
\r
685 #define HAL_UART_TIMEOUT_VALUE 0x1FFFFFFU /*!< UART polling-based communications time-out value */
\r
690 /** @defgroup UART_Flags UART Status Flags
\r
691 * Elements values convention: 0xXXXX
\r
692 * - 0xXXXX : Flag mask in the ISR register
\r
695 #if defined(USART_CR1_FIFOEN)
\r
696 #define UART_FLAG_TXFT USART_ISR_TXFT /*!< UART TXFIFO threshold flag */
\r
697 #define UART_FLAG_RXFT USART_ISR_RXFT /*!< UART RXFIFO threshold flag */
\r
698 #define UART_FLAG_RXFF USART_ISR_RXFF /*!< UART RXFIFO Full flag */
\r
699 #define UART_FLAG_TXFE USART_ISR_TXFE /*!< UART TXFIFO Empty flag */
\r
700 #endif /* USART_CR1_FIFOEN */
\r
701 #define UART_FLAG_REACK USART_ISR_REACK /*!< UART receive enable acknowledge flag */
\r
702 #define UART_FLAG_TEACK USART_ISR_TEACK /*!< UART transmit enable acknowledge flag */
\r
703 #define UART_FLAG_WUF USART_ISR_WUF /*!< UART wake-up from stop mode flag */
\r
704 #define UART_FLAG_RWU USART_ISR_RWU /*!< UART receiver wake-up from mute mode flag */
\r
705 #define UART_FLAG_SBKF USART_ISR_SBKF /*!< UART send break flag */
\r
706 #define UART_FLAG_CMF USART_ISR_CMF /*!< UART character match flag */
\r
707 #define UART_FLAG_BUSY USART_ISR_BUSY /*!< UART busy flag */
\r
708 #define UART_FLAG_ABRF USART_ISR_ABRF /*!< UART auto Baud rate flag */
\r
709 #define UART_FLAG_ABRE USART_ISR_ABRE /*!< UART auto Baud rate error */
\r
710 #define UART_FLAG_CTS USART_ISR_CTS /*!< UART clear to send flag */
\r
711 #define UART_FLAG_CTSIF USART_ISR_CTSIF /*!< UART clear to send interrupt flag */
\r
712 #define UART_FLAG_LBDF USART_ISR_LBDF /*!< UART LIN break detection flag */
\r
713 #if defined(USART_CR1_FIFOEN)
\r
714 #define UART_FLAG_TXE USART_ISR_TXE_TXFNF /*!< UART transmit data register empty */
\r
715 #define UART_FLAG_TXFNF USART_ISR_TXE_TXFNF /*!< UART TXFIFO not full */
\r
717 #define UART_FLAG_TXE USART_ISR_TXE /*!< UART transmit data register empty */
\r
718 #endif /* USART_CR1_FIFOEN */
\r
719 #define UART_FLAG_TC USART_ISR_TC /*!< UART transmission complete */
\r
720 #if defined(USART_CR1_FIFOEN)
\r
721 #define UART_FLAG_RXNE USART_ISR_RXNE_RXFNE /*!< UART read data register not empty */
\r
722 #define UART_FLAG_RXFNE USART_ISR_RXNE_RXFNE /*!< UART RXFIFO not empty */
\r
724 #define UART_FLAG_RXNE USART_ISR_RXNE /*!< UART read data register not empty */
\r
725 #endif /* USART_CR1_FIFOEN */
\r
726 #define UART_FLAG_IDLE USART_ISR_IDLE /*!< UART idle flag */
\r
727 #define UART_FLAG_ORE USART_ISR_ORE /*!< UART overrun error */
\r
728 #define UART_FLAG_NE USART_ISR_NE /*!< UART noise error */
\r
729 #define UART_FLAG_FE USART_ISR_FE /*!< UART frame error */
\r
730 #define UART_FLAG_PE USART_ISR_PE /*!< UART parity error */
\r
735 /** @defgroup UART_Interrupt_definition UART Interrupts Definition
\r
736 * Elements values convention: 000ZZZZZ0XXYYYYYb
\r
737 * - YYYYY : Interrupt source position in the XX register (5bits)
\r
738 * - XX : Interrupt source register (2bits)
\r
739 * - 01: CR1 register
\r
740 * - 10: CR2 register
\r
741 * - 11: CR3 register
\r
742 * - ZZZZZ : Flag position in the ISR register(5bits)
\r
743 * Elements values convention: 000000000XXYYYYYb
\r
744 * - YYYYY : Interrupt source position in the XX register (5bits)
\r
745 * - XX : Interrupt source register (2bits)
\r
746 * - 01: CR1 register
\r
747 * - 10: CR2 register
\r
748 * - 11: CR3 register
\r
749 * Elements values convention: 0000ZZZZ00000000b
\r
750 * - ZZZZ : Flag position in the ISR register(4bits)
\r
753 #define UART_IT_PE 0x0028U /*!< UART parity error interruption */
\r
754 #define UART_IT_TXE 0x0727U /*!< UART transmit data register empty interruption */
\r
755 #if defined(USART_CR1_FIFOEN)
\r
756 #define UART_IT_TXFNF 0x0727U /*!< UART TX FIFO not full interruption */
\r
757 #endif /* USART_CR1_FIFOEN */
\r
758 #define UART_IT_TC 0x0626U /*!< UART transmission complete interruption */
\r
759 #define UART_IT_RXNE 0x0525U /*!< UART read data register not empty interruption */
\r
760 #if defined(USART_CR1_FIFOEN)
\r
761 #define UART_IT_RXFNE 0x0525U /*!< UART RXFIFO not empty interruption */
\r
762 #endif /* USART_CR1_FIFOEN */
\r
763 #define UART_IT_IDLE 0x0424U /*!< UART idle interruption */
\r
764 #define UART_IT_LBD 0x0846U /*!< UART LIN break detection interruption */
\r
765 #define UART_IT_CTS 0x096AU /*!< UART CTS interruption */
\r
766 #define UART_IT_CM 0x112EU /*!< UART character match interruption */
\r
767 #define UART_IT_WUF 0x1476U /*!< UART wake-up from stop mode interruption */
\r
768 #if defined(USART_CR1_FIFOEN)
\r
769 #define UART_IT_RXFF 0x183FU /*!< UART RXFIFO full interruption */
\r
770 #define UART_IT_TXFE 0x173EU /*!< UART TXFIFO empty interruption */
\r
771 #define UART_IT_RXFT 0x1A7CU /*!< UART RXFIFO threshold reached interruption */
\r
772 #define UART_IT_TXFT 0x1B77U /*!< UART TXFIFO threshold reached interruption */
\r
773 #endif /* USART_CR1_FIFOEN */
\r
775 #define UART_IT_ERR 0x0060U /*!< UART error interruption */
\r
777 #define UART_IT_ORE 0x0300U /*!< UART overrun error interruption */
\r
778 #define UART_IT_NE 0x0200U /*!< UART noise error interruption */
\r
779 #define UART_IT_FE 0x0100U /*!< UART frame error interruption */
\r
784 /** @defgroup UART_IT_CLEAR_Flags UART Interruption Clear Flags
\r
787 #define UART_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
\r
788 #define UART_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
\r
789 #define UART_CLEAR_NEF USART_ICR_NECF /*!< Noise Error detected Clear Flag */
\r
790 #define UART_CLEAR_OREF USART_ICR_ORECF /*!< Overrun Error Clear Flag */
\r
791 #define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
\r
792 #if defined(USART_CR1_FIFOEN)
\r
793 #define UART_CLEAR_TXFECF USART_ICR_TXFECF /*!< TXFIFO empty clear flag */
\r
794 #endif /* USART_CR1_FIFOEN */
\r
795 #define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
\r
796 #define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag */
\r
797 #define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
\r
798 #define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */
\r
799 #define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */
\r
809 /* Exported macros -----------------------------------------------------------*/
\r
810 /** @defgroup UART_Exported_Macros UART Exported Macros
\r
814 /** @brief Reset UART handle states.
\r
815 * @param __HANDLE__ UART handle.
\r
818 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
819 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
\r
820 (__HANDLE__)->gState = HAL_UART_STATE_RESET; \
\r
821 (__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
\r
822 (__HANDLE__)->MspInitCallback = NULL; \
\r
823 (__HANDLE__)->MspDeInitCallback = NULL; \
\r
826 #define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) do{ \
\r
827 (__HANDLE__)->gState = HAL_UART_STATE_RESET; \
\r
828 (__HANDLE__)->RxState = HAL_UART_STATE_RESET; \
\r
830 #endif /*USE_HAL_UART_REGISTER_CALLBACKS */
\r
832 /** @brief Flush the UART Data registers.
\r
833 * @param __HANDLE__ specifies the UART Handle.
\r
836 #define __HAL_UART_FLUSH_DRREGISTER(__HANDLE__) \
\r
838 SET_BIT((__HANDLE__)->Instance->RQR, UART_RXDATA_FLUSH_REQUEST); \
\r
839 SET_BIT((__HANDLE__)->Instance->RQR, UART_TXDATA_FLUSH_REQUEST); \
\r
842 /** @brief Clear the specified UART pending flag.
\r
843 * @param __HANDLE__ specifies the UART Handle.
\r
844 * @param __FLAG__ specifies the flag to check.
\r
845 * This parameter can be any combination of the following values:
\r
846 * @arg @ref UART_CLEAR_PEF Parity Error Clear Flag
\r
847 * @arg @ref UART_CLEAR_FEF Framing Error Clear Flag
\r
848 * @arg @ref UART_CLEAR_NEF Noise detected Clear Flag
\r
849 * @arg @ref UART_CLEAR_OREF Overrun Error Clear Flag
\r
850 * @arg @ref UART_CLEAR_IDLEF IDLE line detected Clear Flag
\r
851 * @arg @ref UART_CLEAR_TXFECF TXFIFO empty clear Flag
\r
852 * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag
\r
853 * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag
\r
854 * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag
\r
855 * @arg @ref UART_CLEAR_CMF Character Match Clear Flag
\r
856 * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag
\r
859 #define __HAL_UART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
\r
861 /** @brief Clear the UART PE pending flag.
\r
862 * @param __HANDLE__ specifies the UART Handle.
\r
865 #define __HAL_UART_CLEAR_PEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_PEF)
\r
867 /** @brief Clear the UART FE pending flag.
\r
868 * @param __HANDLE__ specifies the UART Handle.
\r
871 #define __HAL_UART_CLEAR_FEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_FEF)
\r
873 /** @brief Clear the UART NE pending flag.
\r
874 * @param __HANDLE__ specifies the UART Handle.
\r
877 #define __HAL_UART_CLEAR_NEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_NEF)
\r
879 /** @brief Clear the UART ORE pending flag.
\r
880 * @param __HANDLE__ specifies the UART Handle.
\r
883 #define __HAL_UART_CLEAR_OREFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_OREF)
\r
885 /** @brief Clear the UART IDLE pending flag.
\r
886 * @param __HANDLE__ specifies the UART Handle.
\r
889 #define __HAL_UART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_IDLEF)
\r
891 #if defined(USART_CR1_FIFOEN)
\r
892 /** @brief Clear the UART TX FIFO empty clear flag.
\r
893 * @param __HANDLE__ specifies the UART Handle.
\r
896 #define __HAL_UART_CLEAR_TXFECF(__HANDLE__) __HAL_UART_CLEAR_FLAG((__HANDLE__), UART_CLEAR_TXFECF)
\r
897 #endif /* USART_CR1_FIFOEN */
\r
899 /** @brief Check whether the specified UART flag is set or not.
\r
900 * @param __HANDLE__ specifies the UART Handle.
\r
901 * @param __FLAG__ specifies the flag to check.
\r
902 * This parameter can be one of the following values:
\r
903 * @arg @ref UART_FLAG_TXFT TXFIFO threshold flag
\r
904 * @arg @ref UART_FLAG_RXFT RXFIFO threshold flag
\r
905 * @arg @ref UART_FLAG_RXFF RXFIFO Full flag
\r
906 * @arg @ref UART_FLAG_TXFE TXFIFO Empty flag
\r
907 * @arg @ref UART_FLAG_REACK Receive enable acknowledge flag
\r
908 * @arg @ref UART_FLAG_TEACK Transmit enable acknowledge flag
\r
909 * @arg @ref UART_FLAG_WUF Wake up from stop mode flag
\r
910 * @arg @ref UART_FLAG_RWU Receiver wake up flag (if the UART in mute mode)
\r
911 * @arg @ref UART_FLAG_SBKF Send Break flag
\r
912 * @arg @ref UART_FLAG_CMF Character match flag
\r
913 * @arg @ref UART_FLAG_BUSY Busy flag
\r
914 * @arg @ref UART_FLAG_ABRF Auto Baud rate detection flag
\r
915 * @arg @ref UART_FLAG_ABRE Auto Baud rate detection error flag
\r
916 * @arg @ref UART_FLAG_CTS CTS Change flag
\r
917 * @arg @ref UART_FLAG_LBDF LIN Break detection flag
\r
918 * @arg @ref UART_FLAG_TXE Transmit data register empty flag
\r
919 * @arg @ref UART_FLAG_TXFNF UART TXFIFO not full flag
\r
920 * @arg @ref UART_FLAG_TC Transmission Complete flag
\r
921 * @arg @ref UART_FLAG_RXNE Receive data register not empty flag
\r
922 * @arg @ref UART_FLAG_RXFNE UART RXFIFO not empty flag
\r
923 * @arg @ref UART_FLAG_IDLE Idle Line detection flag
\r
924 * @arg @ref UART_FLAG_ORE Overrun Error flag
\r
925 * @arg @ref UART_FLAG_NE Noise Error flag
\r
926 * @arg @ref UART_FLAG_FE Framing Error flag
\r
927 * @arg @ref UART_FLAG_PE Parity Error flag
\r
928 * @retval The new state of __FLAG__ (TRUE or FALSE).
\r
930 #define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
\r
932 /** @brief Enable the specified UART interrupt.
\r
933 * @param __HANDLE__ specifies the UART Handle.
\r
934 * @param __INTERRUPT__ specifies the UART interrupt source to enable.
\r
935 * This parameter can be one of the following values:
\r
936 * @arg @ref UART_IT_RXFF RXFIFO Full interrupt
\r
937 * @arg @ref UART_IT_TXFE TXFIFO Empty interrupt
\r
938 * @arg @ref UART_IT_RXFT RXFIFO threshold interrupt
\r
939 * @arg @ref UART_IT_TXFT TXFIFO threshold interrupt
\r
940 * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt
\r
941 * @arg @ref UART_IT_CM Character match interrupt
\r
942 * @arg @ref UART_IT_CTS CTS change interrupt
\r
943 * @arg @ref UART_IT_LBD LIN Break detection interrupt
\r
944 * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
\r
945 * @arg @ref UART_IT_TXFNF TX FIFO not full interrupt
\r
946 * @arg @ref UART_IT_TC Transmission complete interrupt
\r
947 * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
\r
948 * @arg @ref UART_IT_RXFNE RXFIFO not empty interrupt
\r
949 * @arg @ref UART_IT_IDLE Idle line detection interrupt
\r
950 * @arg @ref UART_IT_PE Parity Error interrupt
\r
951 * @arg @ref UART_IT_ERR Error interrupt (frame error, noise error, overrun error)
\r
954 #define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
\r
955 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
\r
956 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & UART_IT_MASK))))
\r
959 /** @brief Disable the specified UART interrupt.
\r
960 * @param __HANDLE__ specifies the UART Handle.
\r
961 * @param __INTERRUPT__ specifies the UART interrupt source to disable.
\r
962 * This parameter can be one of the following values:
\r
963 * @arg @ref UART_IT_RXFF RXFIFO Full interrupt
\r
964 * @arg @ref UART_IT_TXFE TXFIFO Empty interrupt
\r
965 * @arg @ref UART_IT_RXFT RXFIFO threshold interrupt
\r
966 * @arg @ref UART_IT_TXFT TXFIFO threshold interrupt
\r
967 * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt
\r
968 * @arg @ref UART_IT_CM Character match interrupt
\r
969 * @arg @ref UART_IT_CTS CTS change interrupt
\r
970 * @arg @ref UART_IT_LBD LIN Break detection interrupt
\r
971 * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
\r
972 * @arg @ref UART_IT_TXFNF TX FIFO not full interrupt
\r
973 * @arg @ref UART_IT_TC Transmission complete interrupt
\r
974 * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
\r
975 * @arg @ref UART_IT_RXFNE RXFIFO not empty interrupt
\r
976 * @arg @ref UART_IT_IDLE Idle line detection interrupt
\r
977 * @arg @ref UART_IT_PE Parity Error interrupt
\r
978 * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
\r
981 #define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
\r
982 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))): \
\r
983 ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & UART_IT_MASK))))
\r
985 /** @brief Check whether the specified UART interrupt has occurred or not.
\r
986 * @param __HANDLE__ specifies the UART Handle.
\r
987 * @param __INTERRUPT__ specifies the UART interrupt to check.
\r
988 * This parameter can be one of the following values:
\r
989 * @arg @ref UART_IT_RXFF RXFIFO Full interrupt
\r
990 * @arg @ref UART_IT_TXFE TXFIFO Empty interrupt
\r
991 * @arg @ref UART_IT_RXFT RXFIFO threshold interrupt
\r
992 * @arg @ref UART_IT_TXFT TXFIFO threshold interrupt
\r
993 * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt
\r
994 * @arg @ref UART_IT_CM Character match interrupt
\r
995 * @arg @ref UART_IT_CTS CTS change interrupt
\r
996 * @arg @ref UART_IT_LBD LIN Break detection interrupt
\r
997 * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
\r
998 * @arg @ref UART_IT_TXFNF TX FIFO not full interrupt
\r
999 * @arg @ref UART_IT_TC Transmission complete interrupt
\r
1000 * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
\r
1001 * @arg @ref UART_IT_RXFNE RXFIFO not empty interrupt
\r
1002 * @arg @ref UART_IT_IDLE Idle line detection interrupt
\r
1003 * @arg @ref UART_IT_PE Parity Error interrupt
\r
1004 * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
\r
1005 * @retval The new state of __INTERRUPT__ (SET or RESET).
\r
1007 #define __HAL_UART_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\
\r
1008 & (1U << ((__INTERRUPT__)>> 8U))) != RESET) ? SET : RESET)
\r
1010 /** @brief Check whether the specified UART interrupt source is enabled or not.
\r
1011 * @param __HANDLE__ specifies the UART Handle.
\r
1012 * @param __INTERRUPT__ specifies the UART interrupt source to check.
\r
1013 * This parameter can be one of the following values:
\r
1014 * @arg @ref UART_IT_RXFF RXFIFO Full interrupt
\r
1015 * @arg @ref UART_IT_TXFE TXFIFO Empty interrupt
\r
1016 * @arg @ref UART_IT_RXFT RXFIFO threshold interrupt
\r
1017 * @arg @ref UART_IT_TXFT TXFIFO threshold interrupt
\r
1018 * @arg @ref UART_IT_WUF Wakeup from stop mode interrupt
\r
1019 * @arg @ref UART_IT_CM Character match interrupt
\r
1020 * @arg @ref UART_IT_CTS CTS change interrupt
\r
1021 * @arg @ref UART_IT_LBD LIN Break detection interrupt
\r
1022 * @arg @ref UART_IT_TXE Transmit Data Register empty interrupt
\r
1023 * @arg @ref UART_IT_TXFNF TX FIFO not full interrupt
\r
1024 * @arg @ref UART_IT_TC Transmission complete interrupt
\r
1025 * @arg @ref UART_IT_RXNE Receive Data register not empty interrupt
\r
1026 * @arg @ref UART_IT_RXFNE RXFIFO not empty interrupt
\r
1027 * @arg @ref UART_IT_IDLE Idle line detection interrupt
\r
1028 * @arg @ref UART_IT_PE Parity Error interrupt
\r
1029 * @arg @ref UART_IT_ERR Error interrupt (Frame error, noise error, overrun error)
\r
1030 * @retval The new state of __INTERRUPT__ (SET or RESET).
\r
1032 #define __HAL_UART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U) ? (__HANDLE__)->Instance->CR1 : \
\r
1033 (((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U) ? (__HANDLE__)->Instance->CR2 : \
\r
1034 (__HANDLE__)->Instance->CR3)) & (1U << (((uint16_t)(__INTERRUPT__)) & UART_IT_MASK))) != RESET) ? SET : RESET)
\r
1036 /** @brief Clear the specified UART ISR flag, in setting the proper ICR register flag.
\r
1037 * @param __HANDLE__ specifies the UART Handle.
\r
1038 * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set
\r
1039 * to clear the corresponding interrupt
\r
1040 * This parameter can be one of the following values:
\r
1041 * @arg @ref UART_CLEAR_PEF Parity Error Clear Flag
\r
1042 * @arg @ref UART_CLEAR_FEF Framing Error Clear Flag
\r
1043 * @arg @ref UART_CLEAR_NEF Noise detected Clear Flag
\r
1044 * @arg @ref UART_CLEAR_OREF Overrun Error Clear Flag
\r
1045 * @arg @ref UART_CLEAR_IDLEF IDLE line detected Clear Flag
\r
1046 * @arg @ref UART_CLEAR_TXFECF TXFIFO empty Clear Flag
\r
1047 * @arg @ref UART_CLEAR_TCF Transmission Complete Clear Flag
\r
1048 * @arg @ref UART_CLEAR_LBDF LIN Break Detection Clear Flag
\r
1049 * @arg @ref UART_CLEAR_CTSF CTS Interrupt Clear Flag
\r
1050 * @arg @ref UART_CLEAR_CMF Character Match Clear Flag
\r
1051 * @arg @ref UART_CLEAR_WUF Wake Up from stop mode Clear Flag
\r
1054 #define __HAL_UART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
\r
1056 /** @brief Set a specific UART request flag.
\r
1057 * @param __HANDLE__ specifies the UART Handle.
\r
1058 * @param __REQ__ specifies the request flag to set
\r
1059 * This parameter can be one of the following values:
\r
1060 * @arg @ref UART_AUTOBAUD_REQUEST Auto-Baud Rate Request
\r
1061 * @arg @ref UART_SENDBREAK_REQUEST Send Break Request
\r
1062 * @arg @ref UART_MUTE_MODE_REQUEST Mute Mode Request
\r
1063 * @arg @ref UART_RXDATA_FLUSH_REQUEST Receive Data flush Request
\r
1064 * @arg @ref UART_TXDATA_FLUSH_REQUEST Transmit data flush Request
\r
1067 #define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
\r
1069 /** @brief Enable the UART one bit sample method.
\r
1070 * @param __HANDLE__ specifies the UART Handle.
\r
1073 #define __HAL_UART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
\r
1075 /** @brief Disable the UART one bit sample method.
\r
1076 * @param __HANDLE__ specifies the UART Handle.
\r
1079 #define __HAL_UART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= ~USART_CR3_ONEBIT)
\r
1081 /** @brief Enable UART.
\r
1082 * @param __HANDLE__ specifies the UART Handle.
\r
1085 #define __HAL_UART_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
\r
1087 /** @brief Disable UART.
\r
1088 * @param __HANDLE__ specifies the UART Handle.
\r
1091 #define __HAL_UART_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
\r
1093 /** @brief Enable CTS flow control.
\r
1094 * @note This macro allows to enable CTS hardware flow control for a given UART instance,
\r
1095 * without need to call HAL_UART_Init() function.
\r
1096 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
\r
1097 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
\r
1098 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
\r
1099 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
\r
1100 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
\r
1101 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
\r
1102 * @param __HANDLE__ specifies the UART Handle.
\r
1105 #define __HAL_UART_HWCONTROL_CTS_ENABLE(__HANDLE__) \
\r
1107 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
\r
1108 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_CTSE; \
\r
1111 /** @brief Disable CTS flow control.
\r
1112 * @note This macro allows to disable CTS hardware flow control for a given UART instance,
\r
1113 * without need to call HAL_UART_Init() function.
\r
1114 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
\r
1115 * @note As macro is expected to be used for modifying CTS Hw flow control feature activation, without need
\r
1116 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
\r
1117 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
\r
1118 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
\r
1119 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
\r
1120 * @param __HANDLE__ specifies the UART Handle.
\r
1123 #define __HAL_UART_HWCONTROL_CTS_DISABLE(__HANDLE__) \
\r
1125 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_CTSE); \
\r
1126 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_CTSE); \
\r
1129 /** @brief Enable RTS flow control.
\r
1130 * @note This macro allows to enable RTS hardware flow control for a given UART instance,
\r
1131 * without need to call HAL_UART_Init() function.
\r
1132 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
\r
1133 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
\r
1134 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
\r
1135 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
\r
1136 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
\r
1137 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
\r
1138 * @param __HANDLE__ specifies the UART Handle.
\r
1141 #define __HAL_UART_HWCONTROL_RTS_ENABLE(__HANDLE__) \
\r
1143 SET_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE); \
\r
1144 (__HANDLE__)->Init.HwFlowCtl |= USART_CR3_RTSE; \
\r
1147 /** @brief Disable RTS flow control.
\r
1148 * @note This macro allows to disable RTS hardware flow control for a given UART instance,
\r
1149 * without need to call HAL_UART_Init() function.
\r
1150 * As involving direct access to UART registers, usage of this macro should be fully endorsed by user.
\r
1151 * @note As macro is expected to be used for modifying RTS Hw flow control feature activation, without need
\r
1152 * for USART instance Deinit/Init, following conditions for macro call should be fulfilled :
\r
1153 * - UART instance should have already been initialised (through call of HAL_UART_Init() )
\r
1154 * - macro could only be called when corresponding UART instance is disabled (i.e. __HAL_UART_DISABLE(__HANDLE__))
\r
1155 * and should be followed by an Enable macro (i.e. __HAL_UART_ENABLE(__HANDLE__)).
\r
1156 * @param __HANDLE__ specifies the UART Handle.
\r
1159 #define __HAL_UART_HWCONTROL_RTS_DISABLE(__HANDLE__) \
\r
1161 CLEAR_BIT((__HANDLE__)->Instance->CR3, USART_CR3_RTSE);\
\r
1162 (__HANDLE__)->Init.HwFlowCtl &= ~(USART_CR3_RTSE); \
\r
1168 /* Private macros --------------------------------------------------------*/
\r
1169 /** @defgroup UART_Private_Macros UART Private Macros
\r
1172 #if defined(USART_PRESC_PRESCALER)
\r
1173 /** @brief Get UART clok division factor from clock prescaler value.
\r
1174 * @param __CLOCKPRESCALER__ UART prescaler value.
\r
1175 * @retval UART clock division factor
\r
1177 #define UART_GET_DIV_FACTOR(__CLOCKPRESCALER__) \
\r
1178 (((__CLOCKPRESCALER__) == UART_PRESCALER_DIV1) ? 1U : \
\r
1179 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV2) ? 2U : \
\r
1180 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV4) ? 4U : \
\r
1181 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV6) ? 6U : \
\r
1182 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV8) ? 8U : \
\r
1183 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV10) ? 10U : \
\r
1184 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV12) ? 12U : \
\r
1185 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV16) ? 16U : \
\r
1186 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV32) ? 32U : \
\r
1187 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV64) ? 64U : \
\r
1188 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV128) ? 128U : \
\r
1189 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV256) ? 256U : 1U)
\r
1191 /** @brief BRR division operation to set BRR register with LPUART.
\r
1192 * @param __PCLK__ LPUART clock.
\r
1193 * @param __BAUD__ Baud rate set by the user.
\r
1194 * @param __CLOCKPRESCALER__ UART prescaler value.
\r
1195 * @retval Division result
\r
1197 #define UART_DIV_LPUART(__PCLK__, __BAUD__, __CLOCKPRESCALER__) ((uint32_t)(((((uint64_t)(__PCLK__)/UART_GET_DIV_FACTOR((__CLOCKPRESCALER__)))*256U)\
\r
1198 + (uint32_t)((__BAUD__)/2U)) / (__BAUD__)))
\r
1200 /** @brief BRR division operation to set BRR register in 8-bit oversampling mode.
\r
1201 * @param __PCLK__ UART clock.
\r
1202 * @param __BAUD__ Baud rate set by the user.
\r
1203 * @param __CLOCKPRESCALER__ UART prescaler value.
\r
1204 * @retval Division result
\r
1206 #define UART_DIV_SAMPLING8(__PCLK__, __BAUD__, __CLOCKPRESCALER__) (((((__PCLK__)/UART_GET_DIV_FACTOR((__CLOCKPRESCALER__)))*2U)\
\r
1207 + ((__BAUD__)/2U)) / (__BAUD__))
\r
1209 /** @brief BRR division operation to set BRR register in 16-bit oversampling mode.
\r
1210 * @param __PCLK__ UART clock.
\r
1211 * @param __BAUD__ Baud rate set by the user.
\r
1212 * @param __CLOCKPRESCALER__ UART prescaler value.
\r
1213 * @retval Division result
\r
1215 #define UART_DIV_SAMPLING16(__PCLK__, __BAUD__, __CLOCKPRESCALER__) ((((__PCLK__)/UART_GET_DIV_FACTOR((__CLOCKPRESCALER__)))\
\r
1216 + ((__BAUD__)/2U)) / (__BAUD__))
\r
1219 /** @brief BRR division operation to set BRR register with LPUART.
\r
1220 * @param __PCLK__ LPUART clock.
\r
1221 * @param __BAUD__ Baud rate set by the user.
\r
1222 * @retval Division result
\r
1224 #define UART_DIV_LPUART(__PCLK__, __BAUD__) (((((uint64_t)(__PCLK__)*256U)) + ((__BAUD__)/2U)) / (__BAUD__))
\r
1226 /** @brief BRR division operation to set BRR register in 8-bit oversampling mode.
\r
1227 * @param __PCLK__ UART clock.
\r
1228 * @param __BAUD__ Baud rate set by the user.
\r
1229 * @retval Division result
\r
1231 #define UART_DIV_SAMPLING8(__PCLK__, __BAUD__) ((((__PCLK__)*2U) + ((__BAUD__)/2U)) / (__BAUD__))
\r
1233 /** @brief BRR division operation to set BRR register in 16-bit oversampling mode.
\r
1234 * @param __PCLK__ UART clock.
\r
1235 * @param __BAUD__ Baud rate set by the user.
\r
1236 * @retval Division result
\r
1238 #define UART_DIV_SAMPLING16(__PCLK__, __BAUD__) (((__PCLK__) + ((__BAUD__)/2U)) / (__BAUD__))
\r
1239 #endif /* USART_PRESC_PRESCALER */
\r
1241 /** @brief Check whether or not UART instance is Low Power UART.
\r
1242 * @param __HANDLE__ specifies the UART Handle.
\r
1243 * @retval SET (instance is LPUART) or RESET (instance isn't LPUART)
\r
1245 #define UART_INSTANCE_LOWPOWER(__HANDLE__) (IS_LPUART_INSTANCE((__HANDLE__)->Instance))
\r
1247 /** @brief Check UART Baud rate.
\r
1248 * @param __BAUDRATE__ Baudrate specified by the user.
\r
1249 * The maximum Baud Rate is derived from the maximum clock on L4
\r
1250 * divided by the smallest oversampling used on the USART (i.e. 8)
\r
1251 * (i.e. 120 MHz on STM32L4Rx/L4Sx, 80 Mhz otherwise)
\r
1252 * @retval SET (__BAUDRATE__ is valid) or RESET (__BAUDRATE__ is invalid)
\r
1254 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
\r
1255 #define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 15000001U)
\r
1257 #define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 10000001U)
\r
1258 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
\r
1260 /** @brief Check UART assertion time.
\r
1261 * @param __TIME__ 5-bit value assertion time.
\r
1262 * @retval Test result (TRUE or FALSE).
\r
1264 #define IS_UART_ASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1FU)
\r
1266 /** @brief Check UART deassertion time.
\r
1267 * @param __TIME__ 5-bit value deassertion time.
\r
1268 * @retval Test result (TRUE or FALSE).
\r
1270 #define IS_UART_DEASSERTIONTIME(__TIME__) ((__TIME__) <= 0x1FU)
\r
1273 * @brief Ensure that UART frame number of stop bits is valid.
\r
1274 * @param __STOPBITS__ UART frame number of stop bits.
\r
1275 * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)
\r
1277 #define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_0_5) || \
\r
1278 ((__STOPBITS__) == UART_STOPBITS_1) || \
\r
1279 ((__STOPBITS__) == UART_STOPBITS_1_5) || \
\r
1280 ((__STOPBITS__) == UART_STOPBITS_2))
\r
1283 * @brief Ensure that LPUART frame number of stop bits is valid.
\r
1284 * @param __STOPBITS__ LPUART frame number of stop bits.
\r
1285 * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid)
\r
1287 #define IS_LPUART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_1) || \
\r
1288 ((__STOPBITS__) == UART_STOPBITS_2))
\r
1291 * @brief Ensure that UART frame parity is valid.
\r
1292 * @param __PARITY__ UART frame parity.
\r
1293 * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid)
\r
1295 #define IS_UART_PARITY(__PARITY__) (((__PARITY__) == UART_PARITY_NONE) || \
\r
1296 ((__PARITY__) == UART_PARITY_EVEN) || \
\r
1297 ((__PARITY__) == UART_PARITY_ODD))
\r
1300 * @brief Ensure that UART hardware flow control is valid.
\r
1301 * @param __CONTROL__ UART hardware flow control.
\r
1302 * @retval SET (__CONTROL__ is valid) or RESET (__CONTROL__ is invalid)
\r
1304 #define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)\
\r
1305 (((__CONTROL__) == UART_HWCONTROL_NONE) || \
\r
1306 ((__CONTROL__) == UART_HWCONTROL_RTS) || \
\r
1307 ((__CONTROL__) == UART_HWCONTROL_CTS) || \
\r
1308 ((__CONTROL__) == UART_HWCONTROL_RTS_CTS))
\r
1311 * @brief Ensure that UART communication mode is valid.
\r
1312 * @param __MODE__ UART communication mode.
\r
1313 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
\r
1315 #define IS_UART_MODE(__MODE__) ((((__MODE__) & (~((uint32_t)(UART_MODE_TX_RX)))) == 0x00U) && ((__MODE__) != 0x00U))
\r
1318 * @brief Ensure that UART state is valid.
\r
1319 * @param __STATE__ UART state.
\r
1320 * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid)
\r
1322 #define IS_UART_STATE(__STATE__) (((__STATE__) == UART_STATE_DISABLE) || \
\r
1323 ((__STATE__) == UART_STATE_ENABLE))
\r
1326 * @brief Ensure that UART oversampling is valid.
\r
1327 * @param __SAMPLING__ UART oversampling.
\r
1328 * @retval SET (__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid)
\r
1330 #define IS_UART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == UART_OVERSAMPLING_16) || \
\r
1331 ((__SAMPLING__) == UART_OVERSAMPLING_8))
\r
1334 * @brief Ensure that UART frame sampling is valid.
\r
1335 * @param __ONEBIT__ UART frame sampling.
\r
1336 * @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid)
\r
1338 #define IS_UART_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == UART_ONE_BIT_SAMPLE_DISABLE) || \
\r
1339 ((__ONEBIT__) == UART_ONE_BIT_SAMPLE_ENABLE))
\r
1342 * @brief Ensure that UART auto Baud rate detection mode is valid.
\r
1343 * @param __MODE__ UART auto Baud rate detection mode.
\r
1344 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
\r
1346 #define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(__MODE__) (((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
\r
1347 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE) || \
\r
1348 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME) || \
\r
1349 ((__MODE__) == UART_ADVFEATURE_AUTOBAUDRATE_ON0X55FRAME))
\r
1352 * @brief Ensure that UART receiver timeout setting is valid.
\r
1353 * @param __TIMEOUT__ UART receiver timeout setting.
\r
1354 * @retval SET (__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid)
\r
1356 #define IS_UART_RECEIVER_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_DISABLE) || \
\r
1357 ((__TIMEOUT__) == UART_RECEIVER_TIMEOUT_ENABLE))
\r
1360 * @brief Ensure that UART LIN state is valid.
\r
1361 * @param __LIN__ UART LIN state.
\r
1362 * @retval SET (__LIN__ is valid) or RESET (__LIN__ is invalid)
\r
1364 #define IS_UART_LIN(__LIN__) (((__LIN__) == UART_LIN_DISABLE) || \
\r
1365 ((__LIN__) == UART_LIN_ENABLE))
\r
1368 * @brief Ensure that UART LIN break detection length is valid.
\r
1369 * @param __LENGTH__ UART LIN break detection length.
\r
1370 * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
\r
1372 #define IS_UART_LIN_BREAK_DETECT_LENGTH(__LENGTH__) (((__LENGTH__) == UART_LINBREAKDETECTLENGTH_10B) || \
\r
1373 ((__LENGTH__) == UART_LINBREAKDETECTLENGTH_11B))
\r
1376 * @brief Ensure that UART DMA TX state is valid.
\r
1377 * @param __DMATX__ UART DMA TX state.
\r
1378 * @retval SET (__DMATX__ is valid) or RESET (__DMATX__ is invalid)
\r
1380 #define IS_UART_DMA_TX(__DMATX__) (((__DMATX__) == UART_DMA_TX_DISABLE) || \
\r
1381 ((__DMATX__) == UART_DMA_TX_ENABLE))
\r
1384 * @brief Ensure that UART DMA RX state is valid.
\r
1385 * @param __DMARX__ UART DMA RX state.
\r
1386 * @retval SET (__DMARX__ is valid) or RESET (__DMARX__ is invalid)
\r
1388 #define IS_UART_DMA_RX(__DMARX__) (((__DMARX__) == UART_DMA_RX_DISABLE) || \
\r
1389 ((__DMARX__) == UART_DMA_RX_ENABLE))
\r
1392 * @brief Ensure that UART half-duplex state is valid.
\r
1393 * @param __HDSEL__ UART half-duplex state.
\r
1394 * @retval SET (__HDSEL__ is valid) or RESET (__HDSEL__ is invalid)
\r
1396 #define IS_UART_HALF_DUPLEX(__HDSEL__) (((__HDSEL__) == UART_HALF_DUPLEX_DISABLE) || \
\r
1397 ((__HDSEL__) == UART_HALF_DUPLEX_ENABLE))
\r
1400 * @brief Ensure that UART wake-up method is valid.
\r
1401 * @param __WAKEUP__ UART wake-up method .
\r
1402 * @retval SET (__WAKEUP__ is valid) or RESET (__WAKEUP__ is invalid)
\r
1404 #define IS_UART_WAKEUPMETHOD(__WAKEUP__) (((__WAKEUP__) == UART_WAKEUPMETHOD_IDLELINE) || \
\r
1405 ((__WAKEUP__) == UART_WAKEUPMETHOD_ADDRESSMARK))
\r
1408 * @brief Ensure that UART request parameter is valid.
\r
1409 * @param __PARAM__ UART request parameter.
\r
1410 * @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid)
\r
1412 #define IS_UART_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == UART_AUTOBAUD_REQUEST) || \
\r
1413 ((__PARAM__) == UART_SENDBREAK_REQUEST) || \
\r
1414 ((__PARAM__) == UART_MUTE_MODE_REQUEST) || \
\r
1415 ((__PARAM__) == UART_RXDATA_FLUSH_REQUEST) || \
\r
1416 ((__PARAM__) == UART_TXDATA_FLUSH_REQUEST))
\r
1419 * @brief Ensure that UART advanced features initialization is valid.
\r
1420 * @param __INIT__ UART advanced features initialization.
\r
1421 * @retval SET (__INIT__ is valid) or RESET (__INIT__ is invalid)
\r
1423 #define IS_UART_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (UART_ADVFEATURE_NO_INIT | \
\r
1424 UART_ADVFEATURE_TXINVERT_INIT | \
\r
1425 UART_ADVFEATURE_RXINVERT_INIT | \
\r
1426 UART_ADVFEATURE_DATAINVERT_INIT | \
\r
1427 UART_ADVFEATURE_SWAP_INIT | \
\r
1428 UART_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
\r
1429 UART_ADVFEATURE_DMADISABLEONERROR_INIT | \
\r
1430 UART_ADVFEATURE_AUTOBAUDRATE_INIT | \
\r
1431 UART_ADVFEATURE_MSBFIRST_INIT))
\r
1434 * @brief Ensure that UART frame TX inversion setting is valid.
\r
1435 * @param __TXINV__ UART frame TX inversion setting.
\r
1436 * @retval SET (__TXINV__ is valid) or RESET (__TXINV__ is invalid)
\r
1438 #define IS_UART_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == UART_ADVFEATURE_TXINV_DISABLE) || \
\r
1439 ((__TXINV__) == UART_ADVFEATURE_TXINV_ENABLE))
\r
1442 * @brief Ensure that UART frame RX inversion setting is valid.
\r
1443 * @param __RXINV__ UART frame RX inversion setting.
\r
1444 * @retval SET (__RXINV__ is valid) or RESET (__RXINV__ is invalid)
\r
1446 #define IS_UART_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == UART_ADVFEATURE_RXINV_DISABLE) || \
\r
1447 ((__RXINV__) == UART_ADVFEATURE_RXINV_ENABLE))
\r
1450 * @brief Ensure that UART frame data inversion setting is valid.
\r
1451 * @param __DATAINV__ UART frame data inversion setting.
\r
1452 * @retval SET (__DATAINV__ is valid) or RESET (__DATAINV__ is invalid)
\r
1454 #define IS_UART_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == UART_ADVFEATURE_DATAINV_DISABLE) || \
\r
1455 ((__DATAINV__) == UART_ADVFEATURE_DATAINV_ENABLE))
\r
1458 * @brief Ensure that UART frame RX/TX pins swap setting is valid.
\r
1459 * @param __SWAP__ UART frame RX/TX pins swap setting.
\r
1460 * @retval SET (__SWAP__ is valid) or RESET (__SWAP__ is invalid)
\r
1462 #define IS_UART_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == UART_ADVFEATURE_SWAP_DISABLE) || \
\r
1463 ((__SWAP__) == UART_ADVFEATURE_SWAP_ENABLE))
\r
1466 * @brief Ensure that UART frame overrun setting is valid.
\r
1467 * @param __OVERRUN__ UART frame overrun setting.
\r
1468 * @retval SET (__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid)
\r
1470 #define IS_UART_OVERRUN(__OVERRUN__) (((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_ENABLE) || \
\r
1471 ((__OVERRUN__) == UART_ADVFEATURE_OVERRUN_DISABLE))
\r
1474 * @brief Ensure that UART auto Baud rate state is valid.
\r
1475 * @param __AUTOBAUDRATE__ UART auto Baud rate state.
\r
1476 * @retval SET (__AUTOBAUDRATE__ is valid) or RESET (__AUTOBAUDRATE__ is invalid)
\r
1478 #define IS_UART_ADVFEATURE_AUTOBAUDRATE(__AUTOBAUDRATE__) (((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_DISABLE) || \
\r
1479 ((__AUTOBAUDRATE__) == UART_ADVFEATURE_AUTOBAUDRATE_ENABLE))
\r
1482 * @brief Ensure that UART DMA enabling or disabling on error setting is valid.
\r
1483 * @param __DMA__ UART DMA enabling or disabling on error setting.
\r
1484 * @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid)
\r
1486 #define IS_UART_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == UART_ADVFEATURE_DMA_ENABLEONRXERROR) || \
\r
1487 ((__DMA__) == UART_ADVFEATURE_DMA_DISABLEONRXERROR))
\r
1490 * @brief Ensure that UART frame MSB first setting is valid.
\r
1491 * @param __MSBFIRST__ UART frame MSB first setting.
\r
1492 * @retval SET (__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid)
\r
1494 #define IS_UART_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_DISABLE) || \
\r
1495 ((__MSBFIRST__) == UART_ADVFEATURE_MSBFIRST_ENABLE))
\r
1498 * @brief Ensure that UART stop mode state is valid.
\r
1499 * @param __STOPMODE__ UART stop mode state.
\r
1500 * @retval SET (__STOPMODE__ is valid) or RESET (__STOPMODE__ is invalid)
\r
1502 #define IS_UART_ADVFEATURE_STOPMODE(__STOPMODE__) (((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_DISABLE) || \
\r
1503 ((__STOPMODE__) == UART_ADVFEATURE_STOPMODE_ENABLE))
\r
1506 * @brief Ensure that UART mute mode state is valid.
\r
1507 * @param __MUTE__ UART mute mode state.
\r
1508 * @retval SET (__MUTE__ is valid) or RESET (__MUTE__ is invalid)
\r
1510 #define IS_UART_MUTE_MODE(__MUTE__) (((__MUTE__) == UART_ADVFEATURE_MUTEMODE_DISABLE) || \
\r
1511 ((__MUTE__) == UART_ADVFEATURE_MUTEMODE_ENABLE))
\r
1514 * @brief Ensure that UART wake-up selection is valid.
\r
1515 * @param __WAKE__ UART wake-up selection.
\r
1516 * @retval SET (__WAKE__ is valid) or RESET (__WAKE__ is invalid)
\r
1518 #define IS_UART_WAKEUP_SELECTION(__WAKE__) (((__WAKE__) == UART_WAKEUP_ON_ADDRESS) || \
\r
1519 ((__WAKE__) == UART_WAKEUP_ON_STARTBIT) || \
\r
1520 ((__WAKE__) == UART_WAKEUP_ON_READDATA_NONEMPTY))
\r
1523 * @brief Ensure that UART driver enable polarity is valid.
\r
1524 * @param __POLARITY__ UART driver enable polarity.
\r
1525 * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid)
\r
1527 #define IS_UART_DE_POLARITY(__POLARITY__) (((__POLARITY__) == UART_DE_POLARITY_HIGH) || \
\r
1528 ((__POLARITY__) == UART_DE_POLARITY_LOW))
\r
1530 #if defined(USART_PRESC_PRESCALER)
\r
1532 * @brief Ensure that UART Prescaler is valid.
\r
1533 * @param __CLOCKPRESCALER__ UART Prescaler value.
\r
1534 * @retval SET (__CLOCKPRESCALER__ is valid) or RESET (__CLOCKPRESCALER__ is invalid)
\r
1536 #define IS_UART_PRESCALER(__CLOCKPRESCALER__) (((__CLOCKPRESCALER__) == UART_PRESCALER_DIV1) || \
\r
1537 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV2) || \
\r
1538 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV4) || \
\r
1539 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV6) || \
\r
1540 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV8) || \
\r
1541 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV10) || \
\r
1542 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV12) || \
\r
1543 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV16) || \
\r
1544 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV32) || \
\r
1545 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV64) || \
\r
1546 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV128) || \
\r
1547 ((__CLOCKPRESCALER__) == UART_PRESCALER_DIV256))
\r
1548 #endif /* USART_PRESC_PRESCALER */
\r
1554 /* Include UART HAL Extended module */
\r
1555 #include "stm32l4xx_hal_uart_ex.h"
\r
1558 /* Exported functions --------------------------------------------------------*/
\r
1559 /** @addtogroup UART_Exported_Functions UART Exported Functions
\r
1563 /** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions
\r
1567 /* Initialization and de-initialization functions ****************************/
\r
1568 HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart);
\r
1569 HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart);
\r
1570 HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
\r
1571 HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod);
\r
1572 HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart);
\r
1573 void HAL_UART_MspInit(UART_HandleTypeDef *huart);
\r
1574 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart);
\r
1576 /* Callbacks Register/UnRegister functions ***********************************/
\r
1577 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
1578 HAL_StatusTypeDef HAL_UART_RegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID,
\r
1579 pUART_CallbackTypeDef pCallback);
\r
1580 HAL_StatusTypeDef HAL_UART_UnRegisterCallback(UART_HandleTypeDef *huart, HAL_UART_CallbackIDTypeDef CallbackID);
\r
1581 #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
\r
1587 /** @addtogroup UART_Exported_Functions_Group2 IO operation functions
\r
1591 /* IO operation functions *****************************************************/
\r
1592 HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
\r
1593 HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout);
\r
1594 HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
\r
1595 HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
\r
1596 HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
\r
1597 HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
\r
1598 HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart);
\r
1599 HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart);
\r
1600 HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart);
\r
1601 /* Transfer Abort functions */
\r
1602 HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart);
\r
1603 HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart);
\r
1604 HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart);
\r
1605 HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart);
\r
1606 HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart);
\r
1607 HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart);
\r
1609 void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
\r
1610 void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart);
\r
1611 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);
\r
1612 void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart);
\r
1613 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
\r
1614 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
\r
1615 void HAL_UART_AbortCpltCallback(UART_HandleTypeDef *huart);
\r
1616 void HAL_UART_AbortTransmitCpltCallback(UART_HandleTypeDef *huart);
\r
1617 void HAL_UART_AbortReceiveCpltCallback(UART_HandleTypeDef *huart);
\r
1623 /** @addtogroup UART_Exported_Functions_Group3 Peripheral Control functions
\r
1627 /* Peripheral Control functions ************************************************/
\r
1628 HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
\r
1629 HAL_StatusTypeDef HAL_MultiProcessor_EnableMuteMode(UART_HandleTypeDef *huart);
\r
1630 HAL_StatusTypeDef HAL_MultiProcessor_DisableMuteMode(UART_HandleTypeDef *huart);
\r
1631 void HAL_MultiProcessor_EnterMuteMode(UART_HandleTypeDef *huart);
\r
1632 HAL_StatusTypeDef HAL_HalfDuplex_EnableTransmitter(UART_HandleTypeDef *huart);
\r
1633 HAL_StatusTypeDef HAL_HalfDuplex_EnableReceiver(UART_HandleTypeDef *huart);
\r
1639 /** @addtogroup UART_Exported_Functions_Group4 Peripheral State and Error functions
\r
1643 /* Peripheral State and Errors functions **************************************************/
\r
1644 HAL_UART_StateTypeDef HAL_UART_GetState(UART_HandleTypeDef *huart);
\r
1645 uint32_t HAL_UART_GetError(UART_HandleTypeDef *huart);
\r
1655 /* Private functions -----------------------------------------------------------*/
\r
1656 /** @addtogroup UART_Private_Functions UART Private Functions
\r
1659 #if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
\r
1660 void UART_InitCallbacksToDefault(UART_HandleTypeDef *huart);
\r
1661 #endif /* USE_HAL_UART_REGISTER_CALLBACKS */
\r
1662 HAL_StatusTypeDef UART_SetConfig(UART_HandleTypeDef *huart);
\r
1663 HAL_StatusTypeDef UART_CheckIdleState(UART_HandleTypeDef *huart);
\r
1664 HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status,
\r
1665 uint32_t Tickstart, uint32_t Timeout);
\r
1666 void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
\r
1680 #ifdef __cplusplus
\r
1684 #endif /* STM32L4xx_HAL_UART_H */
\r
1686 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r