Add uart synchronous transmit

This commit is contained in:
Nero 2018-01-29 19:29:02 +00:00 committed by Nero
parent 50ff908582
commit c745cd330f
2 changed files with 14 additions and 0 deletions

13
drivers/uart_tx.c Normal file
View File

@ -0,0 +1,13 @@
#include "uart_tx.h"
#include "uart.h"
#include <avr/io.h>
#include <avr/interrupt.h>
void __attribute__ ((naked)) __attribute__ ((section (".init6"))) uart_tx_init() {
UCSR0B |= (1<<TXEN0);
}
void uart_putc(unsigned char c) {
while( ( UCSR0A & ( 1 << UDRE0 ) ) == 0 ) {}
UDR0 = c;
}

1
drivers/uart_tx.h Normal file
View File

@ -0,0 +1 @@
void uart_putc(unsigned char c);