aboutsummaryrefslogtreecommitdiffstats
path: root/serial/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'serial/main.c')
-rw-r--r--serial/main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/serial/main.c b/serial/main.c
new file mode 100644
index 0000000..2e9ff5c
--- /dev/null
+++ b/serial/main.c
@@ -0,0 +1,25 @@
+#include <avr/io.h>
+#include "uart.h"
+
+int main(void)
+{
+ /* serial */
+ uart_init();
+
+ /* D4 = output and high (=> atx down) */
+ PORTD |= 0x10;
+ DDRD |= 0x10;
+
+ for (;;)
+ {
+ switch(uart_getchar()) {
+ case '?': break; /* useful for auto documentation */
+ case '0': PORTD |= 0x10; break;
+ case '1': PORTD &= ~0x10; break;
+ case 'T': PORTD ^= 0x10; break;
+ }
+ uart_putchar((PORTD & 0x10) ? '0' : '1');
+ }
+
+ return 0;
+}