util: Add btn_read_vol

This commit is contained in:
CTCaer
2020-04-14 17:51:42 +03:00
parent 281e5a138e
commit 9af4c717a8
7 changed files with 28 additions and 13 deletions

View File

@@ -34,6 +34,16 @@ u8 btn_read()
return res;
}
u8 btn_read_vol()
{
u8 res = 0;
if (!gpio_read(GPIO_PORT_X, GPIO_PIN_7))
res |= BTN_VOL_DOWN;
if (!gpio_read(GPIO_PORT_X, GPIO_PIN_6))
res |= BTN_VOL_UP;
return res;
}
u8 btn_wait()
{
u8 res = 0, btn = btn_read();

View File

@@ -26,6 +26,7 @@
#define BTN_SINGLE (1 << 7)
u8 btn_read();
u8 btn_read_vol();
u8 btn_wait();
u8 btn_wait_timeout(u32 time_ms, u8 mask);