diff options
Diffstat (limited to 'client/cmd.cpp')
-rw-r--r-- | client/cmd.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/client/cmd.cpp b/client/cmd.cpp index ab101e9..b7adfae 100644 --- a/client/cmd.cpp +++ b/client/cmd.cpp @@ -1,13 +1,16 @@ #include <cstdio> #include <cstdlib> +#include <readline/readline.h> #include <string.h> #include "cmd.h" #include "i2ctcpv1.h" +#include "pb/types.h" +#include "rl.h" #include "sock.h" #include "parse.h" -#include "../shared/puzbus.h" +#include "pb/bus.h" char* consume_token(char* input, const char* ifs) { strtok(input, ifs); @@ -35,7 +38,8 @@ void cmd_help(char*) { printf( "\n" - "You can also use the TAB key to autocomplete commands\n" + "See man pbc(1) for more info about specific commands\n" + "Hint: you can use the TAB key to autocomplete commands\n" ); } @@ -64,21 +68,30 @@ void cmd_send(char* addr_str) { free(data); } -void cmd_status(char*) { +// void cmd_status(char*) { +// const char msg[] = { +// PB_CMD_READ, +// 0x00, // addr 0 = global state +// }; +// i2c_send(BUSADDR_MAIN, msg, sizeof(msg)); +// // NOTE: the reply handler will automatically print the state once it's +// // received +// } + +void cmd_reset(char*) { const char msg[] = { - PB_CMD_READ, - 0x00, // addr 0 = global state + PB_CMD_WRITE, + 0x00, + PB_GS_IDLE, }; i2c_send(BUSADDR_MAIN, msg, sizeof(msg)); - // NOTE: the reply handler will automatically print the state once it's - // received } -void cmd_reset(char*) { +void cmd_skip(char*) { const char msg[] = { PB_CMD_WRITE, 0x00, - PB_GS_IDLE, + PB_GS_SOLVED, }; i2c_send(BUSADDR_MAIN, msg, sizeof(msg)); } |