Driver API for UART (plib_uart0.h) More...
Macros | |
| #define | UART_ERROR_NONE (0U) |
| Error status when no error has occurred. | |
| #define | UART_ERROR_OVERRUN (UART_SR_OVRE_Msk) |
| Error status when an overrun error has occurred. | |
| #define | UART_ERROR_PARITY (UART_SR_PARE_Msk) |
| Error status when a parity error has occurred. | |
| #define | UART_ERROR_FRAMING (UART_SR_FRAME_Msk) |
| Error status when a framing error has occurred. | |
Typedefs | |
| typedef void(* | UART_INTERRUPT_HANDLER) (void) |
| Function pointer type for UART interrupt handlers. | |
| typedef uint32_t | UART_ERROR |
| Type for representing UART error status. | |
| typedef void(* | UART_CALLBACK_HANDLER) (UART_EVENT event) |
| Function pointer type for UART event callback handler. | |
Enumerations | |
| enum | UART_HWREG_STATUS { UART_HWREG_STATUS_OK = 0 , UART_HWREG_STATUS_ERROR , UART_HWREG_STATUS_INVALID_PARAM , UART_HWREG_STATUS_BUSY } |
| Status codes for UART hardware register operations. More... | |
| enum | UART_EVENT { UART_EVENT_TX_READY = 0 , UART_EVENT_TX_COMPLETE , UART_EVENT_RX_READY , UART_EVENT_ERROR } |
| UART interrupt event types. More... | |
| enum | UART_PARITY_MODE { UART_PARITY_EVEN = UART_MR_PAR_EVEN , UART_PARITY_ODD = UART_MR_PAR_ODD , UART_PARITY_SPACE = UART_MR_PAR_SPACE , UART_PARITY_MARK = UART_MR_PAR_MARK , UART_PARITY_NONE = UART_MR_PAR_NO } |
| UART parity mode selection. More... | |
| enum | UART_OPMODE { UART_OPMODE_PERIPH_CLK = UART_MR_BRSRCCK_PERIPH_CLK , UART_OPMODE_PMC_PCK = UART_MR_BRSRCCK_PMC_PCK } |
| UART baud rate source clock selection. More... | |
Functions | |
| void | UART0_Enable (void) |
| Enables the UART0 peripheral (receiver and transmitter). | |
| void | UART0_Disable (void) |
| Disables the UART0 peripheral (receiver and transmitter). | |
| void | UART0_EnableReceiver (void) |
| Enables the UART0 receiver. | |
| void | UART0_DisableReceiver (void) |
| Disables the UART0 receiver. | |
| void | UART0_EnableTransmitter (void) |
| Enables the UART0 transmitter. | |
| void | UART0_DisableTransmitter (void) |
| Disables the UART0 transmitter. | |
| void | UART0_SetOperatingMode (UART_OPMODE mode) |
| Sets the UART0 baud rate source clock. | |
| void | UART0_SetParityMode (UART_PARITY_MODE parity) |
| Sets the UART0 parity mode. | |
| UART_HWREG_STATUS | UART0_SetBaudrate (uint32_t baud, uint32_t clk_frequency) |
| Sets the UART0 baud rate. | |
| void | UART0_EnableRxReadyInterrupt (void) |
| Enables the UART0 receiver ready interrupt. | |
| void | UART0_DisableRxReadyInterrupt (void) |
| Disables the UART0 receiver ready interrupt. | |
| void | UART0_EnableTxCompleteInterrupt (void) |
| Enables the UART0 transmit complete interrupt. | |
| void | UART0_DisableTxCompleteInterrupt (void) |
| Disables the UART0 transmit complete interrupt. | |
| void | UART0_EnableTxReadyInterrupt (void) |
| Enables the UART0 transmitter ready interrupt. | |
| void | UART0_DisableTxReadyInterrupt (void) |
| Disables the UART0 transmitter ready interrupt. | |
| void | UART0_EnableErrorInterrupt (void) |
| Enables the UART0 error interrupt (overrun, framing, parity). | |
| void | UART0_DisableErrorInterrupt (void) |
| Disables the UART0 error interrupt. | |
| bool | UART0_ReceiverIsReady (void) |
| Checks if the UART0 receiver has data available. | |
| bool | UART0_TransmitterIsReady (void) |
| Checks if the UART0 transmitter data register is empty. | |
| bool | UART0_TransmitIsComplete (void) |
| Checks if the UART0 transmission is complete (shift register empty). | |
| UART_ERROR | UART0_GetError (void) |
| Gets the current UART0 error status and clears it. | |
| uint8_t | UART0_Receive (void) |
| Receives a byte of data from UART0. | |
| void | UART0_Send (uint8_t data) |
| Sends a byte of data via UART0. | |
| void | UART0_SetCallbackHandler (UART_CALLBACK_HANDLER callback) |
| Registers callback for UART0 interrupt events. | |
| void | UART0_ResetSoftware (void) |
| Performs a software reset of UART0 (receiver, transmitter, and status). | |
| void | UART0_SetInterruptHandler (void) |
| Assigns the interrupt handler for UART0. | |
Variables | |
| volatile UART_INTERRUPT_HANDLER | UART0_InterruptHandler |
| Interrupt handler for UART0 peripheral. | |
Driver API for UART (plib_uart0.h)
| #define UART_ERROR_FRAMING (UART_SR_FRAME_Msk) |
Error status when a framing error has occurred.
| #define UART_ERROR_NONE (0U) |
Error status when no error has occurred.
| #define UART_ERROR_OVERRUN (UART_SR_OVRE_Msk) |
Error status when an overrun error has occurred.
| #define UART_ERROR_PARITY (UART_SR_PARE_Msk) |
Error status when a parity error has occurred.
| UART_CALLBACK_HANDLER |
Function pointer type for UART event callback handler.
This typedef defines a callback function type that is called when a UART event occurs. The callback receives a single parameter indicating the event type.
| event | The UART event that triggered the callback. |
Type for representing UART error status.
| UART_INTERRUPT_HANDLER |
Function pointer type for UART interrupt handlers.
This typedef defines a function pointer for interrupt handlers associated with UART. The handler function must take no parameters and return void.
| enum UART_EVENT |
| enum UART_HWREG_STATUS |
| enum UART_OPMODE |
| enum UART_PARITY_MODE |
| void UART0_Disable | ( | void | ) |
Disables the UART0 peripheral (receiver and transmitter).
| None. |
| void UART0_DisableErrorInterrupt | ( | void | ) |
Disables the UART0 error interrupt.
| None. |
| void UART0_DisableReceiver | ( | void | ) |
Disables the UART0 receiver.
| None. |
| void UART0_DisableRxReadyInterrupt | ( | void | ) |
Disables the UART0 receiver ready interrupt.
| None. |
| void UART0_DisableTransmitter | ( | void | ) |
Disables the UART0 transmitter.
| None. |
| void UART0_DisableTxCompleteInterrupt | ( | void | ) |
Disables the UART0 transmit complete interrupt.
| None. |
| void UART0_DisableTxReadyInterrupt | ( | void | ) |
Disables the UART0 transmitter ready interrupt.
| None. |
| void UART0_Enable | ( | void | ) |
Enables the UART0 peripheral (receiver and transmitter).
| None. |
| void UART0_EnableErrorInterrupt | ( | void | ) |
Enables the UART0 error interrupt (overrun, framing, parity).
| None. |
| void UART0_EnableReceiver | ( | void | ) |
Enables the UART0 receiver.
| None. |
| void UART0_EnableRxReadyInterrupt | ( | void | ) |
Enables the UART0 receiver ready interrupt.
| None. |
| void UART0_EnableTransmitter | ( | void | ) |
Enables the UART0 transmitter.
| None. |
| void UART0_EnableTxCompleteInterrupt | ( | void | ) |
Enables the UART0 transmit complete interrupt.
| None. |
| void UART0_EnableTxReadyInterrupt | ( | void | ) |
Enables the UART0 transmitter ready interrupt.
| None. |
| UART_ERROR UART0_GetError | ( | void | ) |
Gets the current UART0 error status and clears it.
| None. |
| uint8_t UART0_Receive | ( | void | ) |
Receives a byte of data from UART0.
| None. |
| bool UART0_ReceiverIsReady | ( | void | ) |
Checks if the UART0 receiver has data available.
| None. |
| void UART0_ResetSoftware | ( | void | ) |
Performs a software reset of UART0 (receiver, transmitter, and status).
| None. |
| void UART0_Send | ( | uint8_t | data | ) |
Sends a byte of data via UART0.
| data | - Byte to send. |
| UART_HWREG_STATUS UART0_SetBaudrate | ( | uint32_t | baud, |
| uint32_t | clk_frequency ) |
Sets the UART0 baud rate.
| baud | - Desired baud rate in bits per second. |
| clk_frequency | - Source clock frequency in Hz. |
| void UART0_SetCallbackHandler | ( | UART_CALLBACK_HANDLER | callback | ) |
Registers callback for UART0 interrupt events.
| callback | - Pointer to the callback function, or NULL to deregister. |
| void UART0_SetInterruptHandler | ( | void | ) |
Assigns the interrupt handler for UART0.
| None. |
| void UART0_SetOperatingMode | ( | UART_OPMODE | mode | ) |
Sets the UART0 baud rate source clock.
| mode | - The desired clock source (see UART_OPMODE). |
| void UART0_SetParityMode | ( | UART_PARITY_MODE | parity | ) |
Sets the UART0 parity mode.
| parity | - The desired parity mode (see UART_PARITY_MODE). |
| bool UART0_TransmitIsComplete | ( | void | ) |
Checks if the UART0 transmission is complete (shift register empty).
| None. |
| bool UART0_TransmitterIsReady | ( | void | ) |
Checks if the UART0 transmitter data register is empty.
| None. |
|
extern |
Interrupt handler for UART0 peripheral.
This variable holds the function pointer to the current interrupt handler for the UART0 module. It should be assigned to a function that matches the UART_INTERRUPT_HANDLER signature. The variable is declared as volatile because it may be modified by interrupt service routines.