11#include "devicelist.h"
13extern uint32_t __shell_vector_start;
14extern uint32_t __shell_vector_end;
27void vShellExec(
void *argument) {
31 params.shell->
run(params.shell, params.str);
78 shell->
usb.
print(&shell->
usb,
"Use `help [name]` for more information on a specific command\n\r");
79 shell->
usb.
print(&shell->
usb,
"The following commands are currently available:\n\r");
80 for (uint32_t *i = (uint32_t *)&__shell_vector_start; i < (uint32_t *)&__shell_vector_end; i++) {
82 if (strcmp(handle->
name,
"")) {
103 char *token = strtok((
char *)programName,
" ");
104 char *flags = strchr(token,
'\0') + 1;
107 for (uint32_t *i = (uint32_t *)&__shell_vector_start; i < (uint32_t *)&__shell_vector_end; i++) {
111 if (!strcmp(handle->
name, programName)) {
112 handle->
exec(shell, flags);
118 shell->
usb.
print(&shell->
usb, (
char *)programName);
119 shell->
usb.
print(&shell->
usb,
": command not recognized. Run `help` for a list of available commands\n\r");
137 params.shell = shell;
146 configMAX_PRIORITIES - 6,
DeviceHandle_t DeviceList_getDeviceHandle(DeviceKey)
Retrieve device handle from list by key.
bool(* clear)(struct Shell *)
void(* run)(struct Shell *, uint8_t *)
TaskHandle_t taskHandle
Handle of currently active program in shell thread.
char name[SHELL_PROGRAM_NAME_LENGTH]
Program name as referenced by the shell.
void(* help)(struct Shell *)
void(* runTask)(struct Shell *, uint8_t *)
UART_t usb
UART interface to connect shell I/O.
void(* exec)(struct Shell *, uint8_t *)
Program entry point function pointer.
int Shell_init(Shell *shell)
Initializes the shell, registering programs from shell vector.
void Shell_help(Shell *)
Displays available shell commands.
bool Shell_clear(Shell *)
Send clear sequence to host terminal.
void Shell_runTask(Shell *, uint8_t *)
Creates a task to run a shell program.
void Shell_run(Shell *, uint8_t *)
Executes a shell program by name.
Struct definition for shell interface.
Struct definition for shell program handle.
Struct definition for parameters passed to shell task.
void(* print)(struct UART *, char *)
UART print string method.
Struct definition for UART interface.