Loading...
Searching...
No Matches
shell.h File Reference
#include "FreeRTOS.h"
#include "stdbool.h"
#include "stdint.h"
#include "string.h"
#include "task.h"
#include "devices.h"
#include "flash.h"
#include "uart.h"

Go to the source code of this file.

Data Structures

struct  ShellProgramHandle_t
 
struct  Shell
 
struct  ShellTaskParams
 

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

Author
Matt Ricci

Definition in file shell.h.


Data Structure Documentation

◆ ShellProgramHandle_t

struct ShellProgramHandle_t

Definition at line 29 of file shell.h.

◆ Shell

struct Shell

Definition at line 34 of file shell.h.

◆ ShellTaskParams

struct ShellTaskParams

Definition at line 45 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 45 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 80 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 104 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.