diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/backlight.c | 14 | ||||
-rw-r--r-- | firmware/drivers/pcf50606.c | 21 | ||||
-rw-r--r-- | firmware/export/backlight.h | 4 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 2 | ||||
-rw-r--r-- | firmware/export/pcf50606.h | 1 |
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 | ||
546 | void 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 | ||
47 | void pcf50606_set_bl_pwm(unsigned char ucVal); | ||
47 | 48 | ||
48 | static void pcf50606_i2c_start(void) | 49 | static 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 | |||
289 | void 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); | |||
49 | void sim_remote_backlight(int value); | 49 | void sim_remote_backlight(int value); |
50 | #endif | 50 | #endif |
51 | #endif | 51 | #endif |
52 | |||
53 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
54 | void 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); | |||
25 | int pcf50606_write(int address, unsigned char val); | 25 | int pcf50606_write(int address, unsigned char val); |
26 | int pcf50606_read_multiple(int address, unsigned char* buf, int count); | 26 | int pcf50606_read_multiple(int address, unsigned char* buf, int count); |
27 | int pcf50606_read(int address); | 27 | int pcf50606_read(int address); |
28 | void pcf50606_set_bl_pwm(unsigned char ucVal); | ||
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | #endif | 31 | #endif |