From adae63b499a9de1edfd2c4f60abb3c344f50da45 Mon Sep 17 00:00:00 2001 From: Mika Tuupola Date: Sun, 9 Oct 2011 01:43:30 +0300 Subject: [PATCH] Comments and whitespace. --- hello_uart/main.c | 1 + hello_uart/uart.c | 3 ++- hello_uart/uart.h | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hello_uart/main.c b/hello_uart/main.c index 2b83ec2..646edaa 100644 --- a/hello_uart/main.c +++ b/hello_uart/main.c @@ -5,6 +5,7 @@ * Led at Arduino digital 13 (PORTB5). Cause we all love blinken leds! * * To compile and upload run: make clean; make; make program; + * Connect to serial with: screen /dev/tty.usbserial-* 9600 * * Copyright 2011 Mika Tuupola * diff --git a/hello_uart/uart.c b/hello_uart/uart.c index 8a033c4..19c2578 100644 --- a/hello_uart/uart.c +++ b/hello_uart/uart.c @@ -13,7 +13,7 @@ void uart_init(void) { UBRR0L = UBRRL_VALUE; UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ - UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ + UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ } int uart_putchar(char c, FILE *stream) { @@ -30,3 +30,4 @@ int uart_getchar(FILE *stream) { return UDR0; } + diff --git a/hello_uart/uart.h b/hello_uart/uart.h index cf8fad5..3c2e1fa 100644 --- a/hello_uart/uart.h +++ b/hello_uart/uart.h @@ -3,5 +3,7 @@ int uart_getchar(FILE *stream); void uart_init(void); +/* http://www.ermicro.com/blog/?p=325 */ + FILE uart_output = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); -FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ); \ No newline at end of file +FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ);