BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
d48e86e
Branches
Tags
master
flaneth
firmware
uart.c
header fix
Stefan Schuermans
commited
d48e86e
at 2012-05-02 18:39:39
uart.c
Blame
History
Raw
/* flaneth - flash and ethernet Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info> 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 }