Skip to content

Commit

Permalink
Add support for Ai Thinker ESP32-CAM boards (default flashlight to off)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcnd committed May 10, 2024
1 parent 2396f8b commit 24f2e4f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ports/espressif/boards/ai-thinker-esp32-cam/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,29 @@
*/

#include "supervisor/board.h"

#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/gpio/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h"
#include "common-hal/microcontroller/Pin.h"

void board_init(void) {
reset_board();
}

bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
// Pull one LED down on reset rather than the default up
if (pin_number == 4) { // This is the flashlight LED - very bright
gpio_config_t cfg = {
.pin_bit_mask = BIT64(pin_number),
.mode = GPIO_MODE_DISABLE,
.pull_up_en = false,
.pull_down_en = true,
.intr_type = GPIO_INTR_DISABLE,
};
gpio_config(&cfg);
return true;
}
return false;
}

0 comments on commit 24f2e4f

Please sign in to comment.