Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Functions | Variables
lampda::logic::cli Namespace Reference

Handle the serial command line interface. More...

Classes

struct  Command
 

Functions

constexpr Command make_command (const char *name, const char *desc, void(*handler)(const common::cli::ParsedCommand &))
 
constexpr Command make_command_args (const char *name, const char *usage, const uint8_t minArgs, const uint8_t maxArgs, const char *desc, void(*handler)(const common::cli::ParsedCommand &))
 
const char * boolToString (bool b)
 
static void print_command_description (const Command &cmd, const char *parent)
 Display the usage and description of a command, with parent the name of its command group, if any.
 
template<size_t N>
void handleCommand (const common::cli::ParsedCommand &command, const Command(&commandsToParse)[N], const char *calledCommand=nullptr)
 Parse a command and handle its effects.
 
constexpr bool has_duplicate_hash (const Command *arr, size_t count)
 Check for command duplication.
 
template<size_t N>
void help_hook_base (const Command(&commandsToParse)[N], const char *command=nullptr)
 Check for command uniqueness.
 
void setup ()
 Call once on system start.
 
void handleSerialEvents ()
 Handle the user command line inputs.
 

Variables

constexpr Command _main_commands_s []
 Define the CLI commands here.
 
constexpr Command _sys_commands_s []
 special commands to interact with the low level system
 
constexpr Command _debug_commands_s []
 commands to debug the low level system: tasks, power, recovery, electrical buses
 
constexpr Command _act_commands_s []
 special commands to interact with the low level system
 
constexpr Command _set_commands_s []
 special commands to set system values
 

Detailed Description

Handle the serial command line interface.

Function Documentation

◆ help_hook_base()

template<size_t N>
void lampda::logic::cli::help_hook_base ( const Command(&)  commandsToParse[N],
const char *  command = nullptr 
)

Check for command uniqueness.

Check for command uniqueness Check for command uniqueness Check for command uniqueness Check for command uniqueness hook that can read the other commands and print them out

Variable Documentation

◆ _act_commands_s

constexpr Command lampda::logic::cli::_act_commands_s[]
constexpr
Initial value:
= {
make_command_args("h",
"",
0,
common::cli::ParsedCommand::maxArgumentCount,
"This page. Dangerous commands /!\\",
handles::cmd_act_help),
make_command("shutdown", "force shutdown the system", handles::cmd_shutdown),
make_command("buttonTogg", "change the button gpio", handles::cmd_buttontoggle),
make_command("clear_user", "Clear all of the user parameters", handles::cmd_clear_user_parameters),
make_command("format", "format the whole file system (not recommanded !!)", handles::cmd_format),
make_command("dfu", "clear this program from memory, enter update mode", handles::cmd_dfu),
}

special commands to interact with the low level system

◆ _debug_commands_s

constexpr Command lampda::logic::cli::_debug_commands_s[]
constexpr
Initial value:
= {
make_command_args(
"h", "", 0, common::cli::ParsedCommand::maxArgumentCount, "This page", handles::cmd_debug_help),
make_command("tasks", "display a debug of task usages", handles::cmd_tasks),
make_command("ble", "debug bluetooth informations", handles::cmd_ble),
make_command("pd", "display the connected PD capabilities", handles::cmd_powerdelivery),
make_command("states", "state machine states", handles::cmd_states),
make_command("recovery", "read-only startup and battery recovery diagnostics", handles::cmd_recovery),
make_command("rtrace", "read-only recovery trace only", handles::cmd_recovery_trace),
make_command("serial", "show serial infos", handles::cmd_serial),
make_command("cinfo", "charger infos", handles::cmd_cinfo),
make_command("adc", "values from the charger ADC", handles::cmd_adc),
make_command("i2c", "start an i2c presence check", handles::cmd_i2c),
make_command("stats", "display the system use statistics", handles::cmd_stats),
make_command("bind", "show which clicks trigger each configurable behavior", handles::cmd_bindings),
make_command("ind", "show the indicator level and color", handles::cmd_indicator),
}

commands to debug the low level system: tasks, power, recovery, electrical buses

◆ _sys_commands_s

constexpr Command lampda::logic::cli::_sys_commands_s[]
constexpr
Initial value:
= {
make_command_args("h", "", 0, common::cli::ParsedCommand::maxArgumentCount, "This page", handles::cmd_sys_help),
make_command("alerts", "show all raised alerts", handles::cmd_alerts),
make_command("time", "show current time", handles::cmd_time),
make_command("bat", " battery info/levels", handles::cmd_bat),
make_command("ble_name", "return the current BLE device name", handles::cmd_get_ble_name),
make_command("bindings", "show which clicks trigger each configurable behavior", handles::cmd_bindings),
make_command("sun", "show the sunset and sunrise timers states", handles::cmd_sun_timers),
make_command("fav", "show the favorite mode count", handles::cmd_favorites),
make_command("status",
"one line status: $stat:g<group>:m<mode>:r<ramp>:<F if in favorites, else X> brgt:<brightness>",
handles::cmd_status),
make_command("bat_blink", "show if the battery level blinks are enabled", handles::cmd_battery_blink),
make_command("mic", "show the microphone sensitivity", handles::cmd_mic),
}

special commands to interact with the low level system