avr-firmwares/drivers/uart.c

12 lines
290 B
C

#include "uart.h"
#include <avr/io.h>
#define BAUD_PRESCALE (((F_CPU/(BAUDRATE*8UL)))-1)
void __attribute__ ((naked)) __attribute__ ((section (".init5"))) uart_init() {
UCSRA = (1<<U2X);
UCSRC = (1<<UCSZ0) | (1<<UCSZ1); // 8N1
UBRRH = (BAUD_PRESCALE>>8);
UBRRL = BAUD_PRESCALE;
}