Loading...
Searching...
No Matches
Shell

Australis shell interface for user interaction with the system via terminal command line. More...

Data Structures

struct  Shell
 Struct definition for shell interface. More...
 
struct  ShellProgramHandle_t
 Struct definition for shell program handle. More...
 
struct  ShellTaskParams
 Struct definition for parameters passed to shell task. More...
 

Functions

int Shell_init (Shell *)
 Initializes the shell, registering programs from shell vector.
 
void Shell_help (Shell *)
 Displays available shell commands.
 
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.
 
bool Shell_clear (Shell *)
 Send clear sequence to host terminal.
 

Detailed Description

Australis shell interface for user interaction with the system via terminal command line.

Author
Matt Ricci
Matt Ricci
Matt Ricci
Matt Ricci

Data Structure Documentation

◆ Shell

struct Shell

Struct definition for shell interface.

Definition at line 48 of file shell.h.

Data Fields
UART_t usb UART interface to connect shell I/O.
void(*)(struct Shell *) help
See also
Shell_help
void(*)(struct Shell *, uint8_t *) run
See also
Shell_run
void(*)(struct Shell *, uint8_t *) runTask
See also
Shell_runTask
bool(*)(struct Shell *) clear
See also
Shell_clear
TaskHandle_t taskHandle Handle of currently active program in shell thread.

◆ ShellProgramHandle_t

struct ShellProgramHandle_t

Struct definition for shell program handle.

Provides the interface for shell programs.

All handles must have a name (case-sensitive) that represents the program as it will be called from the shell interface.

Additionally, the handle must initialise the exec function pointer. This defines the program's entry point and is called by the shell.

Definition at line 65 of file shell.h.

Data Fields
char name[SHELL_PROGRAM_NAME_LENGTH] Program name as referenced by the shell.
void(*)(struct Shell *, uint8_t *) exec Program entry point function pointer.

◆ ShellTaskParams

struct ShellTaskParams

Struct definition for parameters passed to shell task.

Definition at line 74 of file shell.h.

Function Documentation

◆ Shell_init()

int Shell_init ( Shell * shell)

Initializes the shell, registering programs from shell vector.

Configures shell structure, sets up functions, and registers available shell programs. Returns an error code if the number of programs exceeds the maximum.

Parameters
shellPointer to the Shell structure to initialize.
Returns
0 on success, 1 if the program count exceeds the maximum.

Definition at line 53 of file shell.c.

◆ Shell_help()

void Shell_help ( Shell * shell)

Displays available shell commands.

Prints a list of all registered shell commands to the USB interface.

Parameters
shellPointer to the Shell structure.
Returns
void

Definition at line 77 of file shell.c.

◆ Shell_runTask()

void Shell_runTask ( Shell * shell,
uint8_t * str )

Creates a task to run a shell program.

Initializes task parameters and spawns a new RTOS task to parse and execute the shell program.

Parameters
shellPointer to the Shell structure containing the program details.
strCommand string to parse and execute.
Returns
void

Definition at line 134 of file shell.c.

◆ Shell_run()

void Shell_run ( Shell * shell,
uint8_t * programName )

Executes a shell program by name.

Parses the program name and flags, then finds and runs the corresponding shell program.

Parameters
shellPointer to the Shell structure containing registered programs.
programNameName of the program to execute, with optional flags.
Returns
void

Definition at line 102 of file shell.c.

◆ Shell_clear()

bool Shell_clear ( Shell * shell)

Send clear sequence to host terminal.

usbClearCommandExecute transmits over UART an ANSI control sequence for clearing the host terminal window.


Definition at line 159 of file shell.c.