BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
2342395
Branches
Tags
master
flaneth
firmware
uart.c
change email address in header to blinkenarea address
Stefan Schuermans
commited
2342395
at 2012-05-22 19:18:57
uart.c
Blame
History
Raw
/* flaneth - flash and ethernet Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org> Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html a BlinkenArea project - http://www.blinkenarea.org/ */ #include <stdio.h> #include <avr/io.h> #include <avr/wdt.h> #include "macros.h" #include "uart.h" #define BAUD_RATE 38400 // initialize void UartInit(void) // (extern) { // enable transmission UCSR0B = 1 << TXEN; // set baudrate (16MHz crystal) UBRR0L = 16000000 / (BAUD_RATE * 16L) - 1; // set STDOUT to use UartPutchar fdevopen(UartPutchar, NULL); } // write a character int UartPutchar(char c, FILE * file) // (extern) { // wait until last character was sent while (bit_is_clear(UCSR0A, UDRE)) wdt_reset(); // send character UDR0 = c; return 0; file = NULL; // keep compiler happy }