diff --git a/src/commands.c b/src/commands.c index 7dd2253..3fae5a5 100644 --- a/src/commands.c +++ b/src/commands.c @@ -10,10 +10,15 @@ cmd_t command = { .index = 0 }; +void cmd_mirror_char(char c) +{ + printf("%c", c); +} + void cmd_collect_char(char c) { - command.buf[command.index] = c; - printf("%c", command.buf[command.index]); + command.buf[command.index] = c; + cmd_mirror_char(c); command.index++; @@ -42,6 +47,9 @@ void cmd_handle(cmd_t *command) if (0 == strcmp(tok1, "set")) cmd_handle_set(tok2, tok3); + + if (0 == strcmp(tok1, "switch")) + cmd_handle_switch(); } void cmd_handle_set(char *op1, char *op2) @@ -83,4 +91,14 @@ void cmd_handle_set(char *op1, char *op2) break; } } +} + +void cmd_handle_switch(void) +{ + int state = 0; + + PORTC ^= (1<