From 68c180f2aba4471483e1786556c2bc2a94a7d2a7 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 8 Apr 2014 11:28:54 +0200 Subject: Increase CPU and UART speed Re-enable interrupt based accel. --- uart.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'uart.c') diff --git a/uart.c b/uart.c index 4b7ca39..3528a22 100644 --- a/uart.c +++ b/uart.c @@ -2,6 +2,7 @@ #include #include "uart.h" +#include "common.h" /* blocking uart send */ @@ -23,13 +24,23 @@ static int uartPutc (char c, FILE *stream) { static FILE mystdout = FDEV_SETUP_STREAM (uartPutc, NULL, _FDEV_SETUP_WRITE); void uartInit () { - /* Set baud rate (9600, double speed, at 1mhz) */ UBRR0H = 0; +#if F_CPU == 1000000 + /* Set baud rate (9600, double speed) */ UBRR0L = 12; +#elif F_CPU == 4000000 + /* Set baud rate (9600, double speed) */ + UBRR0L = 51; +#elif F_CPU == 8000000 + /* baudrate 38.4k */ + UBRR0L = 25; +#else +#error "cpu speed not supported" +#endif /* enable double speed mode */ UCSR0A = (1 << U2X0); /* Enable receiver and transmitter */ - UCSR0B = (1<