Restrict "Backlight on first keypress" to certain buttons Allow button-target.h to define the buttons that are filtered by the "Backlight on first keypress" function. If left undefined, the function filters all buttons when the backlight is off. --- firmware/drivers/button.c | 8 +++++++- .../target/arm/as3525/sansa-clip/button-target.h | 4 ++++ .../arm/as3525/sansa-clipplus/button-target.h | 4 ++++ .../target/arm/as3525/sansa-clipv2/button-target.h | 4 ++++ 4 files changed, 19 insertions(+), 1 deletions(-) diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index c2df006..44e3cc4 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -302,6 +302,9 @@ static void button_tick(void) #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) || (remote_type()==REMOTETYPE_H300_NONLCD) #endif +#ifdef BUTTON_BACKLIGHT + || !(btn & BUTTON_BACKLIGHT) +#endif ) button_try_post(btn, data); else @@ -313,7 +316,10 @@ static void button_tick(void) #if BUTTON_REMOTE || (btn & BUTTON_REMOTE) #endif - ) +#ifdef BUTTON_BACKLIGHT + || !(btn & BUTTON_BACKLIGHT) +#endif + ) button_try_post(btn, data); else skip_release = true; diff --git a/firmware/target/arm/as3525/sansa-clip/button-target.h b/firmware/target/arm/as3525/sansa-clip/button-target.h index 238fd1d..20694a9 100644 --- a/firmware/target/arm/as3525/sansa-clip/button-target.h +++ b/firmware/target/arm/as3525/sansa-clip/button-target.h @@ -56,4 +56,8 @@ bool button_hold(void); #define POWEROFF_BUTTON BUTTON_POWER #define POWEROFF_COUNT 10 +/* Buttons to filter when backlight is off and filter_first_keypress + is enabled */ +#define BUTTON_BACKLIGHT BUTTON_HOME + #endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/as3525/sansa-clipplus/button-target.h b/firmware/target/arm/as3525/sansa-clipplus/button-target.h index c341a94..e5a1227 100644 --- a/firmware/target/arm/as3525/sansa-clipplus/button-target.h +++ b/firmware/target/arm/as3525/sansa-clipplus/button-target.h @@ -53,4 +53,8 @@ int button_read_device(void); #define POWEROFF_BUTTON BUTTON_POWER #define POWEROFF_COUNT 10 +/* Buttons to filter when backlight is off and filter_first_keypress + is enabled */ +#define BUTTON_BACKLIGHT BUTTON_HOME + #endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/as3525/sansa-clipv2/button-target.h b/firmware/target/arm/as3525/sansa-clipv2/button-target.h index 238fd1d..20694a9 100644 --- a/firmware/target/arm/as3525/sansa-clipv2/button-target.h +++ b/firmware/target/arm/as3525/sansa-clipv2/button-target.h @@ -56,4 +56,8 @@ bool button_hold(void); #define POWEROFF_BUTTON BUTTON_POWER #define POWEROFF_COUNT 10 +/* Buttons to filter when backlight is off and filter_first_keypress + is enabled */ +#define BUTTON_BACKLIGHT BUTTON_HOME + #endif /* _BUTTON_TARGET_H_ */ -- 1.7.1