Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TUKS-COURSE-TIMER by
IO operation functions
[USART Exported Functions]
USART Transmit and Receive functions. More...
Functions | |
HAL_StatusTypeDef | HAL_USART_Transmit (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout) |
Simplex send an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_USART_Receive (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout) |
Receive an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_USART_TransmitReceive (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout) |
Full-Duplex Send and Receive an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_USART_Transmit_IT (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size) |
Send an amount of data in interrupt mode. | |
HAL_StatusTypeDef | HAL_USART_Receive_IT (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size) |
Receive an amount of data in blocking mode. | |
HAL_StatusTypeDef | HAL_USART_TransmitReceive_IT (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size) |
Full-Duplex Send and Receive an amount of data in interrupt mode. | |
HAL_StatusTypeDef | HAL_USART_Transmit_DMA (USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size) |
Send an amount of data in DMA mode. | |
HAL_StatusTypeDef | HAL_USART_Receive_DMA (USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size) |
Receive an amount of data in DMA mode. | |
HAL_StatusTypeDef | HAL_USART_TransmitReceive_DMA (USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size) |
Full-Duplex Transmit Receive an amount of data in non-blocking mode. | |
HAL_StatusTypeDef | HAL_USART_DMAPause (USART_HandleTypeDef *husart) |
Pause the DMA Transfer. | |
HAL_StatusTypeDef | HAL_USART_DMAResume (USART_HandleTypeDef *husart) |
Resume the DMA Transfer. | |
HAL_StatusTypeDef | HAL_USART_DMAStop (USART_HandleTypeDef *husart) |
Stop the DMA Transfer. | |
void | HAL_USART_IRQHandler (USART_HandleTypeDef *husart) |
Handle USART interrupt request. | |
__weak void | HAL_USART_TxCpltCallback (USART_HandleTypeDef *husart) |
Tx Transfer completed callback. | |
__weak void | HAL_USART_TxHalfCpltCallback (USART_HandleTypeDef *husart) |
Tx Half Transfer completed callback. | |
__weak void | HAL_USART_RxCpltCallback (USART_HandleTypeDef *husart) |
Rx Transfer completed callback. | |
__weak void | HAL_USART_RxHalfCpltCallback (USART_HandleTypeDef *husart) |
Rx Half Transfer completed callback. | |
__weak void | HAL_USART_TxRxCpltCallback (USART_HandleTypeDef *husart) |
Tx/Rx Transfers completed callback for the non-blocking process. | |
__weak void | HAL_USART_ErrorCallback (USART_HandleTypeDef *husart) |
USART error callback. |
Detailed Description
USART Transmit and Receive functions.
=============================================================================== ##### IO operation functions ##### =============================================================================== [..] This subsection provides a set of functions allowing to manage the USART synchronous data transfers. [..] The USART supports master mode only: it cannot receive or send data related to an input clock (SCLK is always an output). (#) There are two modes of transfer: (++) Blocking mode: The communication is performed in polling mode. The HAL status of all data processing is returned by the same function after finishing transfer. (++) No-Blocking mode: The communication is performed using Interrupts or DMA, These API's return the HAL status. The end of the data processing will be indicated through the dedicated USART IRQ when using Interrupt mode or the DMA IRQ when using DMA mode. The HAL_USART_TxCpltCallback(), HAL_USART_RxCpltCallback() and HAL_USART_TxRxCpltCallback() user callbacks will be executed respectively at the end of the transmit or Receive process The HAL_USART_ErrorCallback()user callback will be executed when a communication error is detected (#) Blocking mode API's are : (++) HAL_USART_Transmit()in simplex mode (++) HAL_USART_Receive() in full duplex receive only (++) HAL_USART_TransmitReceive() in full duplex mode (#) Non-Blocking mode API's with Interrupt are : (++) HAL_USART_Transmit_IT()in simplex mode (++) HAL_USART_Receive_IT() in full duplex receive only (++) HAL_USART_TransmitReceive_IT()in full duplex mode (++) HAL_USART_IRQHandler() (#) No-Blocking mode API's with DMA are : (++) HAL_USART_Transmit_DMA()in simplex mode (++) HAL_USART_Receive_DMA() in full duplex receive only (++) HAL_USART_TransmitReceive_DMA() in full duplex mode (++) HAL_USART_DMAPause() (++) HAL_USART_DMAResume() (++) HAL_USART_DMAStop() (#) A set of Transfer Complete Callbacks are provided in Non_Blocking mode: (++) HAL_USART_TxCpltCallback() (++) HAL_USART_RxCpltCallback() (++) HAL_USART_TxHalfCpltCallback() (++) HAL_USART_RxHalfCpltCallback() (++) HAL_USART_ErrorCallback() (++) HAL_USART_TxRxCpltCallback() (#) In Non-Blocking mode transfers, possible errors are split into 2 categories. Errors are handled as follows : (+) Error is considered as Recoverable and non blocking : Transfer could go till end, but error severity is to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error in Interrupt mode reception . Received character is then retrieved and stored in Rx buffer, Error code is set to allow user to identify error type, and HAL_USART_ErrorCallback() user callback is executed. Transfer is kept ongoing on USART side. (+) Error is considered as Blocking : Transfer could not be completed properly and is aborted. This concerns Overrun Error In Interrupt mode reception and all errors in DMA mode. Error code is set to allow user to identify error type, and HAL_USART_ErrorCallback() user callback is executed.
Function Documentation
HAL_StatusTypeDef HAL_USART_DMAPause | ( | USART_HandleTypeDef * | husart ) |
Pause the DMA Transfer.
- Parameters:
-
husart USART handle.
- Return values:
-
HAL status
Definition at line 1016 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_DMAResume | ( | USART_HandleTypeDef * | husart ) |
Resume the DMA Transfer.
- Parameters:
-
husart USART handle.
- Return values:
-
HAL status
Definition at line 1057 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_DMAStop | ( | USART_HandleTypeDef * | husart ) |
Stop the DMA Transfer.
- Parameters:
-
husart USART handle.
- Return values:
-
HAL status
Definition at line 1095 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_ErrorCallback | ( | USART_HandleTypeDef * | husart ) |
USART error callback.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1377 of file stm32l4xx_hal_usart.c.
void HAL_USART_IRQHandler | ( | USART_HandleTypeDef * | husart ) |
Handle USART interrupt request.
- Parameters:
-
husart USART handle.
- Return values:
-
None
Definition at line 1130 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Receive | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pRxData, | ||
uint16_t | Size, | ||
uint32_t | Timeout | ||
) |
Receive an amount of data in blocking mode.
- Note:
- To receive synchronous data, dummy data are simultaneously transmitted.
- Parameters:
-
husart USART handle. pRxData Pointer to data buffer. Size Amount of data to be received. Timeout Timeout duration.
- Return values:
-
HAL status
Definition at line 464 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Receive_DMA | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pRxData, | ||
uint16_t | Size | ||
) |
Receive an amount of data in DMA mode.
- Parameters:
-
husart USART handle. pRxData pointer to data buffer. Size amount of data to be received.
- Note:
- When the USART parity is enabled (PCE = 1), the received data contain the parity bit (MSB position).
- The USART DMA transmit channel must be configured in order to generate the clock for the slave.
- Return values:
-
HAL status
Definition at line 856 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Receive_IT | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pRxData, | ||
uint16_t | Size | ||
) |
Receive an amount of data in blocking mode.
- Note:
- To receive synchronous data, dummy data are simultaneously transmitted.
- Parameters:
-
husart USART handle. pRxData pointer to data buffer. Size amount of data to be received.
- Return values:
-
HAL status
Definition at line 687 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_RxCpltCallback | ( | USART_HandleTypeDef * | husart ) |
Rx Transfer completed callback.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1332 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_RxHalfCpltCallback | ( | USART_HandleTypeDef * | husart ) |
Rx Half Transfer completed callback.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1347 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Transmit | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint16_t | Size, | ||
uint32_t | Timeout | ||
) |
Simplex send an amount of data in blocking mode.
- Parameters:
-
husart USART handle. pTxData Pointer to data buffer. Size Amount of data to be sent. Timeout Timeout duration.
- Return values:
-
HAL status
Definition at line 392 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Transmit_DMA | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint16_t | Size | ||
) |
Send an amount of data in DMA mode.
- Parameters:
-
husart USART handle. pTxData pointer to data buffer. Size amount of data to be sent.
- Return values:
-
HAL status
Definition at line 795 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_Transmit_IT | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint16_t | Size | ||
) |
Send an amount of data in interrupt mode.
- Parameters:
-
husart USART handle. pTxData pointer to data buffer. Size amount of data to be sent.
- Return values:
-
HAL status
Definition at line 640 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_TransmitReceive | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint8_t * | pRxData, | ||
uint16_t | Size, | ||
uint32_t | Timeout | ||
) |
Full-Duplex Send and Receive an amount of data in blocking mode.
- Parameters:
-
husart USART handle. pTxData pointer to TX data buffer. pRxData pointer to RX data buffer. Size amount of data to be sent (same amount to be received). Timeout Timeout duration.
- Return values:
-
HAL status
Definition at line 549 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint8_t * | pRxData, | ||
uint16_t | Size | ||
) |
Full-Duplex Transmit Receive an amount of data in non-blocking mode.
- Parameters:
-
husart USART handle. pTxData pointer to TX data buffer. pRxData pointer to RX data buffer. Size amount of data to be received/sent.
- Note:
- When the USART parity is enabled (PCE = 1) the data received contain the parity bit.
- Return values:
-
HAL status
Definition at line 936 of file stm32l4xx_hal_usart.c.
HAL_StatusTypeDef HAL_USART_TransmitReceive_IT | ( | USART_HandleTypeDef * | husart, |
uint8_t * | pTxData, | ||
uint8_t * | pRxData, | ||
uint16_t | Size | ||
) |
Full-Duplex Send and Receive an amount of data in interrupt mode.
- Parameters:
-
husart USART handle. pTxData pointer to TX data buffer. pRxData pointer to RX data buffer. Size amount of data to be sent (same amount to be received).
- Return values:
-
HAL status
Definition at line 743 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_TxCpltCallback | ( | USART_HandleTypeDef * | husart ) |
Tx Transfer completed callback.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1302 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_TxHalfCpltCallback | ( | USART_HandleTypeDef * | husart ) |
Tx Half Transfer completed callback.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1317 of file stm32l4xx_hal_usart.c.
__weak void HAL_USART_TxRxCpltCallback | ( | USART_HandleTypeDef * | husart ) |
Tx/Rx Transfers completed callback for the non-blocking process.
- Parameters:
-
husart,: USART handle.
- Return values:
-
None
Definition at line 1362 of file stm32l4xx_hal_usart.c.
Generated on Tue Jul 12 2022 17:38:55 by
