summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/onda_vx747
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-03-09 22:17:37 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-03-09 22:17:37 +0000
commit70ab3fca0d5bc9a2cffdef50db0b2fb152cb1892 (patch)
treef2990213a230c884a5d4409d904b8b2867615584 /firmware/target/mips/ingenic_jz47xx/onda_vx747
parentb1983d21c2dc19c2c3aa4904bfaeabb3ca20092e (diff)
downloadrockbox-70ab3fca0d5bc9a2cffdef50db0b2fb152cb1892.tar.gz
rockbox-70ab3fca0d5bc9a2cffdef50db0b2fb152cb1892.tar.bz2
rockbox-70ab3fca0d5bc9a2cffdef50db0b2fb152cb1892.zip
Onda VX747:
* Fix warnings * Add fake battery level information to make sure Rockbox doesn't shutdown * Enable switching between touch modes by pressing (VOL_DOWN|VOL_UP) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20269 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.c21
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h3
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c27
3 files changed, 22 insertions, 29 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 eec48768b2..72e469977b 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
@@ -27,12 +27,11 @@
#define BACKLIGHT_GPIO (32*3+31)
#define BACKLIGHT_PWM 7
+/* TODO: use HW PWM */
#define SW_PWM 1
-
#if SW_PWM
static bool backlight_on;
-
static void set_backlight(int val)
{
(void)val;
@@ -48,20 +47,19 @@ bool _backlight_init(void)
return true;
}
-bool backlight_enabled(void)
-{
- return backlight_on;
-}
-
void _backlight_on(void)
{
- __gpio_set_pin(BACKLIGHT_GPIO);
+ if(!backlight_on)
+ __gpio_set_pin(BACKLIGHT_GPIO);
+
backlight_on = true;
}
void _backlight_off(void)
{
- __gpio_clear_pin(BACKLIGHT_GPIO);
+ if(backlight_on)
+ __gpio_clear_pin(BACKLIGHT_GPIO);
+
backlight_on = false;
}
@@ -131,11 +129,6 @@ bool _backlight_init(void)
return true;
}
-bool backlight_enabled(void)
-{
- return old_val > -1 ? true : false;
-}
-
void _backlight_on(void)
{
set_backlight_on();
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h
index c6647fa9da..4170f96cc0 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-target.h
@@ -29,12 +29,9 @@
#include <stdbool.h>
-/*
bool _backlight_init(void);
void _backlight_on(void);
void _backlight_off(void);
void _backlight_set_brightness(int brightness);
-bool backlight_enabled(void);
-*/
#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
index 3dce73b05e..c9c264e26a 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
@@ -71,36 +71,36 @@ static struct mutex battery_mtx;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
/* TODO */
- 1400
+ 1000
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
/* TODO */
- 1300
+ 900
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
/* TODO */
- { 1300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 },
+ { 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 },
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
{
/* TODO */
- 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160
+ 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000
};
/* VBAT = (BDATA/4096) * 7.5V */
-#define BATTERY_SCALE_FACTOR 7500
+#define BATTERY_SCALE_FACTOR 1875
/* Returns battery voltage from ADC [millivolts] */
unsigned int battery_adc_voltage(void)
{
- unsigned int dummy, timeout=1000;
+ unsigned int dummy, timeout=HZ/4;
mutex_lock(&battery_mtx);
@@ -114,18 +114,18 @@ unsigned int battery_adc_voltage(void)
while(bat_val == 0 && timeout--)
sleep(0);
- logf("%d %d", bat_val, (bat_val*BATTERY_SCALE_FACTOR)>>12);
+ logf("%d %d", bat_val, (bat_val*BATTERY_SCALE_FACTOR)>>10);
mutex_unlock(&battery_mtx);
- return (bat_val*BATTERY_SCALE_FACTOR)>>12;
+ return (bat_val*BATTERY_SCALE_FACTOR)>>10;
}
void button_init_device(void)
{
__cpm_start_sadc();
REG_SADC_ENA = 0;
- REG_SADC_STATE &= (~REG_SADC_STATE);
+ REG_SADC_STATE &= ~REG_SADC_STATE;
REG_SADC_CTRL = 0x1F;
REG_SADC_CFG = SADC_CFG_INIT;
@@ -134,8 +134,8 @@ void button_init_device(void)
REG_SADC_SAMETIME = 10;
REG_SADC_WAITTIME = 100;
- REG_SADC_STATE &= (~REG_SADC_STATE);
- REG_SADC_CTRL = (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM));
+ REG_SADC_STATE &= ~REG_SADC_STATE;
+ REG_SADC_CTRL = ~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM);
REG_SADC_ENA = SADC_ENA_TSEN;
#ifdef ONDA_VX747
@@ -192,6 +192,9 @@ int button_read_device(int *data)
if( UNLIKELY(!is_backlight_on(true)) )
*data = 0;
}
+
+ if(ret & (BUTTON_VOL_DOWN|BUTTON_VOL_UP))
+ touchscreen_set_mode( touchscreen_get_mode() == TOUCHSCREEN_BUTTON ? TOUCHSCREEN_POINT : TOUCHSCREEN_BUTTON);
return ret;
}
@@ -205,7 +208,7 @@ void SADC(void)
sadcstate = REG_SADC_STATE;
state = REG_SADC_STATE & (~REG_SADC_CTRL);
REG_SADC_STATE &= sadcstate;
-
+
if(state & SADC_CTRL_PENDM)
{
/* Pen down IRQ */