diff options
Diffstat (limited to 'firmware/drivers/pcf50606.c')
-rw-r--r-- | firmware/drivers/pcf50606.c | 21 |
1 files changed, 20 insertions, 1 deletions
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 | } |