BlinkenArea - GitList
Repositories
Blog
Wiki
flaneth
Code
Commits
Branches
Tags
Search
Tree:
e8658d5
Branches
Tags
master
flaneth
firmware
uart.c
initial commit after making CF identify work
Stefan Schuermans
commited
e8658d5
at 2012-04-15 19:57:57
uart.c
Blame
History
Raw
/* flaneth - flash and ethernet version 0.2 date 2008-11-08 Copyright (C) 2007-2008 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 }