SerialShell for embedded devices
Installing
Add to your platformio.ini:
lib_deps = https://dev.noccylabs.info/noccy/pio-serialshell.git#0.1.0 \
your_other_deps...
Example usage
void cmdHandler(char* buf, int len) {
// Tokenize the string on spaces
char* tok = strtok(buf, " ");
// If tokenization fails, return
if (tok == NULL) return;
// Check if the "help" command was entered
if (strncmp(tok, "help\0", 5) == 0) {
// ...
}
}
void setup() {
// Setup serial
Serial.begin(115200);
// Initialize the shell, set the prompt, and assign the callback
shell_init();
shell_prompt("cmd> ");
shell_callback(cmdHandler);
}
void loop() {
// Process shell stuff
shell_loop();
}
Description
Languages
C++
95.8%
C
4.2%