1bc16babdda2c29e17fc9c30f9806ac7fb6f5087
1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 by Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "backlight-target.h"
25 #include "backlight.h"
26 #include "ascodec-target.h"
29 int buttonlight_is_on
= 0;
31 void _backlight_set_brightness(int brightness
)
33 ascodec_write_pmu(AS3543_BACKLIGHT
, 2, brightness
* 10);
36 bool _backlight_init(void)
38 GPIOB_DIR
|= 1<<5; /* for buttonlight, stuff below seems to be needed
39 for buttonlight as well*/
41 ascodec_write_pmu(AS3543_BACKLIGHT
, 1, 0x80);
42 ascodec_write_pmu(AS3543_BACKLIGHT
, 2, backlight_brightness
* 10);
47 void _backlight_on(void)
49 #ifdef HAVE_LCD_ENABLE
50 lcd_enable(true); /* power on lcd + visible display */
52 ascodec_write_pmu(AS3543_BACKLIGHT
, 1, 0x80);
55 void _backlight_off(void)
57 ascodec_write_pmu(AS3543_BACKLIGHT
, 1, 0x0);
58 #ifdef HAVE_LCD_ENABLE
59 lcd_enable(false); /* power off visible display */
63 void _buttonlight_on(void)
65 GPIOB_PIN(5) = (1<<5);
66 buttonlight_is_on
= 1;
69 void _buttonlight_off(void)
72 buttonlight_is_on
= 0;