PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
uart.h File Reference
#include <board/board.h>
#include <stdbool.h>
#include <stdint.h>

Data Structures

struct  UARTRXErrorFlags
 Receive error flags. More...
 
union  UARTRXErrorFlags.__unnamed29__
 
struct  UARTRXErrorFlags.__unnamed29__.__unnamed31__
 

Typedefs

typedef const struct UARTDevice UARTDevice
 UART device, defined per SoC.
 
typedef void(* UARTRXInterruptHandler) (UARTDevice *dev, uint8_t data, const UARTRXErrorFlags *err_flags)
 Receive interrupt handler, called from the UART ISR for each received byte.
 
typedef void(* UARTTXInterruptHandler) (UARTDevice *dev)
 Transmit interrupt handler, called from the UART ISR when a byte can be sent.
 

Functions

void uart_init (UARTDevice *dev)
 Initialize the device for receive and transmit.
 
void uart_init_open_drain (UARTDevice *dev)
 Initialize the device with open-drain instead of push-pull pins.
 
void uart_init_tx_only (UARTDevice *dev)
 Initialize the device for transmit only.
 
void uart_init_rx_only (UARTDevice *dev)
 Initialize the device for receive only.
 
void uart_deinit (UARTDevice *dev)
 Deinitialize the device.
 
void uart_set_baud_rate (UARTDevice *dev, uint32_t baud_rate)
 Set the baud rate.
 
void uart_set_rx_interrupt_handler (UARTDevice *dev, UARTRXInterruptHandler irq_handler)
 Set the receive interrupt handler.
 
void uart_set_tx_interrupt_handler (UARTDevice *dev, UARTTXInterruptHandler irq_handler)
 Set the transmit interrupt handler.
 
void uart_set_rx_interrupt_enabled (UARTDevice *dev, bool enabled)
 Enable or disable the receive interrupt.
 
void uart_set_tx_interrupt_enabled (UARTDevice *dev, bool enabled)
 Enable or disable the transmit interrupt.
 
void uart_write_byte (UARTDevice *dev, uint8_t data)
 Write a byte.
 
uint8_t uart_read_byte (UARTDevice *dev)
 Read a byte.
 
void uart_start_rx_dma (UARTDevice *dev, void *buffer, uint32_t length)
 Start receiving into a circular DMA buffer.
 
void uart_stop_rx_dma (UARTDevice *dev)
 Stop receiving through DMA.
 
void uart_clear_rx_dma_buffer (UARTDevice *dev)
 Discard data pending in the receive DMA buffer.
 
bool uart_is_rx_ready (UARTDevice *dev)
 Check whether a received byte is ready to be read.
 
bool uart_has_rx_overrun (UARTDevice *dev)
 Check for a receive overrun.
 
bool uart_has_rx_framing_error (UARTDevice *dev)
 Check for a framing error.
 
bool uart_is_tx_ready (UARTDevice *dev)
 Check whether a byte can be written.
 
bool uart_is_tx_complete (UARTDevice *dev)
 Check whether the last byte has been fully sent.
 
void uart_wait_for_tx_complete (UARTDevice *dev)
 Wait until the last byte has been fully sent.
 
UARTRXErrorFlags uart_has_errored_out (UARTDevice *dev)
 Get the pending receive errors.
 
void uart_clear_all_interrupt_flags (UARTDevice *dev)
 Clear all interrupt flags.