]> git.tdb.fi Git - model-railway-devices.git/blobdiff - firmware/serial.h
Rename the project to R²C²
[model-railway-devices.git] / firmware / serial.h
index e62b0a9df7137ce313ba15420de7a8308e1d8821..e5bfebe35569c95ec4988293ecd6bc409f158451 100644 (file)
@@ -1,10 +1,23 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #ifndef SERIAL_H_
 #define SERIAL_H_
 
-typedef void SerialCallback(uint8_t);
+#include <avr/interrupt.h>
+
+#define SERIAL_SET_CALLBACK(f) \
+       ISR(USART_RX_vect) \
+       { \
+               char c = UDR0; \
+               f(c); \
+       }
 
 void serial_init(uint16_t);
-void serial_set_callback(SerialCallback *);
 void serial_write(uint8_t);
 
 #endif