From 67feb810848d2f654dd782ee675d83cc96c9460b Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Mon, 3 Jan 2011 13:11:48 +0000 Subject: 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 --- bootloader/mpio_hd200_hd300.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/bootloader/mpio_hd200_hd300.c b/bootloader/mpio_hd200_hd300.c index 14f7635..be36daf 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) { -- cgit v1.1
path: root/apps/plugins/lib/gray_set_drawinfo.c
blob: 59928882d7618c857a581598a207d13e2bdc3e19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/***************************************************************************
*             __________               __   ___.
*   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
*   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
*   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
*   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
*                     \/            \/     \/    \/            \/
* $Id$
*
* Grayscale framework
* gray_set_drawinfo() function
*
* This is a generic framework to use grayscale display within Rockbox
* plugins. It obviously does not work for the player.
*
* Copyright (C) 2004 Jens Arnold
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/

#ifndef SIMULATOR /* not for simulator by now */
#include "plugin.h"

#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
#include "gray.h"

/*---------------------------------------------------------------------------
 Set draw mode, foreground and background shades at once
 ----------------------------------------------------------------------------
 If you hand it -1 (or in fact any other out-of-bounds value) for a
 parameter, that particular setting won't be changed

 Default after initialization: GRAY_DRAW_SOLID, 0, 255
 */
void gray_set_drawinfo(int drawmode, int fg_brightness, int bg_brightness)
{
    gray_set_drawmode(drawmode);
    gray_set_foreground(fg_brightness);
    gray_set_background(bg_brightness);
}

#endif // #ifdef HAVE_LCD_BITMAP
#endif // #ifndef SIMULATOR