Open Sint  3.4-2
Data Structures | Macros | Functions | Variables
uart.h File Reference

Serial I/O. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  uartStruct
 

Macros

#define UART0_BAUD   9600
 
#define UART0_RXBUF_SIZE   64
 
#define UART0_TXBUF_SIZE   64
 
#define UART0_RXBUF_MASK   ( UART0_RXBUF_SIZE - 1 )
 
#define UART0_TXBUF_MASK   ( UART0_TXBUF_SIZE - 1 )
 
#define TRUE   1
 
#define FALSE   0
 

Functions

struct uartStructuart_init (const uint8_t port)
 
void uart_shutdown (const uint8_t port)
 shutdown the usart port.
 
void uart_get_msg (const uint8_t port, char *s)
 
void uart_putchar (const uint8_t port, const char c)
 
void uart_printstr (const uint8_t port, const char *s)
 

Variables

volatile struct uartStructuartPtr
 

Detailed Description

Serial I/O.

Macro Definition Documentation

◆ UART0_BAUD

#define UART0_BAUD   9600

UART 0 baud rate

◆ UART0_RXBUF_MASK

#define UART0_RXBUF_MASK   ( UART0_RXBUF_SIZE - 1 )

RX buffers mask, used to check the proper size and if we are going out of size.

◆ UART0_RXBUF_SIZE

#define UART0_RXBUF_SIZE   64

RX buffers size

◆ UART0_TXBUF_MASK

#define UART0_TXBUF_MASK   ( UART0_TXBUF_SIZE - 1 )

TX buffers mask.

◆ UART0_TXBUF_SIZE

#define UART0_TXBUF_SIZE   64

TX buffers size

Function Documentation

◆ uart_get_msg()

void uart_get_msg ( const uint8_t  port,
char *  s 
)

get the message from the RX buffer.

port the serial port. s the string to copy the message to.

Bug:

multiport not implemented.

this function should be atomic, cannot be interrupted while resetting the pointer.

◆ uart_printstr()

void uart_printstr ( const uint8_t  port,
const char *  s 
)

Send a C (NUL-terminated) string to the serial port.

port the serial port. s the string to send.

◆ uart_putchar()

void uart_putchar ( const uint8_t  port,
const char  c 
)

Send character c to the serial port, wait until tx holding register is empty.

port the serial port. c the char to send.

Variable Documentation

◆ uartPtr

volatile struct uartStruct* uartPtr

Global UART rxtx buffers pointer used inside the ISR routine.