summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2005-12-22 10:43:36 +0000
committerHristo Kovachev <bger@rockbox.org>2005-12-22 10:43:36 +0000
commit9b83c6c4bddca41411d31b8aab17ecc577b37eb4 (patch)
tree3311cff5a451e4462e02feffdfe4ddc610eeb6e5 /firmware
parent9d67765cae62e873c3d004bf9bcb68947f1568f6 (diff)
downloadrockbox-9b83c6c4bddca41411d31b8aab17ecc577b37eb4.tar.gz
rockbox-9b83c6c4bddca41411d31b8aab17ecc577b37eb4.zip
Patch No 1387627 by Peter D'Hoye: Backlight Brightness setting for H300
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8280 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c14
-rw-r--r--firmware/drivers/pcf50606.c21
-rw-r--r--firmware/export/backlight.h4
-rw-r--r--firmware/export/config-h300.h2
-rw-r--r--firmware/export/pcf50606.h1
5 files changed, 41 insertions, 1 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 291c5da8e7..d118830721 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -30,6 +30,10 @@
30#include "timer.h" 30#include "timer.h"
31#include "backlight.h" 31#include "backlight.h"
32 32
33#ifdef HAVE_BACKLIGHT_BRIGHTNESS
34#include "pcf50606.h" /* iRiver brightness */
35#endif
36
33#if CONFIG_BACKLIGHT == BL_IRIVER_H300 37#if CONFIG_BACKLIGHT == BL_IRIVER_H300
34#include "lcd.h" /* for lcd_enable() */ 38#include "lcd.h" /* for lcd_enable() */
35#endif 39#endif
@@ -538,3 +542,13 @@ void remote_backlight_set_timeout(int index) {(void)index;}
538#endif 542#endif
539#endif /* #ifdef CONFIG_BACKLIGHT */ 543#endif /* #ifdef CONFIG_BACKLIGHT */
540 544
545#ifdef HAVE_BACKLIGHT_BRIGHTNESS
546void backlight_set_brightness(int val)
547{
548 /* set H300 brightness by changing the PWM
549 accepts 0..15 but note that 0 and 1 give a black display! */
550 unsigned char ucVal = (unsigned char)(val & 0x0F);
551 pcf50606_set_bl_pwm(ucVal);
552}
553#endif
554
diff --git a/firmware/drivers/pcf50606.c b/firmware/drivers/pcf50606.c
index b99b2e9e88..cb05d25345 100644
--- a/firmware/drivers/pcf50606.c
+++ b/firmware/drivers/pcf50606.c
@@ -44,6 +44,7 @@
44/* delay loop to achieve 400kHz at 120MHz CPU frequency */ 44/* delay loop to achieve 400kHz at 120MHz CPU frequency */
45#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0) 45#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0)
46 46
47void pcf50606_set_bl_pwm(unsigned char ucVal);
47 48
48static void pcf50606_i2c_start(void) 49static void pcf50606_i2c_start(void)
49{ 50{
@@ -281,5 +282,23 @@ void pcf50606_init(void)
281 set_voltages(); 282 set_voltages();
282 283
283 /* Backlight PWM = 512Hz 50/50 */ 284 /* Backlight PWM = 512Hz 50/50 */
284 pcf50606_write(0x35, 0x13); 285 /*pcf50606_write(0x35, 0x13);*/
286 pcf50606_set_bl_pwm(9);
287}
288
289void pcf50606_set_bl_pwm(unsigned char ucVal)
290{
291 /* set the backlight PWM */
292 /* range is 0 - 15 */
293
294 /* limit incoming value */
295 ucVal = ucVal & 0x0F;
296
297 /* shift one bit left */
298 ucVal = ucVal << 1;
299 ucVal = ucVal | 0x01;
300
301 /* 0x00 = 512Hz */
302 ucVal = ucVal | 0x00;
303 pcf50606_write(0x35, ucVal);
285} 304}
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 9c3f5aa90b..f4c62a2028 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -49,3 +49,7 @@ void sim_backlight(int value);
49void sim_remote_backlight(int value); 49void sim_remote_backlight(int value);
50#endif 50#endif
51#endif 51#endif
52
53#ifdef HAVE_BACKLIGHT_BRIGHTNESS
54void backlight_set_brightness(int val);
55#endif
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 20e27c505b..54a2ef543f 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -100,4 +100,6 @@
100#define BOOTFILE_EXT "iriver" 100#define BOOTFILE_EXT "iriver"
101#define BOOTFILE "rockbox." BOOTFILE_EXT 101#define BOOTFILE "rockbox." BOOTFILE_EXT
102 102
103#define HAVE_BACKLIGHT_BRIGHTNESS
104
103#endif 105#endif
diff --git a/firmware/export/pcf50606.h b/firmware/export/pcf50606.h
index fd180bfaee..daacbac725 100644
--- a/firmware/export/pcf50606.h
+++ b/firmware/export/pcf50606.h
@@ -25,6 +25,7 @@ int pcf50606_write_multiple(int address, const unsigned char* buf, int count);
25int pcf50606_write(int address, unsigned char val); 25int pcf50606_write(int address, unsigned char val);
26int pcf50606_read_multiple(int address, unsigned char* buf, int count); 26int pcf50606_read_multiple(int address, unsigned char* buf, int count);
27int pcf50606_read(int address); 27int pcf50606_read(int address);
28void pcf50606_set_bl_pwm(unsigned char ucVal);
28#endif 29#endif
29 30
30#endif 31#endif