serialF0
1.3
Serial stream for HvA-Xmegaboard
|
Serial interface voor HvA-Xmegaboard. More...
#include "serialF0.h"
#include <stdio.h>
#include <stddef.h>
#include <math.h>
#include <avr/io.h>
#include <avr/interrupt.h>
Macros | |
#define | BAUD_115K2 115200UL |
Baud rate 115200. | |
#define | BAUD_57K6 57600UL |
Baud rate 57600. | |
#define | BAUD_38K4 38000UL |
Baud rate 38400. | |
#define | UART_DOUBLE_CLK 1 |
Double clock speed true. | |
#define | UART_NO_DOUBLE_CLK 0 |
Double clock speed false. | |
Functions | |
void | uartF0_putc (uint8_t data) |
Send a byte to UARTF0. More... | |
uint16_t | uartF0_getc (void) |
Read a byte from UARTF0. More... | |
void | uartF0_puts (char *s) |
Send a string to UARTF0. More... | |
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... | |
Variables | |
FILE | uartF0_stdinout = FDEV_SETUP_STREAM(uartF0_fputc, uartF0_fgetc, _FDEV_SETUP_RW) |
FILE structure for standard streams. | |
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 |