uart  1.3
Serial stream for Xmega/Wrapper for UART-driver Xmega
 All Files Functions Variables Macros
serialF0.h File Reference

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...
 

Detailed Description

Serial interface voor HvA-Xmegaboard.

Author
Wim Dolman (w.e.dolman@hva.nl)
Date
03-10-2016
Version
1.2

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

Function Documentation

char* getline ( char *  buf,
uint16_t  len 
)

Get a line from the serial input.

Parameters
bufpointer to a buffer to store the received line
lenlength 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>

Returns
Received character
void init_stream ( uint32_t  fcpu)

Initializes the serial stream for the HvA-Xmegaboard.

Parameters
f_cpuclock 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.

Returns
void

Initializes the serial stream for the HvA-Xmegaboard.

Parameters
fcputhe clock frequency
Returns
void
uint16_t uartF0_getc ( void  )
inline

Read a byte from UARTF0.

Returns
Received byte from buffer or UART_NO_DATA if buffer is empty
void uartF0_putc ( uint8_t  data)
inline

Send a byte to UARTF0.

Parameters
databyte to send
Returns
void
void uartF0_puts ( char *  s)

Send a string to UARTF0.

Parameters
sa pointer to the pointer
Returns
void