[INI] Fix memory leaks + other fixes (#38)
* [INI] Fix memory leaks + other fixes * Add ini_free * check and return if NULL pointer in free() * Add button check with timeout * Fix a bug in menu rendering that tries to parse a string without existing * Change initial cnt value to max (fixes menus with first entry not a selectable entry) * Some & ? clarifications * [INI] Add get selected boot cfg - This allows to free ini as we launch the firmware and have the lowest mem leak * [INI] Rename ini section clone/free functions
This commit is contained in:
18
ipl/btn.c
18
ipl/btn.c
@@ -18,6 +18,7 @@
|
||||
#include "i2c.h"
|
||||
#include "gpio.h"
|
||||
#include "t210.h"
|
||||
#include "util.h"
|
||||
|
||||
u32 btn_read()
|
||||
{
|
||||
@@ -53,5 +54,22 @@ u32 btn_wait()
|
||||
else if (pwr)
|
||||
res &= 0xFFFFFFFE;
|
||||
} while (btn == res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 btn_wait_timeout(u32 time_ms)
|
||||
{
|
||||
u32 timeout = get_tmr() + (time_ms * 1000);
|
||||
u32 res = btn_read();
|
||||
u32 btn = res;
|
||||
|
||||
do
|
||||
{
|
||||
//Keep the new value until timeout is reached
|
||||
if (btn == res)
|
||||
res = btn_read();
|
||||
} while (get_tmr() < timeout);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user