serialF0
1.3
Serial stream for HvA-Xmegaboard
|
Serial interface voor HvA-Xmegaboard. More...
#include <stdio.h>
Go to the source code of this file.
Macros | |
#define | TXBUF_DEPTH_F0 100 |
size of transmit buffer | |
#define | RXBUF_DEPTH_F0 100 |
size of receive buffer | |
#define | UART_NO_DATA 0x0100 |
Macro UART_NO_DATA is returned by uart_getc when no data is present. | |
#define | clear_screen() printf("\e[H\e[2J\e[3J"); |
Macro to reset and clear the terminal. | |
Functions | |
char * | getline (char *buf, uint16_t len) |
Get a line from the serial input. More... | |
void | init_stream (uint32_t f_cpu) |
Initializes the serial stream for the HvA-Xmegaboard. More... | |
uint16_t | uartF0_getc (void) |
Read a byte from UARTF0. More... | |
void | uartF0_putc (uint8_t data) |
Send a byte to UARTF0. More... | |
void | uartF0_puts (char *s) |
Send a string to UARTF0. More... | |
Serial interface voor HvA-Xmegaboard.
This serial interface doesn't use the drivers of Atmel The interface uses two non circulair buffers for sending and receiving the data. It is based om md_serial.c from J.D.Bakker.
It is a serial interface for the HvA-Xmegaboard (Version 2) with a Xmega256a3u and Xmega32a4u for programming and the serial interface. You can use the standard printf, putchar, puts, scanf, getchar, ... functions.
The baud rate is 115200
char* getline | ( | char * | buf, |
uint16_t | len | ||
) |
Get a line from the serial input.
buf | pointer to a buffer to store the received line |
len | length of the buffer to store the received line |
The line has to be finished with a End-Of-Line. This can be <CR>, <CR><LF> or <LF>
void init_stream | ( | uint32_t | f_cpu | ) |
Initializes the serial stream for the HvA-Xmegaboard.
f_cpu | clock frequency |
The only paramter is the clockfrequency. The default baud rate is 115200. At the moment this match best with the HvA-Xmegaboard. If you want to use another baud rate you can change it in this function.
|
inline |
Read a byte from UARTF0.
|
inline |
Send a byte to UARTF0.
data | byte to send |
void uartF0_puts | ( | char * | s | ) |
Send a string to UARTF0.
s | a pointer to the pointer |