summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/onda_vx747
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-06-24 19:52:03 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-06-24 19:52:03 +0000
commit5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242 (patch)
treeafbd33ffed38066b17a7158edd9d57b402cbb84e /firmware/target/mips/ingenic_jz47xx/onda_vx747
parent763a7d74573dfc3ab2bff99332f00f8dec29cf0c (diff)
downloadrockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.tar.gz
rockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.tar.bz2
rockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.zip
Use a logarithmic scale for the Onda VX747 backlight (thanks to Bertrik Sikken)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21492 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx747')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c
index e59f1812c1..48c4e2e636 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c
@@ -32,23 +32,20 @@
* [PWM half rate, PWM full rate[ -> backlight on
* [PWM full rate, PWM full rate] -> counter reset to 0
*/
-static int old_val;
+static int old_val = MAX_BRIGHTNESS_SETTING;
+static const unsigned char logtable[] = {255, 254, 253, 252, 250, 248, 245, 240, 233, 224, 211, 192, 165, 128, 75, 0};
static void set_backlight(int val)
{
- /* The pulse repetition frequency should be greater than 100Hz so
- the flickering is not perceptible to the human eye but
- not greater than about 1kHz. */
+ if(val == old_val)
+ return;
/* Clock = 32 768 Hz */
- /* 1 <= val <= 30 */
- int cycle = (MAX_BRIGHTNESS_SETTING - val + 1);
-
__tcu_disable_pwm_output(BACKLIGHT_PWM);
__tcu_stop_counter(BACKLIGHT_PWM);
__tcu_set_count(BACKLIGHT_PWM, 0);
- __tcu_set_half_data(BACKLIGHT_PWM, cycle-1);
- __tcu_set_full_data(BACKLIGHT_PWM, cycle);
+ __tcu_set_half_data(BACKLIGHT_PWM, logtable[val]);
+ __tcu_set_full_data(BACKLIGHT_PWM, 256);
__tcu_start_counter(BACKLIGHT_PWM);
__tcu_enable_pwm_output(BACKLIGHT_PWM);
@@ -58,7 +55,8 @@ static void set_backlight(int val)
static void set_backlight_on(void)
{
- set_backlight(old_val);
+ __tcu_start_counter(BACKLIGHT_PWM);
+ __tcu_enable_pwm_output(BACKLIGHT_PWM);
}
static void set_backlight_off(void)
@@ -83,7 +81,9 @@ bool _backlight_init(void)
__tcu_mask_half_match_irq(BACKLIGHT_PWM);
__tcu_mask_full_match_irq(BACKLIGHT_PWM);
- old_val = MAX_BRIGHTNESS_SETTING;
+ __tcu_set_count(BACKLIGHT_PWM, 0);
+ __tcu_set_half_data(BACKLIGHT_PWM, 0);
+ __tcu_set_full_data(BACKLIGHT_PWM, 256);
return true;
}