summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Gotthardt <gotthardt@rockbox.org>2007-01-08 08:53:36 +0000
committerSteve Gotthardt <gotthardt@rockbox.org>2007-01-08 08:53:36 +0000
commit93b047fffec9b6d3b5ef1697c3034caa83944182 (patch)
tree430b4482bd77c6d860a14048b25310db5aa8943d
parent2446b22db971668f8d6ba5cb2361aabbda286da1 (diff)
downloadrockbox-93b047fffec9b6d3b5ef1697c3034caa83944182.tar.gz
rockbox-93b047fffec9b6d3b5ef1697c3034caa83944182.zip
Updated buttonlights for the Gigabeat port. Added LCD controller off and on for extra power savings - thanks to Greg White. Incorporated feedback from Gary Allen. Added 'battery charging' mode: shows leds during charging. Added 'follow' mode that turns off leds when backlight goes off. Flicker mode and new solid mode only show during disk access. Access settings from Info/debug menu for now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11945 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c41
-rw-r--r--firmware/backlight.c2
-rw-r--r--firmware/export/config-gigabeat.h2
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c2
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c335
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/backlight-target.h32
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c2
7 files changed, 291 insertions, 125 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 3785374338..083dddbd74 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2094,14 +2094,14 @@ static bool dbg_lcd_power_off(void)
static bool dbg_buttonlights(void)
{
unsigned short mode_changed = 1, mode = 0;
- unsigned short which_led = BUTTONLIGHT_LED_ALL;
+ enum buttonlight_selection which_led = BUTTONLIGHT_LED_ALL;
+ unsigned short brightness = DEFAULT_BRIGHTNESS_SETTING;
lcd_setmargins(0, 0);
for (;;)
{
int button;
-
if (mode_changed)
{
lcd_clear_display();
@@ -2113,22 +2113,37 @@ static bool dbg_buttonlights(void)
{
case 0:
lcd_puts(1, 3, "Off");
- __buttonlight_mode(BUTTONLIGHT_OFF);
+ __buttonlight_mode(BUTTONLIGHT_OFF, which_led, brightness);
break;
case 1:
- lcd_puts(1, 3, "On");
- __buttonlight_mode(BUTTONLIGHT_ON);
+ lcd_puts(1, 3, "On - Set to brightness");
+ __buttonlight_mode(BUTTONLIGHT_ON, which_led, brightness);
break;
case 2:
- lcd_puts(1, 3, "Faint");
- __buttonlight_mode(BUTTONLIGHT_FAINT);
+ lcd_puts(1, 3, "Faint - Always on at lowest brightness");
+ __buttonlight_mode(BUTTONLIGHT_FAINT, which_led, brightness);
break;
case 3:
- lcd_puts(1, 3, "Flicker");
- __buttonlight_mode(BUTTONLIGHT_FLICKER);
+ lcd_puts(1, 3, "Flicker on disk access");
+ __buttonlight_mode(BUTTONLIGHT_FLICKER, which_led, brightness);
+ break;
+
+ case 4:
+ lcd_puts(1, 3, "Solid on disk access");
+ __buttonlight_mode(BUTTONLIGHT_SIGNAL, which_led, brightness);
+ break;
+
+ case 5:
+ lcd_puts(1, 3, "Follows backlight");
+ __buttonlight_mode(BUTTONLIGHT_FOLLOW, which_led, brightness);
+ break;
+
+ case 6:
+ lcd_puts(1, 3, "Shows 'battery charging'");
+ __buttonlight_mode(BUTTONLIGHT_CHARGING, which_led, brightness);
break;
}
@@ -2140,13 +2155,12 @@ static bool dbg_buttonlights(void)
/* does nothing unless in flicker mode */
/* the parameter sets the brightness */
- __buttonlight_flicker(20);
+ __buttonlight_trigger();
button = get_action(CONTEXT_STD,HZ/5);
switch(button)
{
case ACTION_STD_PREV:
- mode++;
- if (mode > 3) mode = 0;
+ if (++mode > 6) mode = 0;
mode_changed = 1;
break;
@@ -2159,8 +2173,7 @@ static bool dbg_buttonlights(void)
{
which_led = BUTTONLIGHT_LED_ALL;
}
-
- __buttonlight_select(which_led);
+ mode_changed = 1;
break;
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 9494be107b..63bde6a868 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -291,6 +291,8 @@ static void _backlight_on(void)
__backlight_on();
}
#elif defined(HAVE_BACKLIGHT_SET_FADING) && !defined(SIMULATOR)
+ /* call the enable from here - it takes longer than the disable */
+ lcd_enable(true);
__backlight_dim(false);
#else
__backlight_on();
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 3672bdfdb5..4a1d11d43a 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -41,6 +41,8 @@
/* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */
+#define HAVE_LCD_ENABLE
+
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Main LCD backlight brightness range and defaults */
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
index 5e0fd8429c..8e246045e6 100644
--- a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
@@ -55,7 +55,7 @@ void ata_device_init(void)
void copy_read_sectors(unsigned char* buf, int wordcount)
{
- __buttonlight_flicker(DEFAULT_BRIGHTNESS_SETTING);
+ __buttonlight_trigger();
/* Unaligned transfer - slow copy */
if ( (unsigned long)buf & 1)
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
index 173d2ce38b..b97e1430b2 100644
--- a/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-meg-fx.c
@@ -23,6 +23,8 @@
#include "backlight.h"
#include "lcd.h"
#include "sc606-meg-fx.h"
+#include "power.h"
+
#define FLICKER_PERIOD 15
#define BUTTONLIGHT_MENU (SC606_LED_B1)
@@ -56,7 +58,7 @@ enum buttonlight_states
BUTTONLIGHT_MODE_OFF_ENTRY,
BUTTONLIGHT_MODE_OFF,
- /* turns button lights on to same brightness as backlight */
+ /* turns button lights on to setting */
BUTTONLIGHT_MODE_ON_ENTRY,
BUTTONLIGHT_MODE_ON,
@@ -69,13 +71,23 @@ enum buttonlight_states
BUTTONLIGHT_MODE_FLICKER,
BUTTONLIGHT_MODE_FLICKERING,
- /* button lights glow */
- BUTTONLIGHT_MODE_GLOW_ENTRY,
- BUTTONLIGHT_MODE_GLOW,
+ /* button lights solid */
+ BUTTONLIGHT_MODE_SOLID_ENTRY,
+ BUTTONLIGHT_MODE_SOLID,
+ /* button light charing */
+ BUTTONLIGHT_MODE_CHARGING_ENTRY,
+ BUTTONLIGHT_MODE_CHARGING,
+ BUTTONLIGHT_MODE_CHARGING_WAIT,
+
/* internal use only */
BUTTONLIGHT_HELPER_SET,
BUTTONLIGHT_HELPER_SET_FINAL,
+ BUTTONLIGHT_MODE_STOP,
+
+ /* buttonlights follow the backlight settings */
+ BUTTONLIGHT_MODE_FOLLOW_ENTRY,
+ BUTTONLIGHT_MODE_FOLLOW,
};
@@ -87,10 +99,18 @@ static unsigned char buttonlight_selected;
static enum buttonlight_states buttonlight_state;
static enum buttonlight_states buttonlight_saved_state;
static unsigned short buttonlight_flickering;
-static unsigned short buttonlight_flicker_now;
-static unsigned short buttonlight_flicker_brightness;
+
+static unsigned short buttonlight_trigger_now;
+static unsigned short buttonlight_trigger_brightness;
+
+static unsigned short charging_led_index;
+static unsigned short buttonlight_charging_counter;
+
+#define CHARGING_LED_COUNT 60
+unsigned char charging_leds[] = { 0x00, 0x20, 0x38, 0x3C };
+
void __backlight_init(void)
@@ -111,10 +131,12 @@ void __backlight_init(void)
void __backlight_on(void)
{
+ /* now go turn the backlight on */
backlight_control = BACKLIGHT_CONTROL_ON;
}
+
void __backlight_off(void)
{
backlight_control = BACKLIGHT_CONTROL_OFF;
@@ -139,45 +161,45 @@ void __backlight_set_brightness(int brightness)
-/* only works if the buttonlight mode is set to flicker */
-void __buttonlight_flicker(unsigned short brightness)
+/* only works if the buttonlight mode is set to triggered mode */
+void __buttonlight_trigger(void)
{
- /* clip the setting */
- if (brightness > MAX_BRIGHTNESS_SETTING)
- {
- brightness = MAX_BRIGHTNESS_SETTING;
- }
-
- /* add one because we subtract later for full range */
- buttonlight_flicker_brightness = brightness + 1;
- buttonlight_flicker_now = 1;
+ buttonlight_trigger_now = 1;
}
+
-/* select which LEDs light up
- * The only pleasing combinations are: only menu/power or all LEDs
- */
-void __buttonlight_select(enum buttonlight_selection selection)
+/* map the mode from the command into the state machine entries */
+void __buttonlight_mode(enum buttonlight_mode mode,
+ enum buttonlight_selection selection,
+ unsigned short brightness)
{
+ /* choose stop to setup mode */
+ buttonlight_state = BUTTONLIGHT_MODE_STOP;
+
+
+ /* clip brightness */
+ if (brightness > MAX_BRIGHTNESS_SETTING)
+ {
+ brightness = MAX_BRIGHTNESS_SETTING;
+ }
+
+ brightness++;
+
+ /* Select which LEDs to use */
switch (selection)
{
- default:
- case BUTTONLIGHT_LED_MENU:
- buttonlight_selected = BUTTONLIGHT_MENU;
- break;
-
case BUTTONLIGHT_LED_ALL:
buttonlight_selected = BUTTONLIGHT_ALL;
break;
- }
-}
+ case BUTTONLIGHT_LED_MENU:
+ buttonlight_selected = BUTTONLIGHT_MENU;
+ break;
+ }
-
-/* map the mode from the command into the state machine entries */
-void __buttonlight_mode(enum buttonlight_mode mode)
-{
+ /* which mode to use */
switch (mode)
{
case BUTTONLIGHT_OFF:
@@ -185,22 +207,39 @@ void __buttonlight_mode(enum buttonlight_mode mode)
break;
case BUTTONLIGHT_ON:
+ buttonlight_trigger_brightness = brightness;
buttonlight_state = BUTTONLIGHT_MODE_ON_ENTRY;
break;
-
+
+ /* faint is just a quick way to set ON to 1 */
case BUTTONLIGHT_FAINT:
- buttonlight_state = BUTTONLIGHT_MODE_FAINT_ENTRY;
+ buttonlight_trigger_brightness = 1;
+ buttonlight_state = BUTTONLIGHT_MODE_ON_ENTRY;
break;
case BUTTONLIGHT_FLICKER:
+ buttonlight_trigger_brightness = brightness;
buttonlight_state = BUTTONLIGHT_MODE_FLICKER_ENTRY;
break;
+ case BUTTONLIGHT_SIGNAL:
+ buttonlight_trigger_brightness = brightness;
+ buttonlight_state = BUTTONLIGHT_MODE_SOLID_ENTRY;
+ break;
+
+ case BUTTONLIGHT_FOLLOW:
+ buttonlight_state = BUTTONLIGHT_MODE_FOLLOW_ENTRY;
+ break;
+
+ case BUTTONLIGHT_CHARGING:
+ buttonlight_state = BUTTONLIGHT_MODE_CHARGING_ENTRY;
+ break;
+
default:
return; /* unknown mode */
}
-
+
}
@@ -234,6 +273,8 @@ static void led_control_service(void)
case BACKLIGHT_CONTROL_IDLE:
switch (buttonlight_state)
{
+ case BUTTONLIGHT_MODE_STOP: break;
+
/* Buttonlight mode: OFF */
case BUTTONLIGHT_MODE_OFF_ENTRY:
if (buttonlight_current)
@@ -248,52 +289,127 @@ static void led_control_service(void)
case BUTTONLIGHT_MODE_OFF:
break;
-
- /* Buttonlight mode: ON */
- case BUTTONLIGHT_MODE_ON_ENTRY:
- case BUTTONLIGHT_MODE_ON:
- if (buttonlight_current != backlight_brightness ||
- (buttonlight_leds != buttonlight_selected))
- {
- buttonlight_leds = buttonlight_selected;
- sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
- /* temporary save for the next mode - then to do settings */
- buttonlight_setting = backlight_brightness;
- buttonlight_saved_state = BUTTONLIGHT_MODE_ON;
- buttonlight_state = BUTTONLIGHT_HELPER_SET;
- }
- break;
+ /* button mode: CHARGING - show charging sequence */
+ case BUTTONLIGHT_MODE_CHARGING_ENTRY:
+ /* start turned off */
+ buttonlight_leds = 0x00;
+ sc606_write(SC606_REG_CONF, backlight_leds);
+ buttonlight_current = 0;
+ /* temporary save for the next mode - then to do settings */
+ buttonlight_setting = DEFAULT_BRIGHTNESS_SETTING;
+ buttonlight_saved_state = BUTTONLIGHT_MODE_CHARGING_WAIT;
+ buttonlight_state = BUTTONLIGHT_HELPER_SET;
+ break;
+
- /* Buttonlight mode: Faint */
- case BUTTONLIGHT_MODE_FAINT_ENTRY:
- if (buttonlight_current != 1)
+ case BUTTONLIGHT_MODE_CHARGING:
+ if (--buttonlight_charging_counter == 0)
{
- /* need to turn on the backlight? */
- if (buttonlight_current == 0)
+ /* change led */
+ if (charging_state())
{
- buttonlight_leds = buttonlight_selected;
+ buttonlight_leds = charging_leds[charging_led_index];
+ if (++charging_led_index >= sizeof(charging_leds))
+ {
+ charging_led_index = 0;
+ }
sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
+ buttonlight_charging_counter = CHARGING_LED_COUNT;
+ }
+ else
+ {
+ buttonlight_state = BUTTONLIGHT_MODE_CHARGING_ENTRY;
}
-
- /* temporary save for the next mode - then to do settings */
- buttonlight_setting = 1;
- buttonlight_saved_state = BUTTONLIGHT_MODE_FAINT;
- buttonlight_state = BUTTONLIGHT_HELPER_SET;
}
break;
- case BUTTONLIGHT_MODE_FAINT:
- /* watch for change in led selction */
- if (buttonlight_leds != buttonlight_selected)
+ /* wait for the charget to be plugged in */
+ case BUTTONLIGHT_MODE_CHARGING_WAIT:
+ if (charging_state())
{
+ charging_led_index = 0;
+ buttonlight_charging_counter = CHARGING_LED_COUNT;
+ buttonlight_state = BUTTONLIGHT_MODE_CHARGING;
+ }
+ break;
+
+
+ /* Buttonlight mode: FOLLOW - try to stay current with backlight
+ * since this runs in the idle of the backlight it will not really
+ * follow in real time
+ */
+ case BUTTONLIGHT_MODE_FOLLOW_ENTRY:
+ /* case 1 - backlight on, but buttonlight is off */
+ if (backlight_current)
+ {
+ /* Turn the buttonlights on */
buttonlight_leds = buttonlight_selected;
sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
+
+ /* temporary save for the next mode - then to do settings */
+ buttonlight_setting = backlight_current;
+ buttonlight_saved_state = BUTTONLIGHT_MODE_FOLLOW;
+ buttonlight_state = BUTTONLIGHT_HELPER_SET;
}
+ /* case 2 - backlight off, but buttonlight is on */
+ else
+ {
+ buttonlight_current = 0;
+ buttonlight_leds = 0x00;
+ sc606_write(SC606_REG_CONF, backlight_leds);
+ buttonlight_state = BUTTONLIGHT_MODE_FOLLOW;
+ }
+ break;
+
+ case BUTTONLIGHT_MODE_FOLLOW:
+ if (buttonlight_current != backlight_current)
+ {
+ /* case 1 - backlight on, but buttonlight is off */
+ if (backlight_current)
+ {
+ if (0 == buttonlight_current)
+ {
+ /* Turn the buttonlights on */
+ buttonlight_leds = buttonlight_selected;
+ sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
+ }
+
+ /* temporary save for the next mode - then to do settings */
+ buttonlight_setting = backlight_current;
+ buttonlight_saved_state = BUTTONLIGHT_MODE_FOLLOW;
+ buttonlight_state = BUTTONLIGHT_HELPER_SET;
+ }
+
+ /* case 2 - backlight off, but buttonlight is on */
+ else
+ {
+ buttonlight_current = 0;
+ buttonlight_leds = 0x00;
+ sc606_write(SC606_REG_CONF, backlight_leds);
+ }
+
+ }
+ break;
+
+
+ /* Buttonlight mode: ON - stays at the set brightness */
+ case BUTTONLIGHT_MODE_ON_ENTRY:
+ buttonlight_leds = buttonlight_selected;
+ sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
+
+ /* temporary save for the next mode - then to do settings */
+ buttonlight_setting = buttonlight_trigger_brightness;
+ buttonlight_saved_state = BUTTONLIGHT_MODE_ON;
+ buttonlight_state = BUTTONLIGHT_HELPER_SET;
break;
+ case BUTTONLIGHT_MODE_ON:
+ break;
+
+
/* Buttonlight mode: FLICKER */
case BUTTONLIGHT_MODE_FLICKER_ENTRY:
@@ -306,19 +422,20 @@ static void led_control_service(void)
}
/* set the brightness if not already set */
- if (buttonlight_current != buttonlight_flicker_brightness)
+ if (buttonlight_current != buttonlight_trigger_brightness)
{
/* temporary save for the next mode - then to do settings */
- buttonlight_setting = buttonlight_flicker_brightness;
+ buttonlight_setting = buttonlight_trigger_brightness;
buttonlight_saved_state = BUTTONLIGHT_MODE_FLICKER;
buttonlight_state = BUTTONLIGHT_HELPER_SET;
}
+ else buttonlight_state = BUTTONLIGHT_MODE_FLICKER;
break;
case BUTTONLIGHT_MODE_FLICKER:
/* wait for the foreground to trigger flickering */
- if (buttonlight_flicker_now)
+ if (buttonlight_trigger_now)
{
/* turn them on */
buttonlight_leds = buttonlight_selected;
@@ -326,7 +443,7 @@ static void led_control_service(void)
sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
/* reset the trigger and go flicker the LEDs */
- buttonlight_flicker_now = 0;
+ buttonlight_trigger_now = 0;
buttonlight_flickering = FLICKER_PERIOD;
buttonlight_state = BUTTONLIGHT_MODE_FLICKERING;
}
@@ -350,7 +467,7 @@ static void led_control_service(void)
else
{
/* is flickering triggered again? */
- if (!buttonlight_flicker_now)
+ if (!buttonlight_trigger_now)
{
/* completed a cycle - no new triggers - go back and wait */
buttonlight_state = BUTTONLIGHT_MODE_FLICKER;
@@ -358,7 +475,7 @@ static void led_control_service(void)
else
{
/* reset flickering */
- buttonlight_flicker_now = 0;
+ buttonlight_trigger_now = 0;
buttonlight_flickering = FLICKER_PERIOD;
/* turn buttonlights on */
@@ -369,6 +486,52 @@ static void led_control_service(void)
}
break;
+
+ /* Buttonlight mode: SIGNAL / SOLID */
+ case BUTTONLIGHT_MODE_SOLID_ENTRY:
+ /* already on? turn it off */
+ if (buttonlight_current)
+ {
+ buttonlight_leds = 0x00;
+ sc606_write(SC606_REG_CONF, backlight_leds);
+ buttonlight_current = 0;
+ }
+
+ /* set the brightness if not already set */
+ /* temporary save for the next mode - then to do settings */
+ buttonlight_setting = buttonlight_trigger_brightness;
+ buttonlight_saved_state = BUTTONLIGHT_MODE_SOLID;
+ buttonlight_state = BUTTONLIGHT_HELPER_SET;
+ break;
+
+
+ case BUTTONLIGHT_MODE_SOLID:
+ /* wait for the foreground to trigger */
+ if (buttonlight_trigger_now)
+ {
+ /* turn them on if not already on */
+ if (0 == buttonlight_current)
+ {
+ buttonlight_leds = buttonlight_selected;
+ buttonlight_current = buttonlight_setting;
+ sc606_write(SC606_REG_CONF, backlight_leds | buttonlight_leds);
+ }
+
+ /* reset the trigger */
+ buttonlight_trigger_now = 0;
+ }
+ else
+ {
+ if (buttonlight_current)
+ {
+ buttonlight_leds = 0x00;
+ sc606_write(SC606_REG_CONF, backlight_leds);
+ buttonlight_current = 0;
+ }
+ }
+ break;
+
+
/* set the brightness for the buttonlights - takes 2 passes */
case BUTTONLIGHT_HELPER_SET:
sc606_write(SC606_REG_B, buttonlight_setting-1);
@@ -400,6 +563,9 @@ static void led_control_service(void)
backlight_leds = 0x00;
sc606_write(SC606_REG_CONF, buttonlight_leds);
backlight_control = BACKLIGHT_CONTROL_IDLE;
+
+ /* turn the lcd completely off after the fade or off command */
+ lcd_enable(false);
break;
@@ -514,32 +680,3 @@ void __backlight_dim(bool dim_now)
}
-
-
-#define BACKLIGHT_BUTTONS_OFF 0
-#define BACKLIGHT_BUTTONS_ON 1
-#define BACKLIGHT_BUTTONS_FAINT 2
-#define BACKLIGHT_BUTTONS_FOLLOW 3
-
-
-void __backlight_buttons(int value)
-{
- switch (value)
- {
- default:
- case BACKLIGHT_BUTTONS_OFF:
- break;
-
- case BACKLIGHT_BUTTONS_ON:
- break;
-
- case BACKLIGHT_BUTTONS_FAINT:
- break;
-
- case BACKLIGHT_BUTTONS_FOLLOW:
- break;
-
- }
-
-}
-
diff --git a/firmware/target/arm/gigabeat/meg-fx/backlight-target.h b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h
index 67a055449c..781fb9647b 100644
--- a/firmware/target/arm/gigabeat/meg-fx/backlight-target.h
+++ b/firmware/target/arm/gigabeat/meg-fx/backlight-target.h
@@ -34,7 +34,7 @@ enum buttonlight_selection
/* Use these to set the buttonlight mode */
enum buttonlight_mode
{
- /* ON follows the setting of the backlight - same brightness */
+ /* ON follows the setting */
BUTTONLIGHT_ON,
/* buttonlights always off */
@@ -43,23 +43,37 @@ enum buttonlight_mode
/* buttonlights always on but set at lowest brightness */
BUTTONLIGHT_FAINT,
- /* buttonlights flicker when triggered */
+ /* buttonlights flicker when triggered - continues to flicker
+ * even if the flicker is still asserted.
+ */
BUTTONLIGHT_FLICKER,
-};
-
-/* call to flicker the button lights */
-void __buttonlight_flicker(unsigned short brightness);
+ /* buttonlights solid for as long as triggered */
+ BUTTONLIGHT_SIGNAL,
+
+ /* buttonlights follow backlight */
+ BUTTONLIGHT_FOLLOW,
+
+ /* buttonlights show battery charging */
+ BUTTONLIGHT_CHARGING,
+};
-/* only use the XX__ENTRY when setting the mode */
-void __buttonlight_mode(enum buttonlight_mode mode);
+/* Call this to flicker or signal the button lights. Only is effective for
+ * modes that take a trigger input.
+ */
+void __buttonlight_trigger(void);
/* select which led to use on the button lights. Other combinations are
* possible, but don't look very good.
*/
-void __buttonlight_select(enum buttonlight_selection selection);
+
+/* map the mode from the command into the state machine entries */
+/* See enum buttonlight_mode for available functions */
+void __buttonlight_mode(enum buttonlight_mode mode,
+ enum buttonlight_selection selection,
+ unsigned short brightness);
void __backlight_init(void);
diff --git a/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c
index c5d0251323..117e1114af 100644
--- a/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/button-meg-fx.c
@@ -123,8 +123,6 @@ int button_read_device(void)
if (touchpad & (1 << 3))
btn |= BUTTON_SELECT;
-
- __buttonlight_flicker(DEFAULT_BRIGHTNESS_SETTING/2);
}
return btn;