Console Peripheral
Console Peripheral is used to control the Audio application from the terminal screen. It provides 2 ways do execute command, one sends an event to esp_peripherals (for a command without parameters), another calls a callback function (need parameters). If there is a callback function, no event will be sent.
Please make sure that the lifetime of periph_console_cmd_t
must be ensured during console operation, periph_console_init()
only reference, does not make a copy.
Code example
Please refer to cli/main/console_example.c.
API Reference
Header File
Functions
-
esp_periph_handle_t periph_console_init(periph_console_cfg_t *config)
Initialize Console Peripheral.
- 参数
config – The configuration
- 返回
The esp peripheral handle
Structures
-
struct periph_console_cmd_t
Command structure.
Public Members
-
const char *cmd
Name of command, must be unique
-
int id
Command ID will be sent together when the command is matched
-
const char *help
Explanation of the command
-
console_cmd_callback_t func
Function callback for the command
-
const char *cmd
-
struct periph_console_cfg_t
Console Peripheral configuration.
Public Members
-
int command_num
Total number of commands
-
const periph_console_cmd_t *commands
Pointer to array of commands
-
int task_stack
Console task stack, using default if the value is zero
-
int task_prio
Console task priority (based on freeRTOS priority), using default if the value is zero
-
int buffer_size
Size of console input buffer
-
const char *prompt_string
Console prompt string, using default CONSOLE_PROMPT_STRING if the pointer is NULL
-
int command_num
Macros
-
CONSOLE_DEFAULT_TASK_PRIO
-
CONSOLE_DEFAULT_TASK_STACK
-
CONSOLE_DEFAULT_BUFFER_SIZE
-
CONSOLE_DEFAULT_PROMPT_STRING
Type Definitions
-
typedef esp_err_t (*console_cmd_callback_t)(esp_periph_handle_t periph, int argc, char *argv[])