Skip to content
Snippets Groups Projects
Commit 1fdf3f18 authored by Xoaquin Castrelo's avatar Xoaquin Castrelo
Browse files

Enabled writing to UART.

parent ff519e7c
Branches
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ void initUart() ...@@ -12,7 +12,6 @@ void initUart()
UCSR0A = (1 << U2X0); // double transmission speed UCSR0A = (1 << U2X0); // double transmission speed
UCSR0B = (1 << RXCIE0) // enable RX complete interrupt UCSR0B = (1 << RXCIE0) // enable RX complete interrupt
| (1 << UDRIE0) // enable data register empty interrupt
| (1 << RXEN0) // enable receiver | (1 << RXEN0) // enable receiver
| (1 << TXEN0); // enable transmitter | (1 << TXEN0); // enable transmitter
UCSR0C = (0 << UMSEL01) | (0 << UMSEL00) // asynchronous USART UCSR0C = (0 << UMSEL01) | (0 << UMSEL00) // asynchronous USART
...@@ -25,12 +24,14 @@ void initUart() ...@@ -25,12 +24,14 @@ void initUart()
sei(); sei();
} }
ISR(USART_RX_vect) void writeUart(uint8_t value)
{ {
uart_add_ch(UDR0); while (!(UCSR0A & (1 << UDRE0)));
UDR0 = value;
} }
ISR(USART_UDRE_vect) ISR(USART_RX_vect)
{ {
// nothing to do right now uart_add_ch(UDR0);
} }
#ifndef UART_H #ifndef UART_H
#define UART_H #define UART_H
#include <stdint.h>
/** /**
* Initialises the UART logic. * Initialises the UART logic.
*/ */
void initUart(); void initUart();
/**
* Writes a character to the UART port.
*/
void writeUart(uint8_t value);
#endif /* UART_H */ #endif /* UART_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment