3.26.1 UART
Universal Asynchronous Receiver Transmitter
3.26.1.1 Introduction
The Universal Asynchronous Receiver Transmitter (UART) -capable peripherals come in different variants on microcontrollers. Sometimes, the peripheral is named UART or USART and sometimes it is called EUSART (Enhanced Universal Synchronous Asynchronous Receiver Transmitter) to emphasize enhanced functionalities. The data sheet of each device shows the type of UART peripheral it has.
3.26.1.2 Supported Device Families
PIC18F-K42 | PIC18F-K83 | PIC18F-Q20 |
PIC18F-Q24 | PIC18F-Q71 | PIC18F-Q83 |
PIC18F-Q84 |
3.26.1.3 Required header files:
#include "mcc_generated_files/uart/uart.h"
3.26.1.4 How to use the UART PLIB Driver
For use-cases for the UART, see: How to use the UART Driver.
The examples there use the portable API interface of the driver, but could easily be modified to directly us the PLIB API.
3.26.1.5 Module Documentation
3.26.1.5.1 UART1
This file contains API prototypes and other data types for the UART1 module.
Module description
This file contains API prototypes and other data types for the UART1 module.
Data structures
struct uart1_status_t
This is an instance of UART1_STATUS for UART1 module.
Functions
void UART1_Initialize (void)
Initializes the UART1 module. This routine is called only once during system initialization, before calling other APIs.
void UART1_Deinitialize (void)
Deinitializes and disables the UART1 module.
void UART1_Enable (void)
Enables the UART1 module.
void UART1_Disable (void)
Disables the UART1 module.
void UART1_TransmitEnable (void)
Enables the UART1 transmitter. This routine also enables UART1 to send bytes over the TX pin.
void UART1_TransmitDisable (void)
Disables the UART1 transmitter.
void UART1_ReceiveEnable (void)
Enables the UART1 receiver. This routine also enables UART1 to send bytes over the RX pin.
void UART1_ReceiveDisable (void)
Disables the UART1 receiver.
void UART1_SendBreakControlEnable (void)
Enables the UART1 Send Break Control bit.
void UART1_SendBreakControlDisable (void)
Disables the UART1 Send Break Control bit.
void UART1_TransmitInterruptEnable (void)
Enables the UART1 transmitter interrupt.
void UART1_TransmitInterruptDisable (void)
Disables the UART1 transmitter interrupt.
void UART1_ReceiveInterruptEnable (void)
Enables the UART1 receiver interrupt.
void UART1_ReceiveInterruptDisable (void)
Disables the UART1 receiver interrupt.
void UART1_AutoBaudSet (bool enable)
Enables the UART1 Auto-Baud Detection bit.
bool UART1_AutoBaudQuery (void)
Reads the UART1 Auto-Baud Detection Complete bit.
void UART1_AutoBaudDetectCompleteReset (void)
Resets the UART1 Auto-Baud Detection Complete bit.
bool UART1_IsAutoBaudDetectOverflow (void)
Reads the UART1 Auto-Baud Detection Overflow bit.
void UART1_AutoBaudDetectOverflowReset (void)
Resets the UART1 Auto-Baud Detection Overflow bit.
void UART1_ErrorInterruptEnable (void)
Enables the UART1 Error Interrupt bit.
void UART1_ErrorInterruptDisable (void)
Disables the UART1 Error Interrupt bit.
void UART1_GeneralInterruptEnable (void)
Enables the UART1 Interrupt.
void UART1_GeneralInterruptDisable (void)
Disables the UART1 Interrupt.
bool UART1_IsRxReady (void)
Checks if the UART1 receiver has received data and is ready to be read.
bool UART1_IsTxReady (void)
Checks if the UART1 transmitter is ready to accept a data byte.
bool UART1_IsTxDone (void)
Returns the status of the Transmit Shift Register (TSR).
size_t UART1_ErrorGet (void)
Gets the error status of the last read byte. Call this function before calling UART1_Read().
uint8_t UART1_Read (void)
Reads the eight bits from the Receiver FIFO register.
void UART1_Write (uint8_t txData)
Writes a byte of data to the Transmitter FIFO register.
void UART1_FramingErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 framing error.
void UART1_OverrunErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 overrun error.
void UART1_ParityErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 parity error.
void UART1_TxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the transmitter interrupt occurs.
void UART1_TransmitISR (void)
Implements the Interrupt Service Routine (ISR) for the UART1 transmitter interrupt.
void UART1_RxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the receiver interrupt occurs.
void UART1_ReceiveISR (void)
Implements the ISR for the UART1 receiver interrupt.
void UART1_ErrorCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon Error interrupt.
void UART1_ErrorISR (void)
This function is a ISR function to be called upon Error interrupt.
void UART1_GeneralInterruptCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon general interrupt.
void UART1_GeneralISR (void)
This function is a ISR function to be called upon general interrupt.
Variables
const uart_drv_interface_t UART1
External object for uart_drv_interface.
void(* UART1_TxInterruptHandler )(void)
Pointer to the function called when the transmitter interrupt occurs.
void(* UART1_RxInterruptHandler )(void)
Pointer to the function called when the receiver interrupt occurs.
void(* UART1_ErrorInterruptHandler )(void)
This is a pointer to the function that will be called upon error interrupt.
void(* UART1_GeneralInterruptHandler )(void)
This is a pointer to the function that will be called upon general interrupt.
Function Documentation
UART1_AutoBaudDetectCompleteReset()
void UART1_AutoBaudDetectCompleteReset (void )[inline]
Resets the UART1 Auto-Baud Detection Complete bit.
None. |
None. |
UART1_AutoBaudDetectOverflowReset()
void UART1_AutoBaudDetectOverflowReset (void )[inline]
Resets the UART1 Auto-Baud Detection Overflow bit.
None. |
None. |
UART1_AutoBaudQuery()
bool UART1_AutoBaudQuery (void )[inline]
Reads the UART1 Auto-Baud Detection Complete bit.
None. |
None. |
UART1_AutoBaudSet()
void UART1_AutoBaudSet (bool enable)[inline]
Enables the UART1 Auto-Baud Detection bit.
bool |
enable |
None. |
UART1_Deinitialize()
void UART1_Deinitialize (void )
Deinitializes and disables the UART1 module.
None. |
None. |
UART1_Disable()
void UART1_Disable (void )[inline]
Disables the UART1 module.
None. |
None. |
UART1_Enable()
void UART1_Enable (void )[inline]
Enables the UART1 module.
None. |
None. |
UART1_ErrorCallbackRegister()
void UART1_ErrorCallbackRegister (void(*)(void) callbackHandler)
This API registers the function to be called upon Error interrupt.
callbackHandler |
- a function pointer which will be called upon Error interrupt condition. |
None. |
UART1_ErrorGet()
size_t UART1_ErrorGet (void )
Gets the error status of the last read byte. Call this function before calling UART1_Read().
Call UART1_RxEnable() to enable RX before calling this API. |
None. |
Status of the last read byte. See the uart1_status_t struct for more details. |
UART1_ErrorInterruptDisable()
void UART1_ErrorInterruptDisable (void )[inline]
Disables the UART1 Error Interrupt bit.
None. |
None. |
UART1_ErrorInterruptEnable()
void UART1_ErrorInterruptEnable (void )[inline]
Enables the UART1 Error Interrupt bit.
None. |
None. |
UART1_ErrorISR()
void UART1_ErrorISR (void )
This function is a ISR function to be called upon Error interrupt.
None. |
None. |
UART1_FramingErrorCallbackRegister()
void UART1_FramingErrorCallbackRegister (void(*)(void) callbackHandler)
Calls the function upon UART1 framing error.
callbackHandler |
- Function pointer called when the framing error condition occurs |
None. |
UART1_GeneralInterruptCallbackRegister()
void UART1_GeneralInterruptCallbackRegister (void(*)(void) callbackHandler)
This API registers the function to be called upon general interrupt.
callbackHandler |
- a function pointer which will be called upon general interrupt condition. |
None. |
UART1_GeneralInterruptDisable()
void UART1_GeneralInterruptDisable (void )[inline]
Disables the UART1 Interrupt.
None. |
None. |
UART1_GeneralInterruptEnable()
void UART1_GeneralInterruptEnable (void )[inline]
Enables the UART1 Interrupt.
None. |
None. |
UART1_GeneralISR()
void UART1_GeneralISR (void )
This function is a ISR function to be called upon general interrupt.
void. |
None. |
UART1_Initialize()
void UART1_Initialize (void )
Initializes the UART1 module. This routine is called only once during system initialization, before calling other APIs.
None. |
None. |
Section: UART1 APIs
UART1_IsAutoBaudDetectOverflow()
bool UART1_IsAutoBaudDetectOverflow (void )[inline]
Reads the UART1 Auto-Baud Detection Overflow bit.
None. |
None. |
UART1_IsRxReady()
bool UART1_IsRxReady (void )
Checks if the UART1 receiver has received data and is ready to be read.
None. |
True |
- UART1 receiver FIFO has data |
False |
- UART1 receiver FIFO is empty |
UART1_IsTxDone()
bool UART1_IsTxDone (void )
Returns the status of the Transmit Shift Register (TSR).
None. |
True |
- Data completely shifted out from the TSR |
False |
- Data is present in Transmit FIFO and/or in TSR |
UART1_IsTxReady()
bool UART1_IsTxReady (void )
Checks if the UART1 transmitter is ready to accept a data byte.
None. |
True |
- The UART1 transmitter FIFO has at least a one byte space |
False |
- The UART1 transmitter FIFO is full |
UART1_OverrunErrorCallbackRegister()
void UART1_OverrunErrorCallbackRegister (void(*)(void) callbackHandler)
Calls the function upon UART1 overrun error.
callbackHandler |
- Function pointer called when the overrun error condition occurs |
None. |
UART1_ParityErrorCallbackRegister()
void UART1_ParityErrorCallbackRegister (void(*)(void) callbackHandler)
Calls the function upon UART1 parity error.
callbackHandler |
- Function pointer called when the parity error condition occurs |
None. |
UART1_Read()
uint8_t UART1_Read (void )
Reads the eight bits from the Receiver FIFO register.
Check the transfer status to see if the receiver is not empty before calling this function. Check UART1_IsRxReady() in if () before calling this API. |
None. |
8-bit data from the RX FIFO register |
UART1_ReceiveDisable()
void UART1_ReceiveDisable (void )[inline]
Disables the UART1 receiver.
None. |
None. |
UART1_ReceiveEnable()
void UART1_ReceiveEnable (void )[inline]
Enables the UART1 receiver. This routine also enables UART1 to send bytes over the RX pin.
None. |
None. |
UART1_ReceiveInterruptDisable()
void UART1_ReceiveInterruptDisable (void )[inline]
Disables the UART1 receiver interrupt.
None. |
None. |
UART1_ReceiveInterruptEnable()
void UART1_ReceiveInterruptEnable (void )[inline]
Enables the UART1 receiver interrupt.
None. |
None. |
UART1_ReceiveISR()
void UART1_ReceiveISR (void )
Implements the ISR for the UART1 receiver interrupt.
void. |
None. |
UART1_RxCompleteCallbackRegister()
void UART1_RxCompleteCallbackRegister (void(*)(void) callbackHandler)
Registers the function to be called when the receiver interrupt occurs.
callbackHandler |
- Function pointer called when the receiver interrupt condition occurs |
None. |
UART1_SendBreakControlDisable()
void UART1_SendBreakControlDisable (void )[inline]
Disables the UART1 Send Break Control bit.
None. |
None. |
UART1_SendBreakControlEnable()
void UART1_SendBreakControlEnable (void )[inline]
Enables the UART1 Send Break Control bit.
None. |
None. |
UART1_TransmitDisable()
void UART1_TransmitDisable (void )[inline]
Disables the UART1 transmitter.
None. |
None. |
UART1_TransmitEnable()
void UART1_TransmitEnable (void )[inline]
Enables the UART1 transmitter. This routine also enables UART1 to send bytes over the TX pin.
None. |
None. |
UART1_TransmitInterruptDisable()
void UART1_TransmitInterruptDisable (void )[inline]
Disables the UART1 transmitter interrupt.
None. |
None. |
UART1_TransmitInterruptEnable()
void UART1_TransmitInterruptEnable (void )[inline]
Enables the UART1 transmitter interrupt.
None. |
None. |
UART1_TransmitISR()
void UART1_TransmitISR (void )
Implements the Interrupt Service Routine (ISR) for the UART1 transmitter interrupt.
None. |
None. |
UART1_TxCompleteCallbackRegister()
void UART1_TxCompleteCallbackRegister (void(*)(void) callbackHandler)
Registers the function to be called when the transmitter interrupt occurs.
callbackHandler |
- Function pointer called when the transmitter interrupt condition occurs |
None. |
UART1_Write()
void UART1_Write (uint8_t txData)
Writes a byte of data to the Transmitter FIFO register.
Check the transfer status to see if the transmitter is not empty before calling this function. Check UART1_IsTxReady() in if () before calling this API. |
txData |
- Data byte to write to the TX FIFO |
None. |
Variable Documentation
UART1
const uart_drv_interface_t UART1
External object for uart_drv_interface.
Section: Driver Interface
UART1_ErrorInterruptHandler
void(* UART1_ErrorInterruptHandler) (void)
This is a pointer to the function that will be called upon error interrupt.
Initialize the UART1 module with error interrupt enabled |
None. |
None. |
UART1_GeneralInterruptHandler
void(* UART1_GeneralInterruptHandler) (void)
This is a pointer to the function that will be called upon general interrupt.
Initialize the UART1 module with general interrupt enabled |
None. |
None. |
UART1_RxInterruptHandler
void(* UART1_RxInterruptHandler) (void)
Pointer to the function called when the receiver interrupt occurs.
Initialize the UART1 module with the receive interrupt enabled. |
None. |
None. |
UART1_TxInterruptHandler
void(* UART1_TxInterruptHandler) (void)
Pointer to the function called when the transmitter interrupt occurs.
Initialize the UART1 module with the transmit interrupt enabled. |
None. |
None. |
3.26.1.5.2 UART_DRV_INTERFACE
This file contains API prototypes and data types of the Universal Asynchronous Receiver and Transmitter (UART) interface.
This file contains API prototypes and data types of the Universal Asynchronous Receiver and Transmitter (UART) interface.
3.26.1.5.3 UART_TYPES
This file contains the enumeration of different Universal Asynchronous Receiver and Transmitter (UART) baud rates.
This file contains the enumeration of different Universal Asynchronous Receiver and Transmitter (UART) baud rates.
3.26.1.6 Data Structure Documentation
3.26.1.6.1 uart1_status_t Struct Reference
This is an instance of UART1_STATUS for UART1 module.
Detailed Description
This is an instance of UART1_STATUS for UART1 module.
#include <uart1.h>
Data Fields
Field Documentation
@1
struct { ... }
ferr
uint8_t ferr
This is a bit field for Framing Error status
oerr
uint8_t oerr
This is a bit field for Overfrun Error status
perr
uint8_t perr
This is a bit field for Parity Error status
reserved
uint8_t reserved
Reserved
status
size_t status
Group byte for status errors
3.26.1.6.2 uart_drv_interface_t Struct Reference
Structure containing the function pointers of UART driver.
Detailed Description
Structure containing the function pointers of UART driver.
Section: Included Files
#include <uart_drv_interface.h>
Data Fields
void(* Initialize )(void)
void(* Deinitialize )(void)
uint8_t(* Read )(void)
void(* Write )(uint8_t)
bool(* IsRxReady )(void)
bool(* IsTxReady )(void)
bool(* IsTxDone )(void)
void(* TransmitEnable )(void)
void(* TransmitDisable )(void)
void(* AutoBaudSet )(bool enable)
bool(* AutoBaudQuery )(void)
bool(* AutoBaudEventEnableGet )(void)
void(* BRGCountSet )(uint32_t brgValue)
uint32_t(* BRGCountGet )(void)
void(* BaudRateSet )(uint32_t baudRate)
uint32_t(* BaudRateGet )(void)
size_t(* ErrorGet )(void)
void(* TxCompleteCallbackRegister )(void(*CallbackHandler)(void))
void(* RxCompleteCallbackRegister )(void(*CallbackHandler)(void))
void(* TxCollisionCallbackRegister )(void(*CallbackHandler)(void))
void(* FramingErrorCallbackRegister )(void(*CallbackHandler)(void))
void(* OverrunErrorCallbackRegister )(void(*CallbackHandler)(void))
void(* ParityErrorCallbackRegister )(void(*CallbackHandler)(void))
void(* EventCallbackRegister )(void(*CallbackHandler)(void))
Field Documentation
The documentation for this struct was generated from the following file:
source/
AutoBaudEventEnableGet
bool(* AutoBaudEventEnableGet) (void)
AutoBaudQuery
bool(* AutoBaudQuery) (void)
AutoBaudSet
void(* AutoBaudSet) (bool enable)
BaudRateGet
uint32_t(* BaudRateGet) (void)
BaudRateSet
void(* BaudRateSet) (uint32_t baudRate)
BRGCountGet
uint32_t(* BRGCountGet) (void)
BRGCountSet
void(* BRGCountSet) (uint32_t brgValue)
Deinitialize
void(* Deinitialize) (void)
ErrorGet
size_t(* ErrorGet) (void)
EventCallbackRegister
void(* EventCallbackRegister) (void(*CallbackHandler)(void))
FramingErrorCallbackRegister
void(* FramingErrorCallbackRegister) (void(*CallbackHandler)(void))
Initialize
void(* Initialize) (void)
IsRxReady
bool(* IsRxReady) (void)
IsTxDone
bool(* IsTxDone) (void)
IsTxReady
bool(* IsTxReady) (void)
OverrunErrorCallbackRegister
void(* OverrunErrorCallbackRegister) (void(*CallbackHandler)(void))
ParityErrorCallbackRegister
void(* ParityErrorCallbackRegister) (void(*CallbackHandler)(void))
Read
uint8_t(* Read) (void)
RxCompleteCallbackRegister
void(* RxCompleteCallbackRegister) (void(*CallbackHandler)(void))
TransmitDisable
void(* TransmitDisable) (void)
TransmitEnable
void(* TransmitEnable) (void)
TxCollisionCallbackRegister
void(* TxCollisionCallbackRegister) (void(*CallbackHandler)(void))
TxCompleteCallbackRegister
void(* TxCompleteCallbackRegister) (void(*CallbackHandler)(void))
Write
void(* Write) (uint8_t)
3.26.1.7 File Documentation
3.26.1.7.1 source/uart1.c File Reference
This is the generated driver implementation file for the UART1 driver using Configurable Custom Logic (CCL).
#include "../uart1.h"
Functions
static void UART1_DefaultFramingErrorCallback (void)
static void UART1_DefaultOverrunErrorCallback (void)
static void UART1_DefaultParityErrorCallback (void)
void UART1_TransmitISR (void)
Implements the Interrupt Service Routine (ISR) for the UART1 transmitter interrupt.
void UART1_ReceiveISR (void)
Implements the ISR for the UART1 receiver interrupt.
void UART1_ErrorISR (void)
This function is a ISR function to be called upon Error interrupt.
void UART1_GeneralISR (void)
This function is a ISR function to be called upon general interrupt.
void UART1_Initialize (void)
Initializes the UART1 module. This routine is called only once during system initialization, before calling other APIs.
void UART1_Deinitialize (void)
Deinitializes and disables the UART1 module.
void UART1_Enable (void)
Enables the UART1 module.
void UART1_Disable (void)
Disables the UART1 module.
void UART1_TransmitEnable (void)
Enables the UART1 transmitter. This routine also enables UART1 to send bytes over the TX pin.
void UART1_TransmitDisable (void)
Disables the UART1 transmitter.
void UART1_ReceiveEnable (void)
Enables the UART1 receiver. This routine also enables UART1 to send bytes over the RX pin.
void UART1_ReceiveDisable (void)
Disables the UART1 receiver.
void UART1_SendBreakControlEnable (void)
Enables the UART1 Send Break Control bit.
void UART1_SendBreakControlDisable (void)
Disables the UART1 Send Break Control bit.
void UART1_AutoBaudSet (bool enable)
Enables the UART1 Auto-Baud Detection bit.
bool UART1_AutoBaudQuery (void)
Reads the UART1 Auto-Baud Detection Complete bit.
void UART1_AutoBaudDetectCompleteReset (void)
Resets the UART1 Auto-Baud Detection Complete bit.
bool UART1_IsAutoBaudDetectOverflow (void)
Reads the UART1 Auto-Baud Detection Overflow bit.
void UART1_AutoBaudDetectOverflowReset (void)
Resets the UART1 Auto-Baud Detection Overflow bit.
void UART1_ErrorInterruptEnable (void)
Enables the UART1 Error Interrupt bit.
void UART1_ErrorInterruptDisable (void)
Disables the UART1 Error Interrupt bit.
void UART1_GeneralInterruptEnable (void)
Enables the UART1 Interrupt.
void UART1_GeneralInterruptDisable (void)
Disables the UART1 Interrupt.
void UART1_TransmitInterruptEnable (void)
Enables the UART1 transmitter interrupt.
void UART1_TransmitInterruptDisable (void)
Disables the UART1 transmitter interrupt.
void UART1_ReceiveInterruptEnable (void)
Enables the UART1 receiver interrupt.
void UART1_ReceiveInterruptDisable (void)
Disables the UART1 receiver interrupt.
bool UART1_IsRxReady (void)
Checks if the UART1 receiver has received data and is ready to be read.
bool UART1_IsTxReady (void)
Checks if the UART1 transmitter is ready to accept a data byte.
bool UART1_IsTxDone (void)
Returns the status of the Transmit Shift Register (TSR).
size_t UART1_ErrorGet (void)
Gets the error status of the last read byte. Call this function before calling UART1_Read().
uint8_t UART1_Read (void)
Reads the eight bits from the Receiver FIFO register.
void UART1_Write (uint8_t txData)
Writes a byte of data to the Transmitter FIFO register.
int getch (void)
void putch (char txData)
void UART1_FramingErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 framing error.
void UART1_OverrunErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 overrun error.
void UART1_ParityErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 parity error.
void UART1_ErrorCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon Error interrupt.
void UART1_GeneralInterruptCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon general interrupt.
void UART1_RxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the receiver interrupt occurs.
void UART1_TxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the transmitter interrupt occurs.
Macros
#define UART1_TX_BUFFER_SIZE (8)
#define UART1_TX_BUFFER_MASK (UART1_TX_BUFFER_SIZE - 1)
#define UART1_RX_BUFFER_SIZE (8)
#define UART1_RX_BUFFER_MASK (UART1_RX_BUFFER_SIZE - 1)
Variables
const uart_drv_interface_t UART1
External object for uart_drv_interface.
static volatile uint8_t uart1TxHead = 0
static volatile uint8_t uart1TxTail = 0
static volatile uint8_t uart1TxBuffer [UART1_TX_BUFFER_SIZE]
volatile uint8_t uart1TxBufferRemaining
static volatile uint8_t uart1RxHead = 0
static volatile uint8_t uart1RxTail = 0
static volatile uint8_t uart1RxBuffer [UART1_RX_BUFFER_SIZE]
static volatile uart1_status_t uart1RxStatusBuffer [UART1_RX_BUFFER_SIZE]
volatile uint8_t uart1RxCount
volatile uart1_status_t uart1RxLastError
void(* UART1_FramingErrorHandler )(void)
void(* UART1_OverrunErrorHandler )(void)
void(* UART1_ParityErrorHandler )(void)
void(* UART1_TxInterruptHandler )(void)
static void(* UART1_TxCompleteInterruptHandler )(void)
void(* UART1_RxInterruptHandler )(void)
static void(* UART1_RxCompleteInterruptHandler )(void)
void(* UART1_ErrorInterruptHandler )(void)
static void(* UART1_CommunicationErrorInterruptHandler )(void)
void(* UART1_GeneralInterruptHandler )(void)
static void(* UART1_GeneralErrorInterruptHandler )(void)
Detailed Description
This is the generated driver implementation file for the UART1 driver using Configurable Custom Logic (CCL).
UART1 Generated Driver API Header File
Function Documentation
getch()
int getch (void )
putch()
void putch (char txData)
UART1_DefaultFramingErrorCallback()
static void UART1_DefaultFramingErrorCallback (void )[static]
UART1_DefaultOverrunErrorCallback()
static void UART1_DefaultOverrunErrorCallback (void )[static]
UART1_DefaultParityErrorCallback()
static void UART1_DefaultParityErrorCallback (void )[static]
Macro Definition Documentation
UART1_RX_BUFFER_MASK
#define UART1_RX_BUFFER_MASK (UART1_RX_BUFFER_SIZE - 1)
UART1_RX_BUFFER_SIZE
#define UART1_RX_BUFFER_SIZE (8)
UART1_TX_BUFFER_MASK
#define UART1_TX_BUFFER_MASK (UART1_TX_BUFFER_SIZE - 1)
UART1_TX_BUFFER_SIZE
#define UART1_TX_BUFFER_SIZE (8)
Section: Included Files Section: Macro Declarations
Variable Documentation
UART1_CommunicationErrorInterruptHandler
void(* UART1_CommunicationErrorInterruptHandler) (void)[static]
UART1_ErrorInterruptHandler
void(* UART1_ErrorInterruptHandler) (void)
UART1_FramingErrorHandler
void(* UART1_FramingErrorHandler) (void)
Section: UART1 APIs
UART1_GeneralErrorInterruptHandler
void(* UART1_GeneralErrorInterruptHandler) (void)[static]
UART1_GeneralInterruptHandler
void(* UART1_GeneralInterruptHandler) (void)
UART1_OverrunErrorHandler
void(* UART1_OverrunErrorHandler) (void)
UART1_ParityErrorHandler
void(* UART1_ParityErrorHandler) (void)
UART1_RxCompleteInterruptHandler
void(* UART1_RxCompleteInterruptHandler) (void)[static]
UART1_RxInterruptHandler
void(* UART1_RxInterruptHandler) (void)
UART1_TxCompleteInterruptHandler
void(* UART1_TxCompleteInterruptHandler) (void)[static]
UART1_TxInterruptHandler
void(* UART1_TxInterruptHandler) (void)
uart1RxBuffer
volatile uint8_t uart1RxBuffer[UART1_RX_BUFFER_SIZE][static]
uart1RxCount
volatile uint8_t uart1RxCount
uart1RxHead
volatile uint8_t uart1RxHead = 0[static]
uart1RxLastError
volatile uart1_status_t uart1RxLastError
uart1RxStatusBuffer
volatile uart1_status_t uart1RxStatusBuffer[UART1_RX_BUFFER_SIZE][static]
uart1RxTail
volatile uint8_t uart1RxTail = 0[static]
uart1TxBuffer
volatile uint8_t uart1TxBuffer[UART1_TX_BUFFER_SIZE][static]
uart1TxBufferRemaining
volatile uint8_t uart1TxBufferRemaining
uart1TxHead
volatile uint8_t uart1TxHead = 0[static]
Section: UART1 variables
uart1TxTail
volatile uint8_t uart1TxTail = 0[static]
3.26.1.7.2 source/uart1.h File Reference
#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include "../system/system.h" #include "uart_drv_interface.h"
Data structures
struct uart1_status_t
This is an instance of UART1_STATUS for UART1 module.
Functions
void UART1_Initialize (void)
Initializes the UART1 module. This routine is called only once during system initialization, before calling other APIs.
void UART1_Deinitialize (void)
Deinitializes and disables the UART1 module.
void UART1_Enable (void)
Enables the UART1 module.
void UART1_Disable (void)
Disables the UART1 module.
void UART1_TransmitEnable (void)
Enables the UART1 transmitter. This routine also enables UART1 to send bytes over the TX pin.
void UART1_TransmitDisable (void)
Disables the UART1 transmitter.
void UART1_ReceiveEnable (void)
Enables the UART1 receiver. This routine also enables UART1 to send bytes over the RX pin.
void UART1_ReceiveDisable (void)
Disables the UART1 receiver.
void UART1_SendBreakControlEnable (void)
Enables the UART1 Send Break Control bit.
void UART1_SendBreakControlDisable (void)
Disables the UART1 Send Break Control bit.
void UART1_TransmitInterruptEnable (void)
Enables the UART1 transmitter interrupt.
void UART1_TransmitInterruptDisable (void)
Disables the UART1 transmitter interrupt.
void UART1_ReceiveInterruptEnable (void)
Enables the UART1 receiver interrupt.
void UART1_ReceiveInterruptDisable (void)
Disables the UART1 receiver interrupt.
void UART1_AutoBaudSet (bool enable)
Enables the UART1 Auto-Baud Detection bit.
bool UART1_AutoBaudQuery (void)
Reads the UART1 Auto-Baud Detection Complete bit.
void UART1_AutoBaudDetectCompleteReset (void)
Resets the UART1 Auto-Baud Detection Complete bit.
bool UART1_IsAutoBaudDetectOverflow (void)
Reads the UART1 Auto-Baud Detection Overflow bit.
void UART1_AutoBaudDetectOverflowReset (void)
Resets the UART1 Auto-Baud Detection Overflow bit.
void UART1_ErrorInterruptEnable (void)
Enables the UART1 Error Interrupt bit.
void UART1_ErrorInterruptDisable (void)
Disables the UART1 Error Interrupt bit.
void UART1_GeneralInterruptEnable (void)
Enables the UART1 Interrupt.
void UART1_GeneralInterruptDisable (void)
Disables the UART1 Interrupt.
bool UART1_IsRxReady (void)
Checks if the UART1 receiver has received data and is ready to be read.
bool UART1_IsTxReady (void)
Checks if the UART1 transmitter is ready to accept a data byte.
bool UART1_IsTxDone (void)
Returns the status of the Transmit Shift Register (TSR).
size_t UART1_ErrorGet (void)
Gets the error status of the last read byte. Call this function before calling UART1_Read().
uint8_t UART1_Read (void)
Reads the eight bits from the Receiver FIFO register.
void UART1_Write (uint8_t txData)
Writes a byte of data to the Transmitter FIFO register.
void UART1_FramingErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 framing error.
void UART1_OverrunErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 overrun error.
void UART1_ParityErrorCallbackRegister (void(*callbackHandler)(void))
Calls the function upon UART1 parity error.
void UART1_TxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the transmitter interrupt occurs.
void UART1_TransmitISR (void)
Implements the Interrupt Service Routine (ISR) for the UART1 transmitter interrupt.
void UART1_RxCompleteCallbackRegister (void(*callbackHandler)(void))
Registers the function to be called when the receiver interrupt occurs.
void UART1_ReceiveISR (void)
Implements the ISR for the UART1 receiver interrupt.
void UART1_ErrorCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon Error interrupt.
void UART1_ErrorISR (void)
This function is a ISR function to be called upon Error interrupt.
void UART1_GeneralInterruptCallbackRegister (void(*callbackHandler)(void))
This API registers the function to be called upon general interrupt.
void UART1_GeneralISR (void)
This function is a ISR function to be called upon general interrupt.
Macros
#define UART1_interface UART1
#define UART1_Initialize UART1_Initialize
#define UART1_Deinitialize UART1_Deinitialize
#define UART1_Write UART1_Write
#define UART1_Read UART1_Read
#define UART1__IsRxReady UART1_IsRxReady
#define UART1_IsTxReady UART1_IsTxReady
#define UART1_IsTxDone UART1_IsTxDone
#define UART1_TransmitEnable UART1_TransmitEnable
#define UART1_TransmitDisable UART1_TransmitDisable
#define UART1_AutoBaudSet UART1_AutoBaudSet
#define UART1_AutoBaudQuery UART1_AutoBaudQuery
#define UART1_AutoBaudDetectCompleteReset UART1_AutoBaudDetectCompleteReset
#define UART1_IsAutoBaudDetectOverflow UART1_IsAutoBaudDetectOverflow
#define UART1_AutoBaudDetectOverflowReset UART1_AutoBaudDetectOverflowReset
#define UART1_BRGCountSet (NULL)
#define UART1_BRGCountGet (NULL)
#define UART1_BaudRateSet (NULL)
#define UART1_BaudRateGet (NULL)
#define UART1__AutoBaudEventEnableGet (NULL)
#define UART1_ErrorGet UART1_ErrorGet
#define UART1_TxCompleteCallbackRegister UART1_TxCompleteCallbackRegister
#define UART1_RxCompleteCallbackRegister UART1_RxCompleteCallbackRegister
#define UART1_TxCollisionCallbackRegister (NULL)
#define UART1_FramingErrorCallbackRegister UART1_FramingErrorCallbackRegister
#define UART1_OverrunErrorCallbackRegister UART1_OverrunErrorCallbackRegister
#define UART1_ParityErrorCallbackRegister UART1_ParityErrorCallbackRegister
#define UART1_EventCallbackRegister (NULL)
Variables
const uart_drv_interface_t UART1
External object for uart_drv_interface.
void(* UART1_TxInterruptHandler )(void)
Pointer to the function called when the transmitter interrupt occurs.
void(* UART1_RxInterruptHandler )(void)
Pointer to the function called when the receiver interrupt occurs.
void(* UART1_ErrorInterruptHandler )(void)
This is a pointer to the function that will be called upon error interrupt.
void(* UART1_GeneralInterruptHandler )(void)
This is a pointer to the function that will be called upon general interrupt.
Detailed Description
UART1 Generated Driver API Header File
Macro Definition Documentation
UART1__AutoBaudEventEnableGet
#define UART1__AutoBaudEventEnableGet (NULL)
UART1__IsRxReady
#define UART1__IsRxReady UART1_IsRxReady
UART1_AutoBaudDetectCompleteReset
#define UART1_AutoBaudDetectCompleteReset UART1_AutoBaudDetectCompleteReset
UART1_AutoBaudDetectOverflowReset
#define UART1_AutoBaudDetectOverflowReset UART1_AutoBaudDetectOverflowReset
UART1_AutoBaudQuery
#define UART1_AutoBaudQuery UART1_AutoBaudQuery
UART1_AutoBaudSet
#define UART1_AutoBaudSet UART1_AutoBaudSet
UART1_BaudRateGet
#define UART1_BaudRateGet (NULL)
UART1_BaudRateSet
#define UART1_BaudRateSet (NULL)
UART1_BRGCountGet
#define UART1_BRGCountGet (NULL)
UART1_BRGCountSet
#define UART1_BRGCountSet (NULL)
UART1_Deinitialize
#define UART1_Deinitialize UART1_Deinitialize
UART1_ErrorGet
#define UART1_ErrorGet UART1_ErrorGet
UART1_EventCallbackRegister
#define UART1_EventCallbackRegister (NULL)
UART1_FramingErrorCallbackRegister
#define UART1_FramingErrorCallbackRegister UART1_FramingErrorCallbackRegister
UART1_Initialize
#define UART1_Initialize UART1_Initialize
UART1_interface
#define UART1_interface UART1
UART1_IsAutoBaudDetectOverflow
#define UART1_IsAutoBaudDetectOverflow UART1_IsAutoBaudDetectOverflow
UART1_IsTxDone
#define UART1_IsTxDone UART1_IsTxDone
UART1_IsTxReady
#define UART1_IsTxReady UART1_IsTxReady
UART1_OverrunErrorCallbackRegister
#define UART1_OverrunErrorCallbackRegister UART1_OverrunErrorCallbackRegister
UART1_ParityErrorCallbackRegister
#define UART1_ParityErrorCallbackRegister UART1_ParityErrorCallbackRegister
UART1_Read
#define UART1_Read UART1_Read
UART1_RxCompleteCallbackRegister
#define UART1_RxCompleteCallbackRegister UART1_RxCompleteCallbackRegister
UART1_TransmitDisable
#define UART1_TransmitDisable UART1_TransmitDisable
UART1_TransmitEnable
#define UART1_TransmitEnable UART1_TransmitEnable
UART1_TxCollisionCallbackRegister
#define UART1_TxCollisionCallbackRegister (NULL)
UART1_TxCompleteCallbackRegister
#define UART1_TxCompleteCallbackRegister UART1_TxCompleteCallbackRegister
UART1_Write
#define UART1_Write UART1_Write
3.26.1.7.3 source/uart_drv_interface.h File Reference
#include <stdbool.h> #include <stdint.h> #include "uart_types.h"
Data structures
struct uart_drv_interface_t
Structure containing the function pointers of UART driver.
Detailed Description
UART Generated Driver Interface Header File
3.26.1.7.4 source/uart_types.h File Reference
#include <stdbool.h> #include <stdint.h>
Enumerations
enum UART_STANDARD_BAUDS { UART_110 = 0, UART_300 = 1, UART_600 = 2, UART_1200 = 3, UART_2400 = 4, UART_4800 = 5, UART_9600 = 6, UART_14400 = 7, UART_19200 = 8, UART_38400 = 9, UART_57600 = 10, UART_115200 = 11, UART_230400 = 12, UART_460800 = 13, UART_921600 = 14 }
This Enum can be used to set UART standard baud-rates using UARTx_BRGSet function e.g. UART1_BRGSet.
Detailed Description
UART Generated Driver Interface Header File
Enumeration Type Documentation
UART_STANDARD_BAUDS
enum UART_STANDARD_BAUDS
This Enum can be used to set UART standard baud-rates using UARTx_BRGSet function e.g. UART1_BRGSet.
Section: Included Files Section: Data Type Definitions
UART_110 | |
UART_300 | |
UART_600 | |
UART_1200 | |
UART_2400 | |
UART_4800 | |
UART_9600 | |
UART_14400 | |
UART_19200 | |
UART_38400 | |
UART_57600 | |
UART_115200 | |
UART_230400 | |
UART_460800 | |
UART_921600 |