Remove the calls to backlight_lcd_sleep_countdown from target specific code and move...
[kugel-rb.git] / firmware / target / arm / tms320dm320 / mrobe-500 / backlight-mr500.c
blobbdd91e2e2004763ab113588a1ef701a08f6a59da
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Karl Kurbjun
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 "config.h"
23 #include "cpu.h"
24 #include "system.h"
25 #include "backlight-target.h"
26 #include "backlight.h"
27 #include "lcd.h"
28 #include "power.h"
29 #include "spi-target.h"
31 int _backlight_brightness=DEFAULT_BRIGHTNESS_SETTING;
33 static void _backlight_write_brightness(int brightness)
35 uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb};
36 spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0);
39 void _backlight_on(void)
41 #ifdef HAVE_LCD_ENABLE
42 lcd_enable(true); /* power on lcd + visible display */
43 #endif
44 _backlight_write_brightness(_backlight_brightness);
47 void _backlight_off(void)
49 _backlight_write_brightness(0);
52 /* Assumes that the backlight has been initialized */
53 void _backlight_set_brightness(int brightness)
55 _backlight_brightness=brightness;
56 _backlight_write_brightness(brightness);
59 void __backlight_dim(bool dim_now)
61 _backlight_set_brightness(dim_now ?
62 DEFAULT_BRIGHTNESS_SETTING :
63 DEFAULT_DIMNESS_SETTING);
66 bool _backlight_init(void)
68 _backlight_set_brightness(_backlight_brightness);
69 return true;