avr-firmwares/drivers/uart.c

12 lines
290 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() {
2018-04-05 00:35:09 +02:00
UCSRA = (1<<U2X);
UCSRC = (1<<UCSZ0) | (1<<UCSZ1); // 8N1
UBRRH = (BAUD_PRESCALE>>8);
UBRRL = BAUD_PRESCALE;
}