From c07814fce15b8c48d38bcbf0d55b6800d9a91fd2 Mon Sep 17 00:00:00 2001 From: Steve Gotthardt Date: Sun, 7 Jan 2007 06:38:57 +0000 Subject: Revamped the backlight state machine and added buttonlight controls. Go to the Info/debug menu and test out the new modes for buttonlights on the Gigabeat - ON, OFF, Faint, and flicker - flickers on touchpad and disk reads. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11935 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'apps') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 4f2266ff47..3785374338 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2089,6 +2089,98 @@ static bool dbg_lcd_power_off(void) return false; } +#include "backlight-target.h" + +static bool dbg_buttonlights(void) +{ + unsigned short mode_changed = 1, mode = 0; + unsigned short which_led = BUTTONLIGHT_LED_ALL; + + lcd_setmargins(0, 0); + for (;;) + { + int button; + + + if (mode_changed) + { + lcd_clear_display(); + lcd_puts(0, 0, "Button light support"); + lcd_puts(0, 1, "Press UP for mode change"); + lcd_puts(0, 2, "Press DOWN for buttonlight selection"); + + switch (mode) + { + case 0: + lcd_puts(1, 3, "Off"); + __buttonlight_mode(BUTTONLIGHT_OFF); + break; + + case 1: + lcd_puts(1, 3, "On"); + __buttonlight_mode(BUTTONLIGHT_ON); + break; + + case 2: + lcd_puts(1, 3, "Faint"); + __buttonlight_mode(BUTTONLIGHT_FAINT); + break; + + case 3: + lcd_puts(1, 3, "Flicker"); + __buttonlight_mode(BUTTONLIGHT_FLICKER); + break; + + } + mode_changed = 0; + lcd_update(); + } + + + + /* does nothing unless in flicker mode */ + /* the parameter sets the brightness */ + __buttonlight_flicker(20); + button = get_action(CONTEXT_STD,HZ/5); + switch(button) + { + case ACTION_STD_PREV: + mode++; + if (mode > 3) mode = 0; + mode_changed = 1; + break; + + case ACTION_STD_NEXT: + if (which_led == BUTTONLIGHT_LED_ALL) + { + which_led = BUTTONLIGHT_LED_MENU; + } + else + { + which_led = BUTTONLIGHT_LED_ALL; + } + + __buttonlight_select(which_led); + + break; + + + case ACTION_STD_OK: + case ACTION_STD_CANCEL: + action_signalscreenchange(); + return false; + + default: + sleep(HZ/10); + break; + } + } + return false; +} + + + + #endif #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) @@ -2141,6 +2233,8 @@ bool debug_menu(void) static const struct menu_item items[] = { #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) { "LCD Power Off", dbg_lcd_power_off }, + { "Button Light modes", dbg_buttonlights }, + #endif #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) { "Dump ROM contents", dbg_save_roms }, -- cgit v1.2.3