low level interface to the serial port
More...
#include <avr/io.h>
#include "uart.h"
|
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
|
|
low level interface to the serial port
◆ uart_getchar()
char uart_getchar |
( |
const uint8_t |
port, |
|
|
const uint8_t |
locked |
|
) |
| |
get a char from the serial port.
- Parameters
-
port | the port. |
locked | 1 - 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
-
port | the 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
-
port | serial port 0 or 1. |
s | NULL 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
-
port | serial port 0 or 1. |
c | char 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
-
port | Serial port number (0 or 1) |
enable | 0 = disable, 1 = enable |
◆ uart_shutdown()
void uart_shutdown |
( |
const uint8_t |
port | ) |
|
turn off the serial port.
- Parameters
-
port | the 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
-
port | Serial port number (0 or 1) |
enable | 0 = disable, 1 = enable |