diff options
author | VG <vg@devys.org> | 2015-08-26 18:45:01 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2015-08-26 18:45:01 +0200 |
commit | 7346cfaad4d969db060f3c7ae242ea93f4fff5c0 (patch) | |
tree | 3d3a09a29f783270b8da931e3c879234553ec43f /atxswitch/main.c | |
download | avr-7346cfaad4d969db060f3c7ae242ea93f4fff5c0.tar.gz avr-7346cfaad4d969db060f3c7ae242ea93f4fff5c0.tar.bz2 avr-7346cfaad4d969db060f3c7ae242ea93f4fff5c0.zip |
first commitboo-standby-watcher-last-with-amp
Diffstat (limited to 'atxswitch/main.c')
-rw-r--r-- | atxswitch/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/atxswitch/main.c b/atxswitch/main.c new file mode 100644 index 0000000..2e9ff5c --- /dev/null +++ b/atxswitch/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; +} |