Chapter 2. API Reference
The extra cast is needed because linenoiseHintsCallback is defined as returning a char* instead of const char*.
Return string containing the hint text. This string is persistent and should not be freed (i.e. linenoiseSetFree-
HintsCallback should not be used).
Parameters
• buf: line typed by the user
• [out] color: ANSI color code to be used when displaying the hint
• [out] bold: set to 1 if hint has to be displayed in bold
esp_err_t
esp_console_register_help_command(void)
Register a 'help'command.
Default 'help'command prints the list of registered commands along with hints and help strings.
Return
• ESP_OK on success
• ESP_ERR_INVALID_STATE, if esp_console_init wasn't called
esp_err_t
esp_console_new_repl_uart(const
Establish a console REPL environment over UART driver.
Note This is a all-in-one function to establish the environment needed for REPL, includes:
• Install the UART driver on the console UART (8n1, 115200, REF_TICK clock source)
• Configures the stdin/stdout to go through the UART driver
• Initializes linenoise
• Spawn new thread to run REPL in the background
Attention This function is meant to be used in the examples to make the code more compact. Applications
which use console functionality should be based on the underlying linenoise and esp_console functions.
Return
• ESP_OK on success
• ESP_FAIL Parameter error
Parameters
• [in] dev_config: UART device configuration
• [in] repl_config: REPL configuration
• [out] ret_repl: return REPL handle after initialization succeed, return NULL otherwise
esp_err_t
esp_console_new_repl_usb_cdc(const
Establish a console REPL environment over USB CDC.
Note This is a all-in-one function to establish the environment needed for REPL, includes:
• Initializes linenoise
• Spawn new thread to run REPL in the background
Attention This function is meant to be used in the examples to make the code more compact. Applications
which use console functionality should be based on the underlying linenoise and esp_console functions.
Return
• ESP_OK on success
• ESP_FAIL Parameter error
Parameters
• [in] dev_config: USB CDC configuration
• [in] repl_config: REPL configuration
• [out] ret_repl: return REPL handle after initialization succeed, return NULL otherwise
esp_err_t esp_console_start_repl(esp_console_repl_t
Start REPL environment.
Note Once the REPL got started, it won't be stopped until user call repl->del(repl) to destory the REPL
environment.
Return
• ESP_OK on success
Espressif Systems
esp_console_dev_uart_config_t
const
esp_console_repl_config_t
esp_console_repl_t
*dev_config,
*repl_config,
*repl)
802
Submit Document Feedback
**ret_repl)
esp_console_dev_usb_cdc_config_t
const
esp_console_repl_config_t
esp_console_repl_t
**ret_repl)
*dev_config,
*repl_config,
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?