libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
UART (EXT port)

Enumerations

enum  ws_uart_baud_rate_t { WS_UART_BAUD_RATE_9600 = WS_UART_CTRL_BAUD_9600 , WS_UART_BAUD_RATE_38400 = WS_UART_CTRL_BAUD_38400 }
 UART baud rate. More...

Functions

static void ws_uart_open (uint8_t baud_rate)
 Open the UART (EXT port) connection.
static void ws_uart_close (void)
 Close the UART (EXT port) connection.
static bool ws_uart_is_rx_overrun (void)
 Check if the UART receive buffer has overflowed.
static void ws_uart_ack_rx_overrun (void)
 Acknowledge that the UART receive buffer has overflowed.
static bool ws_uart_is_rx_ready (void)
 Does the UART receive buffer contain a byte?
static bool ws_uart_is_tx_ready (void)
 Is the UART transmit buffer ready to accept a byte?
uint8_t ws_uart_getc (void)
 Read a character from the UART.
int16_t ws_uart_getc_nonblock (void)
 Try to read a character from the UART.
void ws_uart_putc (uint8_t value)
 Write a character to the UART.

Detailed Description

Enumeration Type Documentation

◆ ws_uart_baud_rate_t

UART baud rate.

Enumerator
WS_UART_BAUD_RATE_9600 

UART baud rate: 9600 baud (960 bytes/second).

WS_UART_BAUD_RATE_38400 

UART baud rate: 38400 baud (3840 bytes/second).

Definition at line 43 of file uart.h.

Function Documentation

◆ ws_uart_ack_rx_overrun()

void ws_uart_ack_rx_overrun ( void )
inlinestatic

Acknowledge that the UART receive buffer has overflowed.

This is meant to be used after you have recovered from the overrun event (for example, by sending a cancellation message).

Definition at line 79 of file uart.h.

◆ ws_uart_close()

void ws_uart_close ( void )
inlinestatic

Close the UART (EXT port) connection.

Definition at line 62 of file uart.h.

◆ ws_uart_getc()

uint8_t ws_uart_getc ( void )

Read a character from the UART.

This function blocks until a character is successfully read.

Returns
uint8_t The character read.

◆ ws_uart_getc_nonblock()

int16_t ws_uart_getc_nonblock ( void )

Try to read a character from the UART.

Returns
int16_t The character read (>= 0) or a negative value if no character has been read.

◆ ws_uart_is_rx_overrun()

bool ws_uart_is_rx_overrun ( void )
inlinestatic

Check if the UART receive buffer has overflowed.

Definition at line 69 of file uart.h.

◆ ws_uart_is_rx_ready()

bool ws_uart_is_rx_ready ( void )
inlinestatic

Does the UART receive buffer contain a byte?

Returns
True if a byte can be read from the receive buffer.

Definition at line 88 of file uart.h.

◆ ws_uart_is_tx_ready()

bool ws_uart_is_tx_ready ( void )
inlinestatic

Is the UART transmit buffer ready to accept a byte?

Returns
True if a byte can be written to the transmit buffer.

Definition at line 97 of file uart.h.

◆ ws_uart_open()

void ws_uart_open ( uint8_t baud_rate)
inlinestatic

Open the UART (EXT port) connection.

Parameters
baud_rateThe baud rate to use for the connection.
See also
WS_UART_BAUD_RATE_9600
WS_UART_BAUD_RATE_38400

Definition at line 55 of file uart.h.

◆ ws_uart_putc()

void ws_uart_putc ( uint8_t value)

Write a character to the UART.

This ufnction blocks until a character is successfully written.

Parameters
valueThe character to write.