Files
clawdmeter/firmware/src/boards/waveshare_amoled_216_c6/input.cpp
T
Alexander Wennerstrøm 9f75de55a2 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
2026-05-24 09:47:31 +02:00

19 lines
433 B
C++

#include "../../hal/input_hal.h"
#include "board.h"
#include <Arduino.h>
void input_hal_init(void) {
pinMode(BTN_BACK_GPIO, INPUT_PULLUP);
pinMode(BTN_FWD_GPIO, INPUT_PULLUP);
}
bool input_hal_is_held(InputButton btn) {
switch (btn) {
case INPUT_BTN_PRIMARY:
return digitalRead(BTN_BACK_GPIO) == LOW;
case INPUT_BTN_SECONDARY:
return digitalRead(BTN_FWD_GPIO) == LOW;
}
return false;
}