bdk: btn: enable HOME button as input

This commit is contained in:
CTCaer 2022-01-16 01:05:42 +02:00
parent 1a9c6bf983
commit 5e6a7c486b
3 changed files with 9 additions and 2 deletions

View file

@ -138,8 +138,8 @@ static void _config_gpios(bool nx_hoag)
gpio_output_enable(GPIO_PORT_X, GPIO_PIN_7, GPIO_OUTPUT_DISABLE);
// Configure HOME as inputs.
// PINMUX_AUX(PINMUX_AUX_BUTTON_HOME) = PINMUX_INPUT_ENABLE | PINMUX_TRISTATE;
// gpio_config(GPIO_PORT_Y, GPIO_PIN_1, GPIO_MODE_GPIO);
PINMUX_AUX(PINMUX_AUX_BUTTON_HOME) = PINMUX_INPUT_ENABLE | PINMUX_TRISTATE;
gpio_config(GPIO_PORT_Y, GPIO_PIN_1, GPIO_MODE_GPIO);
}
static void _config_pmc_scratch()

View file

@ -44,6 +44,11 @@ u8 btn_read_vol()
return res;
}
u8 btn_read_home()
{
return (!gpio_read(GPIO_PORT_Y, GPIO_PIN_1)) ? BTN_HOME : 0;
}
u8 btn_wait()
{
u8 res = 0, btn = btn_read();

View file

@ -23,10 +23,12 @@
#define BTN_POWER BIT(0)
#define BTN_VOL_DOWN BIT(1)
#define BTN_VOL_UP BIT(2)
#define BTN_HOME BIT(3)
#define BTN_SINGLE BIT(7)
u8 btn_read();
u8 btn_read_vol();
u8 btn_read_home();
u8 btn_wait();
u8 btn_wait_timeout(u32 time_ms, u8 mask);
u8 btn_wait_timeout_single(u32 time_ms, u8 mask);