feat(boards): Add secondary button support to Waveshare ESP32-C6-Touch-AMOLED-2.16

- Enable BTN_FWD_GPIO (GPIO 10) as secondary button for mode toggle (Shift+Tab)
- Update BOARD_HAS_SECONDARY_BUTTON flag from 0 to 1
- Clarify button layout: BOOT (primary PTT), PWR (cycle screens via AXP), KEY (secondary mode toggle)
- Document KEY GPIO discovery method (empirical scanning of unused GPIOs)
- Update button_count calculation to include secondary button when available
- Initialize both BTN_BACK_GPIO and BTN_FWD_GPIO in input_hal_init()
- Refactor input_hal_is_held() to use switch statement for cleaner multi-button handling
This commit is contained in:
Alexander Wennerstrøm
2026-05-24 09:47:31 +02:00
parent ab8b64d949
commit 9f75de55a2
3 changed files with 17 additions and 9 deletions
@@ -2,16 +2,17 @@
#include "board.h"
#include <Arduino.h>
// Only BOOT is wired to a MCU GPIO. The "PWR" side button is the AXP2101
// PKEY, handled in power.cpp.
void input_hal_init(void) {
pinMode(BTN_BACK_GPIO, INPUT_PULLUP);
pinMode(BTN_FWD_GPIO, INPUT_PULLUP);
}
bool input_hal_is_held(InputButton btn) {
if (btn == INPUT_BTN_PRIMARY) {
switch (btn) {
case INPUT_BTN_PRIMARY:
return digitalRead(BTN_BACK_GPIO) == LOW;
case INPUT_BTN_SECONDARY:
return digitalRead(BTN_FWD_GPIO) == LOW;
}
return false;
}