pwd 测试成功。

This commit is contained in:
2024-05-17 01:08:15 +08:00
parent 860f83ca0d
commit dce2cf64bb
11 changed files with 158 additions and 50 deletions

View File

@ -1,9 +1,9 @@
idf_component_register(SRCS
cmd_system.c
cmd_system_common.c
cmd_custom.c
CustomCommand.cpp
INCLUDE_DIRS .
REQUIRES console spi_flash driver
REQUIRES console spi_flash driver LedController
)
target_sources(${COMPONENT_LIB} PRIVATE cmd_system_sleep.c)

View File

@ -0,0 +1,36 @@
#include "CustomCommand.h"
#include "LedController.h"
#include "esp_console.h"
#include <iostream>
static int custom_command(int argc, char **argv) {
printf("i am amass.\n");
return 0;
}
static int led_command(int argc, char **argv) {
for (int i = 0; i < argc; i++) {
std::cout << i << " " << argv[i] << std::endl;
}
LedController::instance()->setDuty(atoi(argv[1]), atoi(argv[2]));
return 0;
}
void register_custom() {
const esp_console_cmd_t heap_cmd = {
.command = "amass",
.help = "test command.",
.hint = NULL,
.func = &custom_command,
};
ESP_ERROR_CHECK(esp_console_cmd_register(&heap_cmd));
const esp_console_cmd_t led_cmd = {
.command = "led",
.help = "led pwm duty.",
.hint = NULL,
.func = &led_command,
};
ESP_ERROR_CHECK(esp_console_cmd_register(&led_cmd));
}

View File

@ -0,0 +1,11 @@
#ifndef __CUSTOMCOMMAND_H__
#define __CUSTOMCOMMAND_H__
void register_custom();
#endif // __CUSTOMCOMMAND_H__

View File

@ -1,18 +0,0 @@
#include "cmd_custom.h"
#include "esp_console.h"
static int custom_command(int argc, char **argv) {
printf("i am amass.\n");
return 0;
}
void register_custom() {
const esp_console_cmd_t heap_cmd = {
.command = "amass",
.help = "test command.",
.hint = NULL,
.func = &custom_command,
};
ESP_ERROR_CHECK(esp_console_cmd_register(&heap_cmd));
}

View File

@ -1,6 +0,0 @@
#ifndef __CMD_CUSTOM_H__
#define __CMD_CUSTOM_H__
void register_custom();
#endif // __CMD_CUSTOM_H__