avr-firmwares/drivers/uart.c

11 lines
265 B
C
Raw Normal View History

#include "uart.h"
#include <avr/io.h>
#define BAUD_PRESCALE (((F_CPU/(BAUDRATE*8UL)))-1)
void __attribute__ ((naked)) __attribute__ ((section (".init5"))) uart_init() {
UCSR0A = (1<<U2X0);
UCSR0C = (1<<UCSZ00) | (1<<UCSZ01); // 8N1
UBRR0 = BAUD_PRESCALE;
}