From 292453d3060abf81e13aeb7bc7d76d3c3709da79 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 15 Jun 2017 15:06:10 -0400 Subject: 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 --- src/command.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/command.c') 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); -- cgit v1.2.3-70-g09d2