summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2011-01-03 13:11:48 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2011-01-03 13:11:48 +0000
commit67feb810848d2f654dd782ee675d83cc96c9460b (patch)
tree37bf1e1396c0730bc3da36248ec4996abdced500 /bootloader
parent80b50e75872fb18f427ff4fdd1f7c58406b8e2c3 (diff)
downloadrockbox-67feb810848d2f654dd782ee675d83cc96c9460b.tar.gz
rockbox-67feb810848d2f654dd782ee675d83cc96c9460b.tar.bz2
rockbox-67feb810848d2f654dd782ee675d83cc96c9460b.zip
MPIO bootloader - turn off backlight when hold is on. Usefull feature when charging during night.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28958 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/mpio_hd200_hd300.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/bootloader/mpio_hd200_hd300.c b/bootloader/mpio_hd200_hd300.c
index 14f76354fb..be36daf2ef 100644
--- a/bootloader/mpio_hd200_hd300.c
+++ b/bootloader/mpio_hd200_hd300.c
@@ -344,6 +344,14 @@ void main(void)
bool blink_toggle = false;
int button;
+
+ /* hold status variables
+ * this two must have different
+ * values in the begining
+ */
+ bool hold = false;
+ bool last_hold = true;
+
unsigned int event = EVENT_NONE;
unsigned int last_event = EVENT_NONE;
@@ -364,21 +372,20 @@ void main(void)
lcd_init();
- /* only lowlevel functions no queue init */
- _backlight_init();
- _backlight_hw_on();
-
- /* setup font system*/
+ /* setup font system */
font_init();
lcd_setfont(FONT_SYSFIXED);
- /* buttons reading init*/
+ /* buttons reading init */
adc_init();
button_init();
usb_init();
cpu_idle_mode(true);
+ /* lowlevel init only */
+ _backlight_init();
+
/* Handle wakeup event. Possibilities are:
* RTC alarm (HD300)
* ON button (PLAY or RC_PLAY on HD200)
@@ -387,6 +394,21 @@ void main(void)
*/
while(1)
{
+ /* check hold status */
+ hold = button_hold();
+
+ /* backlight handling
+ * change only on hold toggle */
+ if ( hold != last_hold )
+ {
+ if ( hold )
+ _backlight_hw_off();
+ else
+ _backlight_hw_on();
+
+ last_hold = hold;
+ }
+
/* read buttons */
event = EVENT_NONE;
button = button_get_w_tmo(HZ);
@@ -407,6 +429,7 @@ void main(void)
if ( _rtc_alarm() )
event |= EVENT_RTC;
#endif
+
reset_screen();
switch (event)
{