ESP32-Console

This commit is contained in:
2025-01-17 20:05:07 -05:00
parent 08d1fb66ee
commit 403c1b156a

View File

@@ -84,9 +84,33 @@ static void register_gpio_set_cmd (void) {
}
// Resets GPIO
static int exec_gpio_reset_cmd(int argc, char **argv) {}
static int exec_gpio_reset_cmd(int argc, char **argv) {
int nerrors = arg_parse(argc, argv, (void**) &gpio_set_args);
// Confirm there were no parsing errors
if (nerrors != 0) {
arg_print_errors(stderr, gpio_set_args.end, argv[0]);
return 1;
}
else {
/*
Set the levelof specified GPIO HIGH or LOW
*/
// Check that the minimal required arguments were passed, i.e. pin #, mode, and logic level.
if (gpio_set_args.gpio->count > 0 && gpio_set_args.level->count > 0 && gpio_set_args.mode->count > 0) {
// Display brief summary of passed arguments.
ESP_LOGI("GPIO", "pin: %i, mode: %s, level: %i",
gpio_set_args.gpio->ival[0],
gpio_set_args.mode->sval[0],
gpio_set_args.level->ival[0]);
// Set the bit mask for the pin number that was passed
pin_config.pin_bit_mask = 1ULL << gpio_set_args.gpio->ival[0];
// Since we are setting the pin level, set the pin mode to OUTPUT
if (strcmp(gpio_set_args.mode->sval[0], "out") == 0) {
}
static void register_gpio_reset(void) {
gpio_set_args.gpio = arg_int0("r", "reset", "<pin>", "Specifies GPIO to reset.");
gpio_set_args.gpio = arg_int0("p", "pin", "<pin>", "Specifies GPIO to reset.");
gpio_set_args.mode = NULL;
gpio_set_args.level = NULL;
gpio_set_args.pwm = NULL;