- 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
19 lines
433 B
C++
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;
|
|
}
|