General additions, fixes and bugfixes
This commit is contained in:
10
ipl/btn.c
10
ipl/btn.c
@@ -58,17 +58,15 @@ u32 btn_wait()
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 btn_wait_timeout(u32 time_ms)
|
||||
u32 btn_wait_timeout(u32 time_ms, u32 mask)
|
||||
{
|
||||
u32 timeout = get_tmr() + (time_ms * 1000);
|
||||
u32 res = btn_read();
|
||||
u32 btn = res;
|
||||
u32 res = btn_read() & mask;
|
||||
|
||||
do
|
||||
{
|
||||
//Keep the new value until timeout is reached
|
||||
if (btn == res)
|
||||
res = btn_read();
|
||||
if (!(res & mask))
|
||||
res = btn_read() & mask;
|
||||
} while (get_tmr() < timeout);
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user