From f9357256249657af2374e3c334b9180e63dc5a30 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 16 Jun 2017 00:22:47 +0200 Subject: Split in different files --- floppyMusic/uart.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'floppyMusic/uart.c') diff --git a/floppyMusic/uart.c b/floppyMusic/uart.c index aed8acd..3aac221 100644 --- a/floppyMusic/uart.c +++ b/floppyMusic/uart.c @@ -7,23 +7,20 @@ #include "uart.h" - void uart_init(uint32_t _baud) + void uart_init(unsigned int _baud) { - unsigned int ubrr = _GET_UBBR(_baud); + unsigned int ubrr = (F_CPU / (16 * _baud)) - 1; - UBRRH = (ubrr<<8); - UBRRL = ubrr; + UBRRH = (unsigned char)(ubrr>>8) & 0xff; + UBRRL = (unsigned char)ubrr & 0xff; - /* Enable receiver and transmitter */ UCSRB = (1<