diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-05-02 21:55:26 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-05-28 17:38:10 +0200 |
commit | 2dcc9fc39ffadc3828bde52df4843d91f5f66216 (patch) | |
tree | ae5d65520ec8300886e3fd7e465ec9fbf3258faa /firmware/target/arm | |
parent | 941ac165d864ccdd4e4ae870366f4e0a6bc30055 (diff) |
imx233: fix debug screen button handling
The code was very primitive and did not handle release events properly.
Change-Id: I1c56005282a9fb6608f79ff3b483ba614d635fdb
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index c1820c8fe2..a97907b775 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c @@ -55,13 +55,8 @@ #define ACT_RIGHT 6 #define ACT_REPEAT 0x1000 -int my_get_action(int tmo) +int xlate_button(int btn) { - int btn = button_get_w_tmo(tmo); - while(btn & BUTTON_REL) - btn = button_get_w_tmo(tmo); - bool repeat = btn & BUTTON_REPEAT; - int act = ACT_NONE; switch(btn) { case BUTTON_POWER: @@ -72,8 +67,7 @@ int my_get_action(int tmo) #else #error no key for ACT_CANCEL #endif - act = ACT_CANCEL; - break; + return ACT_CANCEL; #if defined(BUTTON_SELECT) case BUTTON_SELECT: #elif defined(BUTTON_PLAY) @@ -83,17 +77,28 @@ int my_get_action(int tmo) #else #error no key for ACT_OK #endif - act = ACT_OK; - break; + return ACT_OK; case BUTTON_UP: - act = ACT_PREV; - break; + return ACT_PREV; case BUTTON_DOWN: - act = ACT_NEXT; - break; + return ACT_NEXT; default: - yield(); + return ACT_NONE; } +} + +int my_get_status(void) +{ + return xlate_button(button_status()); +} + +int my_get_action(int tmo) +{ + int btn = button_get_w_tmo(tmo); + while(btn & BUTTON_REL) + btn = button_get_w_tmo(tmo); + bool repeat = btn & BUTTON_REPEAT; + int act = xlate_button(btn & ~BUTTON_REPEAT); if(repeat) act |= ACT_REPEAT; return act; @@ -217,7 +222,7 @@ bool dbg_hw_info_power(void) bool en; int linreg; char buf[16]; - + lcd_putsf(0, line++, "name value bo linreg"); #define DISP_REGULATOR(name) \ imx233_power_get_regulator(REGULATOR_##name, &trg, &bo); \ @@ -254,7 +259,7 @@ bool dbg_hw_info_power(void) bool dbg_hw_info_lradc(void) { lcd_setfont(FONT_SYSFIXED); - + while(1) { int button = my_get_action(HZ / 25); @@ -679,7 +684,7 @@ bool dbg_hw_info_ocotp(void) } if(i < top_user) top_user = i - 1; - + lcd_update(); yield(); } |