Quickstart
Informative
The shortest path to a working UART channel: initialize, transmit a buffer, and receive one. Binding rules are in Uart — Requirements; signatures in API Reference.
Bring the driver up
Uart_Init(NULL_PTR); /* driver: UNINIT -> INIT; every channel TX/RX -> IDLE */
Transmit a buffer
static const uint8 msg[5] = { 'H', 'e', 'l', 'l', 'o' };
Std_ReturnType r = Uart_StartTxTransaction(0u, msg, 5u); /* channel 0 */
/* keep msg valid until the completion / streaming callout fires */
Handle transmit completion
/* for an HwCompletion channel: */
void Uart_Callout_OnTransmission(uint8 channelId, uint16 length)
{
/* all `length` bytes have left the UART bus */
}
Receive into a buffer
static uint8 rxBuf[16];
/* start reception; notify only when the buffer is full (no mid-transfer trigger) */
Uart_StartRxTransaction(0u, rxBuf, 16u, 0u);
void Uart_Callout_OnReception(uint8 channelId, uint16 length)
{
/* `length` bytes received; call Uart_StartRxTransaction again to keep receiving */
}
Uart_Interrupt (or Uart_PollFunction) drives both flows and fires the callouts. For the
streaming transmit style and chunked reception, see Transmit and Receive.