diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-06-15 15:06:10 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-06-29 13:33:58 -0400 |
commit | 292453d3060abf81e13aeb7bc7d76d3c3709da79 (patch) | |
tree | 2cec3840a26418b5d84efde4ef8230e44c18c6ac /src/command.c | |
parent | 1ae78d08e9a7d356c4b8555799ee42c9244c1b7d (diff) | |
download | kutter-292453d3060abf81e13aeb7bc7d76d3c3709da79.tar.gz kutter-292453d3060abf81e13aeb7bc7d76d3c3709da79.tar.xz kutter-292453d3060abf81e13aeb7bc7d76d3c3709da79.zip |
command: Move command_task() to board specific code
Move the command_task() code from the generic code to the board
specific code. This enables more flexibility in how the board
specific code processes input.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/command.c b/src/command.c index 6bc42bed..709e75c4 100644 --- a/src/command.c +++ b/src/command.c @@ -231,7 +231,7 @@ command_lookup_parser(uint8_t cmdid) enum { CF_NEED_SYNC=1<<0, CF_NEED_VALID=1<<1 }; // Find the next complete message. -static int8_t +int8_t command_find_block(char *buf, uint8_t buf_len, uint8_t *pop_count) { static uint8_t sync_state; @@ -293,7 +293,7 @@ nak: } // Dispatch all the commands found in a message block -static void +void command_dispatch(char *buf, uint8_t msglen) { char *p = &buf[MESSAGE_HEADER_SIZE]; @@ -312,17 +312,3 @@ command_dispatch(char *buf, uint8_t msglen) func(args); } } - -// Background task that reads commands from the board serial port -void -command_task(void) -{ - uint8_t buf_len, pop_count; - char *buf = console_get_input(&buf_len); - uint8_t ret = command_find_block(buf, buf_len, &pop_count); - if (ret > 0) - command_dispatch(buf, pop_count); - if (ret) - console_pop_input(pop_count); -} -DECL_TASK(command_task); |