From 4003dd5267b75e4b9e45eab3bcee410a89cfd467 Mon Sep 17 00:00:00 2001 From: Ben Morse Date: Thu, 19 Feb 2015 00:22:51 -0800 Subject: [PATCH] adding extern to FILE variables --- hello_uart/uart.c | 3 +++ hello_uart/uart.h | 4 ++-- hello_uart_async/uart.h | 4 ++-- hello_uart_async/uart_async.c | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hello_uart/uart.c b/hello_uart/uart.c index 703c8f4..3233d56 100644 --- a/hello_uart/uart.c +++ b/hello_uart/uart.c @@ -8,6 +8,9 @@ /* http://www.cs.mun.ca/~rod/Winter2007/4723/notes/serial/serial.html */ +FILE uart_output = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); +FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ); + void uart_init(void) { UBRR0H = UBRRH_VALUE; UBRR0L = UBRRL_VALUE; diff --git a/hello_uart/uart.h b/hello_uart/uart.h index 3c2e1fa..eaa5c4e 100644 --- a/hello_uart/uart.h +++ b/hello_uart/uart.h @@ -5,5 +5,5 @@ 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); +extern FILE uart_output; +extern FILE uart_input; diff --git a/hello_uart_async/uart.h b/hello_uart_async/uart.h index 20ed356..867f6c6 100644 --- a/hello_uart_async/uart.h +++ b/hello_uart_async/uart.h @@ -8,5 +8,5 @@ struct tx_ring; /* 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); +extern FILE uart_output; +extern FILE uart_input; diff --git a/hello_uart_async/uart_async.c b/hello_uart_async/uart_async.c index a9af484..1ca287e 100644 --- a/hello_uart_async/uart_async.c +++ b/hello_uart_async/uart_async.c @@ -32,6 +32,10 @@ struct rx_ring { static struct tx_ring tx_buffer; static struct rx_ring rx_buffer; +FILE uart_output = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); +FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ); + + /* http://www.cs.mun.ca/~rod/Winter2007/4723/notes/serial/serial.html */ void uart_init(void) {