From f18f9a806142f96f435480473796e12b4a11e7b4 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 25 Jul 2006 15:21:31 +0000 Subject: Patch FS#5712 by Michael Sevakis - X5 Backlight brightness improvement/fix git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10322 a1c6a512-1295-4272-9138-f99709370657 --- firmware/backlight.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'firmware/backlight.c') diff --git a/firmware/backlight.c b/firmware/backlight.c index 8285ff894b..1e72c6a81d 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -659,28 +659,26 @@ bool is_remote_backlight_on(void) {return true;} void backlight_set_brightness(int val) { #ifndef SIMULATOR - /* set H300 brightness by changing the PWM - accepts 0..15 but note that 0 and 1 give a black display! */ + /* set brightness by changing the PWM + * accepts 0..15 but note that 0 and 1 give a black display on H300! + * 0 is black on the X5. + */ /* disable IRQs while bitbanging */ int old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); - val &= 0x0F; + /* Clamp setting to range */ if(valMAX_BRIGHTNESS_SETTING) + val=MAX_BRIGHTNESS_SETTING; - /* shift one bit left */ - val <<= 1; - - /* enable PWM */ - val |= 0x01; - - pcf50606_write(0x35, val); + pcf50606_write(0x35, (val << 1) | 0x01); /* 512Hz, Enable PWM */ /* enable IRQs again */ set_irq_level(old_irq_level); #else - val=0; + val=0; #endif } #endif -- cgit v1.2.3