uart_io/uart_io.c File Reference
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include "uart_io.h"
#include "uart_io_config.h"
#include <util/setbaud.h>
Go to the source code of this file.
Detailed Description
_ _ _ _ | |__ (_)_ __| | _| | ___ _ __ ___ ___ | '_ \| | '__| |/ / |/ _ \ '__/ __|/ _ \ | |_) | | | | <| | __/ | _ \ __/ |_.__/|_|_| |_|||_|(_)___/|
Initializes the UART a FILE stream and attaches a circular ram buffer so that output is fast.
A software inverter is also assumed to be connected from the UART TX to the INT1 line so that the output can be made compatible with a PC without any external inverter or conversion logic.
Copyright 2007 J�rgen Birkler jorgen.birkler@gmail.com
Definition in file uart_io.c.
Define Documentation
#define BAUD UART_IO_BAUDRATE |
#define INVERTER1_IN_DDRPORT UART_IO_UTIL_DDRPORT(INVERTER1_IN_PORT) |
#define INVERTER1_IN_INPORT UART_IO_UTIL_INPORT(INVERTER1_IN_PORT) |
#define INVERTER1_IN_IS_HIGH |
( |
|
) |
bit_is_set(INVERTER1_IN_INPORT,INVERTER1_IN_PIN) |
#define INVERTER1_IN_OUTPORT UART_IO_UTIL_OUTPORT(INVERTER1_IN_PORT) |
#define INVERTER1_OUT_DDRPORT UART_IO_UTIL_DDRPORT(UART_IO_TX_OUTPORT) |
#define INVERTER1_OUT_HIGH |
( |
|
) |
INVERTER1_OUT_OUTPORT |= _BV(INVERTER1_OUT_PIN) |
#define INVERTER1_OUT_INPORT UART_IO_UTIL_INPORT(UART_IO_TX_OUTPORT) |
#define INVERTER1_OUT_LOW |
( |
|
) |
INVERTER1_OUT_OUTPORT &= ~_BV(INVERTER1_OUT_PIN) |
#define INVERTER1_OUT_OUTPORT UART_IO_UTIL_OUTPORT(UART_IO_TX_OUTPORT) |
#define INVERTER1_OUT_PIN UART_IO_TX_OUTPIN |
#define UART_IO_BUFFER_SIZE (1<<(UART_IO_BUFFER_SIZE_FACTOR)) |
#define UART_IO_CONCAT |
( |
a, |
|
|
b |
|
) |
a ## b |
#define UART_IO_CONCAT_EXPANDED |
( |
a, |
|
|
b |
|
) |
UART_IO_CONCAT(a, b) |
#define UART_IO_GET_UBRR_X1 |
( |
baud |
|
) |
((F_CPU/((baud)*16L))-1) |
#define UART_IO_GET_UBRR_X2 |
( |
baud |
|
) |
((F_CPU/((baud)*8L))-1) |
#define UART_IO_UTIL_DDRPORT |
( |
name |
|
) |
UART_IO_CONCAT(DDR, name) |
#define UART_IO_UTIL_INPORT |
( |
name |
|
) |
UART_IO_CONCAT(PIN, name) |
#define UART_IO_UTIL_OUTPORT |
( |
name |
|
) |
UART_IO_CONCAT(PORT, name) |
Function Documentation
SIGNAL |
( |
SIG_INTERRUPT1 |
|
) |
|
FILE* uart_io_init |
( |
void |
|
) |
|
Initialize the UART, interrupts, pin and software inverter.
Definition at line 172 of file uart_io.c.
Referenced by main().
00173 {
00174 uart_io_enable_tx();
00175 INVERTER1_ENABLE();
00176 return &uart_file_io;
00177 }
char uart_io_ok_to_powersave |
( |
void |
|
) |
|
Returns 1 if ok to disable CPU clock 0 if not
- Note:
- Not implemented; always return 1
Definition at line 179 of file uart_io.c.
00180 {
00181 return 0;
00182 }