support simple LEDs on ESP32-S2-based board
This commit is contained in:
parent
b8bd21f11e
commit
ed6ad9f9ca
|
@ -74,6 +74,15 @@ void board_init(void)
|
|||
strip->clear(strip, 100); // off led
|
||||
#endif
|
||||
|
||||
#ifdef LED_PIN
|
||||
gpio_reset_pin(LED_PIN);
|
||||
#if LED_ACTIVE
|
||||
gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT);
|
||||
#else
|
||||
gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT_OD);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Button
|
||||
esp_rom_gpio_pad_select_gpio(BUTTON_PIN);
|
||||
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
|
||||
|
@ -128,6 +137,9 @@ void board_led_write(bool state)
|
|||
strip->set_pixel(strip, 0, (state ? 0x88 : 0x00), 0x00, 0x00);
|
||||
strip->refresh(strip, 100);
|
||||
#endif
|
||||
#ifdef LED_PIN
|
||||
gpio_set_level(LED_PIN, state ? LED_ACTIVE : !LED_ACTIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get the current state of button
|
||||
|
|
Loading…
Reference in New Issue