37 lines
932 B
C++
37 lines
932 B
C++
|
#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));
|
||
|
}
|