Merge interim hekate bugfixes

This commit is contained in:
shchmue 2019-04-18 12:47:34 -04:00
parent 04d989a345
commit e1ffda6ab9
36 changed files with 549 additions and 859 deletions

View file

@ -22,9 +22,9 @@
#include "util.h"
#include "../power/max77620.h"
u32 btn_read()
u8 btn_read()
{
u32 res = 0;
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))
@ -34,9 +34,9 @@ u32 btn_read()
return res;
}
u32 btn_wait()
u8 btn_wait()
{
u32 res = 0, btn = btn_read();
u8 res = 0, btn = btn_read();
bool pwr = false;
//Power button down, raise a filter.
@ -59,16 +59,18 @@ u32 btn_wait()
return res;
}
u32 btn_wait_timeout(u32 time_ms, u32 mask)
u8 btn_wait_timeout(u32 time_ms, u8 mask)
{
u32 timeout = get_tmr_ms() + time_ms;
u32 res = btn_read() & mask;
u8 res = btn_read() & mask;
do
while (get_tmr_ms() < timeout)
{
if (!(res & mask))
if (res == mask)
break;
else
res = btn_read() & mask;
} while (get_tmr_ms() < timeout);
};
return res;
}