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
Name | Description | Blocking mode | Non-blocking mode | Ring buffer mode |
---|---|---|---|---|
UARTx_Initialize | Initializes given instance of the UART peripheral | Yes | Yes | Yes |
UARTx_SerialSetup | Sets up serial configurations for UART peripheral | Yes | Yes | Yes |
UARTx_Write | Writes data to the given UART peripheral instance | Yes | Yes | Yes |
UARTx_Read | Reads data from the given UART peripheral instance | Yes | Yes | Yes |
UARTx_WriteIsBusy | Returns the write request status associated with the given UART peripheral instance | No | Yes | No |
UARTx_ReadIsBusy | Returns the read request status associated with the given UART peripheral instance | No | Yes | No |
UARTx_WriteCountGet | Gets 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. | No | Yes | Yes |
UARTx_ReadCountGet | Gets 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. | No | Yes | Yes |
UARTx_TransmitterIsReady | Returns the hardware status of the UART Transmitter | Yes | No | No |
UARTx_ReceiverIsReady | Returns the hardware status of the UART Receiver | Yes | No | No |
UARTx_ErrorGet | Gets the error of the given UART peripheral instance | Yes | Yes | Yes |
UARTx_WriteCallbackRegister | Sets the pointer to the function (and it's context) to be called when the given UART's write events occur | No | Yes | Yes |
UARTx_ReadCallbackRegister | Sets the pointer to the function (and it's context) to be called when the given UART's read events occur | No | Yes | Yes |
UARTx_ReadByte | Submits request to read a byte of data to the given UART peripheral | Yes | No | No |
UARTx_WriteByte | Submits a byte of data to the given UART peripheral to transfer | Yes | No | No |
UARTx_ReadAbort | Aborts the ongoing read request | No | Yes | No |
UARTx_WriteFreeBufferCountGet | Returns the number of bytes of free space available in the internal transmit buffer | No | No | Yes |
UARTx_WriteBufferSizeGet | Returns the size of the internal transmit ring buffer | No | No | Yes |
UARTx_WriteNotificationEnable | This API lets the application turn the transmit notifications on/off | No | No | Yes |
UARTx_WriteThresholdSet | This API allows the application to set a threshold level on the number of free space available in the transmit buffer | No | No | Yes |
UARTx_ReadFreeBufferCountGet | Returns the number of bytes of free space available in the internal receive buffer | No | No | Yes |
UARTx_ReadBufferSizeGet | Returns the size of the receive ring buffer | No | No | Yes |
UARTx_ReadNotificationEnable | This API lets the application turn the receive notifications on/off | No | No | Yes |
UARTx_ReadThresholdSet | This API allows the application to set a threshold level on the number of bytes of data available in the receive buffer | No | No | Yes |
UARTx_AutoBaudQuery | Returns the status of auto-baud operation | Yes | Yes | Yes |
UARTx_AutoBaudQuery | Returns the status of auto-baud operation | Yes | Yes | Yes |
UARTx_AutoBaudSet | Enables the auto-baud detection | Yes | Yes | Yes |
UARTx_AutoBaudSet | Enables the auto-baud detection | Yes | Yes | Yes |
Data types and constants
Name | Type | Description | Blocking mode | Non-blocking mode | Ring buffer mode |
---|---|---|---|---|---|
UART_ERROR | Macros and Typedef | Defines the macros and typedefs associated with the UART peripheral errors | Yes | Yes | Yes |
UART_DATA | Enum | Defines the data width types for the UART peripheral | Yes | Yes | Yes |
UART_PARITY | Enum | Defines the parity types for the UART peripheral | Yes | Yes | Yes |
UART_STOP | Enum | Defines the data type for the UART peripheral stop bits | Yes | Yes | Yes |
UART_SERIAL_SETUP | Struct | Defines the data structure which is used to configure UART serial parameters at run time | Yes | Yes | Yes |
UART_CALLBACK | Typedef | Defines the data type and function signature of the UART peripheral library callback function | Yes | Yes | No |
UART_EVENT | Enum | Defines the enums associated with the UART events in the ring buffer mode | Yes | Yes | Yes |
UART_RING_BUFFER_CALLBACK | Typedef | Defines the data type and function signature for the UART peripheral callback function in the ring buffer mode | No | No | Yes |
Note: Not all APIs maybe implemented. See the specific device family
section for available APIs.