summaryrefslogtreecommitdiff
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
parent763a7d74573dfc3ab2bff99332f00f8dec29cf0c (diff)
downloadrockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.zip
rockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.tar.gz
rockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.tar.bz2
rockbox-5acfa34b9c60b9a2e5236b0fecd96e2c54e4e242.tar.xz
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
-rw-r--r--firmware/export/config-ondavx747.h6
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx7X7.c22
2 files changed, 14 insertions, 14 deletions
diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h
index 5625635..a5f937f 100644
--- a/firmware/export/config-ondavx747.h
+++ b/firmware/export/config-ondavx747.h
@@ -116,9 +116,9 @@
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
/* Main LCD backlight brightness range and defaults */
-#define MIN_BRIGHTNESS_SETTING 1
-#define MAX_BRIGHTNESS_SETTING 30
-#define DEFAULT_BRIGHTNESS_SETTING 30 /* "full brightness" */
+#define MIN_BRIGHTNESS_SETTING 0
+#define MAX_BRIGHTNESS_SETTING 15
+#define DEFAULT_BRIGHTNESS_SETTING 10 /* "full brightness" */
#define DEFAULT_DIMNESS_SETTING 1 /* "most dim" */
/* Define this if you have a software controlled poweroff */
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 e59f181..48c4e2e 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;
}