Espressif ESP32-S2 Programming Manual page 812

Table of Contents

Advertisement

Chapter 2. API Reference
esp_err_t
esp_console_cmd_register(const
Register console command.
Return
• ESP_OK on success
• ESP_ERR_NO_MEM if out of memory
• ESP_ERR_INVALID_ARG if command description includes invalid arguments
Parameters
• cmd: pointer to the command description; can point to a temporary value
esp_err_t
esp_console_run(const char *cmdline, int *cmd_ret)
Run command line.
Return
• ESP_OK, if command was run
• ESP_ERR_INVALID_ARG, if the command line is empty, or only contained whitespace
• ESP_ERR_NOT_FOUND, if command with given name wasn't registered
• ESP_ERR_INVALID_STATE, if esp_console_init wasn't called
Parameters
• cmdline: command line (command name followed by a number of arguments)
• [out] cmd_ret: return code from the command (set if command was run)
size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
Split command line into arguments in place.
* -
This function finds whitespace-separated arguments
*
*
'abc def 1 20 .3'
*
* -
Argument which include spaces may be surrounded
*
spaces are preserved
*
*
'abc "123 456" def'
*
* -
Escape sequences may be used to produce backslash, double quote,
*
*
'a\ b\\c\"'
*
Note Pointers to at most argv_size - 1 arguments are returned in argv array. The pointer after the last one (i.e.
argv[argc]) is set to NULL.
Return number of arguments found (argc)
Parameters
• line: pointer to buffer to parse; it is modified in place
• argv: array where the pointers to arguments are written
• argv_size: number of elements in argv_array (max. number of arguments)
void esp_console_get_completion(const char *buf,
Callback which provides command completion for linenoise library.
When using linenoise for line editing, command completion support can be enabled like this:
linenoiseSetCompletionCallback(&esp_console_get_completion);
Parameters
• buf: the string typed by the user
• lc: linenoiseCompletions to be filled in
const char *esp_console_get_hint(const char *buf, int *color, int *bold)
Callback which provides command hints for linenoise library.
When using linenoise for line editing, hints support can be enabled as follows:
linenoiseSetHintsCallback((linenoiseHintsCallback*) &esp_console_get_hint);
Espressif Systems
esp_console_cmd_t
->
[ 'abc', 'def', '1', '20',
and
quotes are
->
[ 'abc',
->
[
'a b\c"'
]
801
Submit Document Feedback
*cmd)
in
'.3'
with
quotes.
stripped.
'123
456',
'def'
]
linenoiseCompletions
the given
input
line.
]
In this case
and
space:
*lc)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF