2.123 Universal Asynchronous Receiver Transmitter (UART)

This Plib implements software abstraction for UART Peripheral.

Library Interface

UART peripheral library provides the following interfaces:

Functions

NameDescriptionBlocking modeNon-blocking modeRing buffer mode
UARTx_InitializeInitializes given instance of the UART peripheralYesYesYes
UARTx_SerialSetupSets up serial configurations for UART peripheralYesYesYes
UARTx_WriteWrites data to the given UART peripheral instanceYesYesYes
UARTx_ReadReads data from the given UART peripheral instanceYesYesYes
UARTx_WriteIsBusyReturns the write request status associated with the given UART peripheral instanceNoYesNo
UARTx_ReadIsBusyReturns the read request status associated with the given UART peripheral instanceNoYesNo
UARTx_WriteCountGetGets the byte count of processed bytes for a given UART read operation in non-blocking mode. Returns the number of bytes pending to be transmitted out in the transmit buffer in ring buffer mode.NoYesYes
UARTx_ReadCountGetGets the byte count of processed bytes for a given UART read operation in non-blocking mode. Returns the number of bytes available in the internal receive buffer of the PLIB in ring buffer mode.NoYesYes
UARTx_TransmitterIsReadyReturns the hardware status of the UART TransmitterYesNoNo
UARTx_ReceiverIsReadyReturns the hardware status of the UART ReceiverYesNoNo
UARTx_ErrorGetGets the error of the given UART peripheral instanceYesYesYes
UARTx_WriteCallbackRegisterSets the pointer to the function (and it's context) to be called when the given UART's write events occurNoYesYes
UARTx_ReadCallbackRegisterSets the pointer to the function (and it's context) to be called when the given UART's read events occurNoYesYes
UARTx_ReadByteSubmits request to read a byte of data to the given UART peripheralYesNoNo
UARTx_WriteByteSubmits a byte of data to the given UART peripheral to transferYesNoNo
UARTx_ReadAbortAborts the ongoing read requestNoYesNo
UARTx_WriteFreeBufferCountGetReturns the number of bytes of free space available in the internal transmit bufferNoNoYes
UARTx_WriteBufferSizeGetReturns the size of the internal transmit ring bufferNoNoYes
UARTx_WriteNotificationEnableThis API lets the application turn the transmit notifications on/offNoNoYes
UARTx_WriteThresholdSetThis API allows the application to set a threshold level on the number of free space available in the transmit bufferNoNoYes
UARTx_ReadFreeBufferCountGetReturns the number of bytes of free space available in the internal receive bufferNoNoYes
UARTx_ReadBufferSizeGetReturns the size of the receive ring bufferNoNoYes
UARTx_ReadNotificationEnableThis API lets the application turn the receive notifications on/offNoNoYes
UARTx_ReadThresholdSetThis API allows the application to set a threshold level on the number of bytes of data available in the receive bufferNoNoYes
UARTx_AutoBaudQueryReturns the status of auto-baud operationYesYesYes
UARTx_AutoBaudQueryReturns the status of auto-baud operationYesYesYes
UARTx_AutoBaudSetEnables the auto-baud detectionYesYesYes
UARTx_AutoBaudSetEnables the auto-baud detectionYesYesYes

Data types and constants

NameTypeDescriptionBlocking modeNon-blocking modeRing buffer mode
UART_ERRORMacros and TypedefDefines the macros and typedefs associated with the UART peripheral errorsYesYesYes
UART_DATAEnumDefines the data width types for the UART peripheralYesYesYes
UART_PARITYEnumDefines the parity types for the UART peripheralYesYesYes
UART_STOPEnumDefines the data type for the UART peripheral stop bitsYesYesYes
UART_SERIAL_SETUPStructDefines the data structure which is used to configure UART serial parameters at run timeYesYesYes
UART_CALLBACKTypedefDefines the data type and function signature of the UART peripheral library callback functionYesYesNo
UART_EVENTEnumDefines the enums associated with the UART events in the ring buffer modeYesYesYes
UART_RING_BUFFER_CALLBACKTypedefDefines the data type and function signature for the UART peripheral callback function in the ring buffer modeNoNoYes
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.