Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 6 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | */ |
46 | */ |
47 | typedef struct |
47 | typedef struct |
48 | { |
48 | { |
49 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
49 | uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. |
50 | The baud rate is computed using the following formula: |
50 | The baud rate is computed using the following formula: |
51 | Baud Rate Register[15:4] = ((2 * fclk_pres) / ((huart->Init.BaudRate)))[15:4] |
51 | Baud Rate Register[15:4] = ((2 * fclk_pres) / |
- | 52 | ((huart->Init.BaudRate)))[15:4] |
|
52 | Baud Rate Register[3] = 0 |
53 | Baud Rate Register[3] = 0 |
53 | Baud Rate Register[2:0] = (((2 * fclk_pres) / ((huart->Init.BaudRate)))[3:0]) >> 1 |
54 | Baud Rate Register[2:0] = (((2 * fclk_pres) / |
- | 55 | ((huart->Init.BaudRate)))[3:0]) >> 1 |
|
54 | where fclk_pres is the USART input clock frequency |
56 | where fclk_pres is the USART input clock frequency |
55 | @note Oversampling by 8 is systematically applied to achieve high baud rates. */ |
57 | @note Oversampling by 8 is systematically applied to |
- | 58 | achieve high baud rates. */ |
|
56 | 59 | ||
57 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
60 | uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
58 | This parameter can be a value of @ref USARTEx_Word_Length. */ |
61 | This parameter can be a value of @ref USARTEx_Word_Length. */ |
59 | 62 | ||
60 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
63 | uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. |
Line 197... | Line 200... | ||
197 | */ |
200 | */ |
198 | 201 | ||
199 | /** @defgroup USART_Error_Definition USART Error Definition |
202 | /** @defgroup USART_Error_Definition USART Error Definition |
200 | * @{ |
203 | * @{ |
201 | */ |
204 | */ |
202 | #define HAL_USART_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ |
205 | #define HAL_USART_ERROR_NONE (0x00000000U) /*!< No error */ |
203 | #define HAL_USART_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */ |
206 | #define HAL_USART_ERROR_PE (0x00000001U) /*!< Parity error */ |
204 | #define HAL_USART_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */ |
207 | #define HAL_USART_ERROR_NE (0x00000002U) /*!< Noise error */ |
205 | #define HAL_USART_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */ |
208 | #define HAL_USART_ERROR_FE (0x00000004U) /*!< Frame error */ |
206 | #define HAL_USART_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */ |
209 | #define HAL_USART_ERROR_ORE (0x00000008U) /*!< Overrun error */ |
207 | #define HAL_USART_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ |
210 | #define HAL_USART_ERROR_DMA (0x00000010U) /*!< DMA transfer error */ |
208 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
211 | #if (USE_HAL_USART_REGISTER_CALLBACKS == 1) |
209 | #define HAL_USART_ERROR_INVALID_CALLBACK ((uint32_t)0x00000040U) /*!< Invalid Callback error */ |
212 | #define HAL_USART_ERROR_INVALID_CALLBACK (0x00000040U) /*!< Invalid Callback error */ |
210 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
213 | #endif /* USE_HAL_USART_REGISTER_CALLBACKS */ |
- | 214 | #define HAL_USART_ERROR_RTO (0x00000080U) /*!< Receiver Timeout error */ |
|
211 | /** |
215 | /** |
212 | * @} |
216 | * @} |
213 | */ |
217 | */ |
214 | 218 | ||
215 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
219 | /** @defgroup USART_Stop_Bits USART Number of Stop Bits |
Line 220... | Line 224... | ||
220 | #define USART_STOPBITS_1 0x00000000U /*!< USART frame with 1 stop bit */ |
224 | #define USART_STOPBITS_1 0x00000000U /*!< USART frame with 1 stop bit */ |
221 | #define USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< USART frame with 1.5 stop bits */ |
225 | #define USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< USART frame with 1.5 stop bits */ |
222 | #define USART_STOPBITS_2 USART_CR2_STOP_1 /*!< USART frame with 2 stop bits */ |
226 | #define USART_STOPBITS_2 USART_CR2_STOP_1 /*!< USART frame with 2 stop bits */ |
223 | #else |
227 | #else |
224 | #define USART_STOPBITS_1 (0x00000000U) /*!< USART frame with 1 stop bit */ |
228 | #define USART_STOPBITS_1 (0x00000000U) /*!< USART frame with 1 stop bit */ |
225 | #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) /*!< USART frame with 2 stop bits */ |
229 | #define USART_STOPBITS_2 (USART_CR2_STOP_1) /*!< USART frame with 2 stop bits */ |
226 | #endif /* USART_SMARTCARD_SUPPORT */ |
230 | #endif /* USART_SMARTCARD_SUPPORT */ |
227 | /** |
231 | /** |
228 | * @} |
232 | * @} |
229 | */ |
233 | */ |
230 | 234 | ||
Line 246... | Line 250... | ||
246 | #define USART_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< RX and TX mode */ |
250 | #define USART_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< RX and TX mode */ |
247 | /** |
251 | /** |
248 | * @} |
252 | * @} |
249 | */ |
253 | */ |
250 | 254 | ||
251 | /** @defgroup USART_Over_Sampling USART Over Sampling |
- | |
252 | * @{ |
- | |
253 | */ |
- | |
254 | #define USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */ |
- | |
255 | #define USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */ |
- | |
256 | /** |
- | |
257 | * @} |
- | |
258 | */ |
- | |
259 | - | ||
260 | /** @defgroup USART_Clock USART Clock |
255 | /** @defgroup USART_Clock USART Clock |
261 | * @{ |
256 | * @{ |
262 | */ |
257 | */ |
263 | #define USART_CLOCK_DISABLE 0x00000000U /*!< USART clock disable */ |
258 | #define USART_CLOCK_DISABLE 0x00000000U /*!< USART clock disable */ |
264 | #define USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< USART clock enable */ |
259 | #define USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< USART clock enable */ |
Line 312... | Line 307... | ||
312 | */ |
307 | */ |
313 | #define USART_FLAG_REACK USART_ISR_REACK /*!< USART receive enable acknowledge flag */ |
308 | #define USART_FLAG_REACK USART_ISR_REACK /*!< USART receive enable acknowledge flag */ |
314 | #define USART_FLAG_TEACK USART_ISR_TEACK /*!< USART transmit enable acknowledge flag */ |
309 | #define USART_FLAG_TEACK USART_ISR_TEACK /*!< USART transmit enable acknowledge flag */ |
315 | #define USART_FLAG_BUSY USART_ISR_BUSY /*!< USART busy flag */ |
310 | #define USART_FLAG_BUSY USART_ISR_BUSY /*!< USART busy flag */ |
316 | #define USART_FLAG_TXE USART_ISR_TXE /*!< USART transmit data register empty */ |
311 | #define USART_FLAG_TXE USART_ISR_TXE /*!< USART transmit data register empty */ |
- | 312 | #define USART_FLAG_RTOF USART_ISR_RTOF /*!< USART receiver timeout flag */ |
|
317 | #define USART_FLAG_TC USART_ISR_TC /*!< USART transmission complete */ |
313 | #define USART_FLAG_TC USART_ISR_TC /*!< USART transmission complete */ |
318 | #define USART_FLAG_RXNE USART_ISR_RXNE /*!< USART read data register not empty */ |
314 | #define USART_FLAG_RXNE USART_ISR_RXNE /*!< USART read data register not empty */ |
319 | #define USART_FLAG_IDLE USART_ISR_IDLE /*!< USART idle flag */ |
315 | #define USART_FLAG_IDLE USART_ISR_IDLE /*!< USART idle flag */ |
320 | #define USART_FLAG_ORE USART_ISR_ORE /*!< USART overrun error */ |
316 | #define USART_FLAG_ORE USART_ISR_ORE /*!< USART overrun error */ |
321 | #define USART_FLAG_NE USART_ISR_NE /*!< USART noise error */ |
317 | #define USART_FLAG_NE USART_ISR_NE /*!< USART noise error */ |
Line 358... | Line 354... | ||
358 | #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise Error detected Clear Flag */ |
354 | #define USART_CLEAR_NEF USART_ICR_NCF /*!< Noise Error detected Clear Flag */ |
359 | #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
355 | #define USART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */ |
360 | #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
356 | #define USART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */ |
361 | #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
357 | #define USART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */ |
362 | #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
358 | #define USART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */ |
- | 359 | #define USART_CLEAR_RTOF USART_ICR_RTOCF /*!< USART receiver timeout clear flag */ |
|
363 | /** |
360 | /** |
364 | * @} |
361 | * @} |
365 | */ |
362 | */ |
366 | 363 | ||
367 | /** @defgroup USART_Interruption_Mask USART Interruption Flags Mask |
364 | /** @defgroup USART_Interruption_Mask USART Interruption Flags Mask |
Line 408... | Line 405... | ||
408 | * @arg @ref USART_FLAG_BUSY Busy flag |
405 | * @arg @ref USART_FLAG_BUSY Busy flag |
409 | * @arg @ref USART_FLAG_CTS CTS Change flag |
406 | * @arg @ref USART_FLAG_CTS CTS Change flag |
410 | * @arg @ref USART_FLAG_TXE Transmit data register empty flag |
407 | * @arg @ref USART_FLAG_TXE Transmit data register empty flag |
411 | * @arg @ref USART_FLAG_TC Transmission Complete flag |
408 | * @arg @ref USART_FLAG_TC Transmission Complete flag |
412 | * @arg @ref USART_FLAG_RXNE Receive data register not empty flag |
409 | * @arg @ref USART_FLAG_RXNE Receive data register not empty flag |
- | 410 | * @arg @ref USART_FLAG_RTOF Receiver Timeout flag |
|
413 | * @arg @ref USART_FLAG_IDLE Idle Line detection flag |
411 | * @arg @ref USART_FLAG_IDLE Idle Line detection flag |
414 | * @arg @ref USART_FLAG_ORE OverRun Error flag |
412 | * @arg @ref USART_FLAG_ORE OverRun Error flag |
415 | * @arg @ref USART_FLAG_NE Noise Error flag |
413 | * @arg @ref USART_FLAG_NE Noise Error flag |
416 | * @arg @ref USART_FLAG_FE Framing Error flag |
414 | * @arg @ref USART_FLAG_FE Framing Error flag |
417 | * @arg @ref USART_FLAG_PE Parity Error flag |
415 | * @arg @ref USART_FLAG_PE Parity Error flag |
Line 427... | Line 425... | ||
427 | * @arg @ref USART_CLEAR_FEF Framing Error Clear Flag |
425 | * @arg @ref USART_CLEAR_FEF Framing Error Clear Flag |
428 | * @arg @ref USART_CLEAR_NEF Noise detected Clear Flag |
426 | * @arg @ref USART_CLEAR_NEF Noise detected Clear Flag |
429 | * @arg @ref USART_CLEAR_OREF Overrun Error Clear Flag |
427 | * @arg @ref USART_CLEAR_OREF Overrun Error Clear Flag |
430 | * @arg @ref USART_CLEAR_IDLEF IDLE line detected Clear Flag |
428 | * @arg @ref USART_CLEAR_IDLEF IDLE line detected Clear Flag |
431 | * @arg @ref USART_CLEAR_TCF Transmission Complete Clear Flag |
429 | * @arg @ref USART_CLEAR_TCF Transmission Complete Clear Flag |
- | 430 | * @arg @ref USART_CLEAR_RTOF Receiver Timeout clear flag |
|
432 | * @arg @ref USART_CLEAR_CTSF |
431 | * @arg @ref USART_CLEAR_CTSF |
433 | * @retval None |
432 | * @retval None |
434 | */ |
433 | */ |
435 | #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
434 | #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
436 | 435 | ||
Line 476... | Line 475... | ||
476 | * @arg @ref USART_IT_IDLE Idle line detection interrupt |
475 | * @arg @ref USART_IT_IDLE Idle line detection interrupt |
477 | * @arg @ref USART_IT_PE Parity Error interrupt |
476 | * @arg @ref USART_IT_PE Parity Error interrupt |
478 | * @arg @ref USART_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
477 | * @arg @ref USART_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
479 | * @retval None |
478 | * @retval None |
480 | */ |
479 | */ |
- | 480 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__)\ |
|
- | 481 | (((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 1U)?\ |
|
481 | #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
482 | ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
- | 483 | ((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 2U)?\ |
|
482 | ((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
484 | ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
483 | ((__HANDLE__)->Instance->CR3 |= ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
485 | ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
484 | 486 | ||
485 | /** @brief Disable the specified USART interrupt. |
487 | /** @brief Disable the specified USART interrupt. |
486 | * @param __HANDLE__ specifies the USART Handle. |
488 | * @param __HANDLE__ specifies the USART Handle. |
487 | * @param __INTERRUPT__ specifies the USART interrupt source to disable. |
489 | * @param __INTERRUPT__ specifies the USART interrupt source to disable. |
488 | * This parameter can be one of the following values: |
490 | * This parameter can be one of the following values: |
Line 492... | Line 494... | ||
492 | * @arg @ref USART_IT_IDLE Idle line detection interrupt |
494 | * @arg @ref USART_IT_IDLE Idle line detection interrupt |
493 | * @arg @ref USART_IT_PE Parity Error interrupt |
495 | * @arg @ref USART_IT_PE Parity Error interrupt |
494 | * @arg @ref USART_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
496 | * @arg @ref USART_IT_ERR Error interrupt(Frame error, noise error, overrun error) |
495 | * @retval None |
497 | * @retval None |
496 | */ |
498 | */ |
- | 499 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__)\ |
|
- | 500 | (((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 1U)?\ |
|
497 | #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
501 | ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
- | 502 | ((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 2U)?\ |
|
498 | ((((__INTERRUPT__) & USART_CR_MASK) >> USART_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
503 | ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK))): \ |
499 | ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
504 | ((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & USART_IT_MASK)))) |
500 | - | ||
501 | 505 | ||
502 | /** @brief Check whether the specified USART interrupt has occurred or not. |
506 | /** @brief Check whether the specified USART interrupt has occurred or not. |
503 | * @param __HANDLE__ specifies the USART Handle. |
507 | * @param __HANDLE__ specifies the USART Handle. |
504 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
508 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
505 | * This parameter can be one of the following values: |
509 | * This parameter can be one of the following values: |
Line 512... | Line 516... | ||
512 | * @arg @ref USART_IT_FE Framing Error interrupt |
516 | * @arg @ref USART_IT_FE Framing Error interrupt |
513 | * @arg @ref USART_IT_PE Parity Error interrupt |
517 | * @arg @ref USART_IT_PE Parity Error interrupt |
514 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
518 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
515 | */ |
519 | */ |
516 | #define __HAL_USART_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\ |
520 | #define __HAL_USART_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\ |
517 | & ((uint32_t)0x01U << (((__INTERRUPT__) & USART_ISR_MASK)>> USART_ISR_POS))) != 0U) ? SET : RESET) |
521 | & (0x01U << (((__INTERRUPT__) & USART_ISR_MASK)>>\ |
- | 522 | USART_ISR_POS))) != 0U) ? SET : RESET) |
|
518 | 523 | ||
519 | /** @brief Check whether the specified USART interrupt source is enabled or not. |
524 | /** @brief Check whether the specified USART interrupt source is enabled or not. |
520 | * @param __HANDLE__ specifies the USART Handle. |
525 | * @param __HANDLE__ specifies the USART Handle. |
521 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
526 | * @param __INTERRUPT__ specifies the USART interrupt source to check. |
522 | * This parameter can be one of the following values: |
527 | * This parameter can be one of the following values: |
Line 528... | Line 533... | ||
528 | * @arg @ref USART_IT_NE Noise Error interrupt |
533 | * @arg @ref USART_IT_NE Noise Error interrupt |
529 | * @arg @ref USART_IT_FE Framing Error interrupt |
534 | * @arg @ref USART_IT_FE Framing Error interrupt |
530 | * @arg @ref USART_IT_PE Parity Error interrupt |
535 | * @arg @ref USART_IT_PE Parity Error interrupt |
531 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
536 | * @retval The new state of __INTERRUPT__ (SET or RESET). |
532 | */ |
537 | */ |
533 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x01U) ? (__HANDLE__)->Instance->CR1 : \ |
538 | #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x01U) ?\ |
- | 539 | (__HANDLE__)->Instance->CR1 : \ |
|
534 | (((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x02U) ? (__HANDLE__)->Instance->CR2 : \ |
540 | (((((uint8_t)(__INTERRUPT__)) >> 0x05U) == 0x02U) ?\ |
- | 541 | (__HANDLE__)->Instance->CR2 : \ |
|
- | 542 | (__HANDLE__)->Instance->CR3)) & (0x01U <<\ |
|
- | 543 | (((uint16_t)(__INTERRUPT__)) &\ |
|
535 | (__HANDLE__)->Instance->CR3)) & (0x01U << (((uint16_t)(__INTERRUPT__)) & USART_IT_MASK))) != 0U) ? SET : RESET) |
544 | USART_IT_MASK))) != 0U) ? SET : RESET) |
536 | - | ||
537 | 545 | ||
538 | /** @brief Clear the specified USART ISR flag, in setting the proper ICR register flag. |
546 | /** @brief Clear the specified USART ISR flag, in setting the proper ICR register flag. |
539 | * @param __HANDLE__ specifies the USART Handle. |
547 | * @param __HANDLE__ specifies the USART Handle. |
540 | * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
548 | * @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
541 | * to clear the corresponding interrupt. |
549 | * to clear the corresponding interrupt. |
Line 543... | Line 551... | ||
543 | * @arg @ref USART_CLEAR_PEF Parity Error Clear Flag |
551 | * @arg @ref USART_CLEAR_PEF Parity Error Clear Flag |
544 | * @arg @ref USART_CLEAR_FEF Framing Error Clear Flag |
552 | * @arg @ref USART_CLEAR_FEF Framing Error Clear Flag |
545 | * @arg @ref USART_CLEAR_NEF Noise detected Clear Flag |
553 | * @arg @ref USART_CLEAR_NEF Noise detected Clear Flag |
546 | * @arg @ref USART_CLEAR_OREF Overrun Error Clear Flag |
554 | * @arg @ref USART_CLEAR_OREF Overrun Error Clear Flag |
547 | * @arg @ref USART_CLEAR_IDLEF IDLE line detected Clear Flag |
555 | * @arg @ref USART_CLEAR_IDLEF IDLE line detected Clear Flag |
- | 556 | * @arg @ref USART_CLEAR_RTOF Receiver timeout clear flag |
|
548 | * @arg @ref USART_CLEAR_TCF Transmission Complete Clear Flag |
557 | * @arg @ref USART_CLEAR_TCF Transmission Complete Clear Flag |
549 | * @retval None |
558 | * @retval None |
550 | */ |
559 | */ |
551 | #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
560 | #define __HAL_USART_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
552 | 561 | ||
Line 640... | Line 649... | ||
640 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
649 | * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
641 | */ |
650 | */ |
642 | #define IS_USART_MODE(__MODE__) ((((__MODE__) & 0xFFFFFFF3U) == 0x00U) && ((__MODE__) != 0x00U)) |
651 | #define IS_USART_MODE(__MODE__) ((((__MODE__) & 0xFFFFFFF3U) == 0x00U) && ((__MODE__) != 0x00U)) |
643 | 652 | ||
644 | /** |
653 | /** |
645 | * @brief Ensure that USART oversampling is valid. |
- | |
646 | * @param __SAMPLING__ USART oversampling. |
- | |
647 | * @retval SET (__SAMPLING__ is valid) or RESET (__SAMPLING__ is invalid) |
- | |
648 | */ |
- | |
649 | #define IS_USART_OVERSAMPLING(__SAMPLING__) (((__SAMPLING__) == USART_OVERSAMPLING_16) || \ |
- | |
650 | ((__SAMPLING__) == USART_OVERSAMPLING_8)) |
- | |
651 | - | ||
652 | /** |
- | |
653 | * @brief Ensure that USART clock state is valid. |
654 | * @brief Ensure that USART clock state is valid. |
654 | * @param __CLOCK__ USART clock state. |
655 | * @param __CLOCK__ USART clock state. |
655 | * @retval SET (__CLOCK__ is valid) or RESET (__CLOCK__ is invalid) |
656 | * @retval SET (__CLOCK__ is valid) or RESET (__CLOCK__ is invalid) |
656 | */ |
657 | */ |
657 | #define IS_USART_CLOCK(__CLOCK__) (((__CLOCK__) == USART_CLOCK_DISABLE) || \ |
658 | #define IS_USART_CLOCK(__CLOCK__) (((__CLOCK__) == USART_CLOCK_DISABLE) || \ |