Bayley Wang
/
flash_configuration
flash based config testing
CommandProcessor/CommandProcessor.cpp@3:82c00c8e2cb4, 2017-03-07 (annotated)
- Committer:
- bwang
- Date:
- Tue Mar 07 08:06:39 2017 +0000
- Revision:
- 3:82c00c8e2cb4
- Parent:
- 2:cfc39b0843ae
lot's more commands
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 1:df6bbacb7bb9 | 1 | #include "mbed.h" |
bwang | 1:df6bbacb7bb9 | 2 | #include "CommandProcessor.h" |
bwang | 1:df6bbacb7bb9 | 3 | #include "PreferenceWriter.h" |
bwang | 2:cfc39b0843ae | 4 | #include "globals.h" |
bwang | 1:df6bbacb7bb9 | 5 | |
bwang | 1:df6bbacb7bb9 | 6 | #include "config.h" |
bwang | 1:df6bbacb7bb9 | 7 | #include "config_driving.h" |
bwang | 1:df6bbacb7bb9 | 8 | #include "config_inverter.h" |
bwang | 1:df6bbacb7bb9 | 9 | #include "config_logging.h" |
bwang | 1:df6bbacb7bb9 | 10 | #include "config_loop.h" |
bwang | 1:df6bbacb7bb9 | 11 | #include "config_motor.h" |
bwang | 1:df6bbacb7bb9 | 12 | #include "config_pins.h" |
bwang | 1:df6bbacb7bb9 | 13 | #include "config_table.h" |
bwang | 1:df6bbacb7bb9 | 14 | |
bwang | 1:df6bbacb7bb9 | 15 | void processCmd(Serial *pc, PreferenceWriter *pref, char *buf) { |
bwang | 1:df6bbacb7bb9 | 16 | char *tokens[10]; |
bwang | 1:df6bbacb7bb9 | 17 | int len = tokenize(buf, tokens, 10); |
bwang | 1:df6bbacb7bb9 | 18 | |
bwang | 1:df6bbacb7bb9 | 19 | switch (len) { |
bwang | 1:df6bbacb7bb9 | 20 | case 1: |
bwang | 1:df6bbacb7bb9 | 21 | if (strcmp(tokens[0], "ls") == 0) cmd_ls(pc); |
bwang | 1:df6bbacb7bb9 | 22 | if (strcmp(tokens[0], "defaults") == 0) cmd_defaults(pc); |
bwang | 1:df6bbacb7bb9 | 23 | if (strcmp(tokens[0], "reload") == 0) cmd_reload(pc, pref); |
bwang | 1:df6bbacb7bb9 | 24 | if (strcmp(tokens[0], "load") == 0) cmd_reload(pc, pref); |
bwang | 1:df6bbacb7bb9 | 25 | if (strcmp(tokens[0], "flush") == 0) cmd_flush(pc, pref); |
bwang | 3:82c00c8e2cb4 | 26 | if (strcmp(tokens[0], "mode") == 0) cmd_ls2(pc, tokens[0]); |
bwang | 3:82c00c8e2cb4 | 27 | if (strcmp(tokens[0], "src") == 0) cmd_ls2(pc, tokens[0]); |
bwang | 3:82c00c8e2cb4 | 28 | if (strcmp(tokens[0], "op") == 0) cmd_ls2(pc, tokens[0]); |
bwang | 3:82c00c8e2cb4 | 29 | if (strcmp(tokens[0], "cfg") == 0) cmd_mode(pc, tokens[0]); |
bwang | 3:82c00c8e2cb4 | 30 | if (strcmp(tokens[0], "zero") == 0) cmd_mode(pc, tokens[0]); |
bwang | 3:82c00c8e2cb4 | 31 | if (strcmp(tokens[0], "wizard") == 0) cmd_mode(pc, tokens[0]); |
bwang | 2:cfc39b0843ae | 32 | if (strcmp(tokens[0], "exit") == 0) cmd_exit(pc); |
bwang | 1:df6bbacb7bb9 | 33 | break; |
bwang | 1:df6bbacb7bb9 | 34 | case 2: |
bwang | 1:df6bbacb7bb9 | 35 | if (strcmp(tokens[0], "ls") == 0) cmd_ls2(pc, tokens[1]); |
bwang | 1:df6bbacb7bb9 | 36 | if (strcmp(tokens[0], "get") == 0) cmd_ls2(pc, tokens[1]); |
bwang | 3:82c00c8e2cb4 | 37 | if (strcmp(tokens[0], "setp") == 0) cmd_setp(pc, tokens[1]); |
bwang | 3:82c00c8e2cb4 | 38 | if (strcmp(tokens[0], "mode") == 0) cmd_mode(pc, tokens[1]); |
bwang | 3:82c00c8e2cb4 | 39 | if (strcmp(tokens[0], "src") == 0) cmd_src(pc, tokens[1]); |
bwang | 3:82c00c8e2cb4 | 40 | if (strcmp(tokens[0], "op") == 0) cmd_op(pc, tokens[1]); |
bwang | 1:df6bbacb7bb9 | 41 | break; |
bwang | 1:df6bbacb7bb9 | 42 | case 3: |
bwang | 1:df6bbacb7bb9 | 43 | if (strcmp(tokens[0], "set") == 0) cmd_set(pc, tokens[1], tokens[2]); |
bwang | 1:df6bbacb7bb9 | 44 | default: |
bwang | 1:df6bbacb7bb9 | 45 | break; |
bwang | 1:df6bbacb7bb9 | 46 | } |
bwang | 1:df6bbacb7bb9 | 47 | } |