OneWay  3.0-3-ge9d4fa4
Functions
uart.c File Reference

low level interface to the serial port More...

#include <avr/io.h>
#include "uart.h"
Include dependency graph for uart.c:

Functions

void uart_tx (const uint8_t port, const uint8_t enable)
 enable/disable the trasmit part of a serial port. More...
 
void uart_rx (const uint8_t port, const uint8_t enable)
 enable/disable the receive part of a serial port. More...
 
void uart_init (const uint8_t port)
 initialize the serial port and speed. More...
 
void uart_shutdown (const uint8_t port)
 
char uart_getchar (const uint8_t port, const uint8_t locked)
 get a char from the serial port. More...
 
void uart_putchar (const uint8_t port, const char c)
 send a single char down to the serial port. More...
 
void uart_printstr (const uint8_t port, const char *s)
 
void uart_flush (const uint8_t port)
 flush the port
 

Detailed Description

low level interface to the serial port

Function Documentation

◆ uart_getchar()

char uart_getchar ( const uint8_t  port,
const uint8_t  locked 
)

get a char from the serial port.

Parameters
portthe port.
locked1 - wait forever until a char is received. 0 - get a char if it is present or exit with 0.
Returns
the char or 0.

◆ uart_init()

void uart_init ( const uint8_t  port)

initialize the serial port and speed.

Parameters
portthe port to initialize.
Note
it does not enable tx or rx.

◆ uart_printstr()

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

Send a C (NUL-terminated) string to the UART Tx.

Parameters
portserial port 0 or 1.
sNULL terminated string.
Note
It must be a \0 terminated string.

◆ uart_putchar()

void uart_putchar ( const uint8_t  port,
const char  c 
)

send a single char down to the serial port.

Send character c down the UART Tx, wait until tx holding register is empty.

Parameters
portserial port 0 or 1.
cchar to send.

◆ uart_rx()

void uart_rx ( const uint8_t  port,
const uint8_t  enable 
)

enable/disable the receive part of a serial port.

Parameters
portSerial port number (0 or 1)
enable0 = disable, 1 = enable

◆ uart_shutdown()

void uart_shutdown ( const uint8_t  port)

turn off the serial port.

Parameters
portthe serial port to disable.

◆ uart_tx()

void uart_tx ( const uint8_t  port,
const uint8_t  enable 
)

enable/disable the trasmit part of a serial port.

Parameters
portSerial port number (0 or 1)
enable0 = disable, 1 = enable