From 7346cfaad4d969db060f3c7ae242ea93f4fff5c0 Mon Sep 17 00:00:00 2001 From: VG Date: Wed, 26 Aug 2015 18:45:01 +0200 Subject: first commit --- serial/main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 serial/main.c (limited to 'serial/main.c') 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 +#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; +} -- cgit v1.2.3