diff options
| author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-18 19:44:40 +0000 |
|---|---|---|
| committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-18 19:44:40 +0000 |
| commit | 4f61e455a23f95e24117dc97ca40f6afa51a1e90 (patch) | |
| tree | ba4f21293df7cc508cdd84972bf25ea5dfd99102 | |
| parent | 4d510761cd5defdba4fb99f7d7c35e9d76ac357f (diff) | |
| download | rockbox-4f61e455a23f95e24117dc97ca40f6afa51a1e90.zip rockbox-4f61e455a23f95e24117dc97ca40f6afa51a1e90.tar.gz rockbox-4f61e455a23f95e24117dc97ca40f6afa51a1e90.tar.bz2 rockbox-4f61e455a23f95e24117dc97ca40f6afa51a1e90.tar.xz | |
Fuzev1: calibrated charging curve
Show all the adc channels in the IO ports debug menu (not for as3525v2
since the channels are different)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26149 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 98 | ||||
| -rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c | 3 |
2 files changed, 84 insertions, 17 deletions
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 75cce72..3f3536a 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c @@ -439,24 +439,92 @@ bool __dbg_ports(void) while(1) { - line = 0; - lcd_puts(0, line++, "[GPIO Values and Directions]"); - lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); - lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); - lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); - lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); + while(1) + { + line = 0; + lcd_puts(0, line++, "[GPIO Values and Directions]"); + lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); + lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); + lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); + lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); #ifdef DEBUG_DBOP - line++; - lcd_puts(0, line++, "[DBOP_DIN]"); - lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug()); + line++; + lcd_puts(0, line++, "[DBOP_DIN]"); + lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug()); +#endif + line++; + lcd_puts(0, line++, "[CP15]"); + lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); + lcd_update(); + if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) + break; + + int btn = button_get_w_tmo(HZ/10); + if(btn == (DEBUG_CANCEL|BUTTON_REL)) + goto end; + else if(btn == (BUTTON_DOWN|BUTTON_REL)) + break; + } + +#if CONFIG_CPU == AS3525 /* as3525v2 channels are different */ + static const char *adc_name[13] = { + "CHG_OUT ", + "RTCSUP ", + "VBUS ", + "CHG_IN ", + "CVDD ", + "BatTemp ", + "MicSup1 ", + "MicSup2 ", + "VBE1 ", + "VBE2 ", + "I_MicSup1", + "I_MicSup2", + "VBAT ", + }; + + lcd_clear_display(); + int i, btn; + + while(1) + { + line = 0; + + for(i=0; i<5; i++) + lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i) * 5); + for(; i<8; i++) + lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)*5/2); +#if LCD_HEIGHT < 176 /* clip */ + lcd_update(); + + btn = button_get_w_tmo(HZ/10); + if(btn == (DEBUG_CANCEL|BUTTON_REL)) + goto end; + else if(btn == (BUTTON_DOWN|BUTTON_REL)) + break; + } + lcd_clear_display(); + while(1) + { + line = 0; +#endif + for(i=8; i<10; i++) + lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)); + for(; i<12; i++) + lcd_putsf(0, line++, "%s: %d uA", adc_name[i], adc_read(i)); + lcd_putsf(0, line++, "%s: %d mV", adc_name[i], (adc_read(i) * 5)/2); + lcd_update(); + + btn = button_get_w_tmo(HZ/10); + if(btn == (DEBUG_CANCEL|BUTTON_REL)) + goto end; + else if(btn == (BUTTON_DOWN|BUTTON_REL)) + break; + } #endif - line++; - lcd_puts(0, line++, "[CP15]"); - lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); - lcd_update(); - if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) - break; } + +end: lcd_setfont(FONT_UI); return false; } diff --git a/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c b/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c index 23b278e..545606b 100644 --- a/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c @@ -45,8 +45,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ const unsigned short percent_to_volt_charge[11] = { - /* TODO: simple linear uncalibrated curve */ - 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 + 3364, 3816, 3879, 3903, 3934, 3983, 4051, 4119, 4188, 4188, 4188 }; #endif /* CONFIG_CHARGING */ |