HD200 - small fix in backlight code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25766 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcin Bukat 2010-04-30 13:59:00 +00:00
parent 2a50270e44
commit 572ac53359

View file

@ -27,13 +27,15 @@
#include "backlight-target.h" #include "backlight-target.h"
#include "lcd.h" #include "lcd.h"
static bool _backlight_on = false; static bool _backlight_on = true;
static int _brightness = DEFAULT_BRIGHTNESS_SETTING; static int _brightness = DEFAULT_BRIGHTNESS_SETTING;
/* Returns the current state of the backlight (true=ON, false=OFF). */ /* Returns the current state of the backlight (true=ON, false=OFF). */
bool _backlight_init(void) bool _backlight_init(void)
{ {
#ifdef BOOTLOADER
and_l(~(1<<28),&GPIO_OUT); and_l(~(1<<28),&GPIO_OUT);
#endif
or_l((1<<28),&GPIO_FUNCTION); or_l((1<<28),&GPIO_FUNCTION);
or_l((1<<28),&GPIO_ENABLE); or_l((1<<28),&GPIO_ENABLE);
return true; return true;
@ -61,6 +63,9 @@ void _backlight_set_brightness(int val)
{ {
unsigned char i; unsigned char i;
if( _brightness == val && _backlight_on == true )
return;
and_l(~(1<<28),&GPIO_OUT); and_l(~(1<<28),&GPIO_OUT);
sleep(4); sleep(4);