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.tar.gz rockbox-4f61e455a23f95e24117dc97ca40f6afa51a1e90.zip |
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 75cce72dcd..3f3536a6e2 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) | |||
439 | 439 | ||
440 | while(1) | 440 | while(1) |
441 | { | 441 | { |
442 | line = 0; | 442 | while(1) |
443 | lcd_puts(0, line++, "[GPIO Values and Directions]"); | 443 | { |
444 | lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); | 444 | line = 0; |
445 | lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); | 445 | lcd_puts(0, line++, "[GPIO Values and Directions]"); |
446 | lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); | 446 | lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); |
447 | lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); | 447 | lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); |
448 | lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); | ||
449 | lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); | ||
448 | #ifdef DEBUG_DBOP | 450 | #ifdef DEBUG_DBOP |
449 | line++; | 451 | line++; |
450 | lcd_puts(0, line++, "[DBOP_DIN]"); | 452 | lcd_puts(0, line++, "[DBOP_DIN]"); |
451 | lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug()); | 453 | lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug()); |
454 | #endif | ||
455 | line++; | ||
456 | lcd_puts(0, line++, "[CP15]"); | ||
457 | lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); | ||
458 | lcd_update(); | ||
459 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | ||
460 | break; | ||
461 | |||
462 | int btn = button_get_w_tmo(HZ/10); | ||
463 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
464 | goto end; | ||
465 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
466 | break; | ||
467 | } | ||
468 | |||
469 | #if CONFIG_CPU == AS3525 /* as3525v2 channels are different */ | ||
470 | static const char *adc_name[13] = { | ||
471 | "CHG_OUT ", | ||
472 | "RTCSUP ", | ||
473 | "VBUS ", | ||
474 | "CHG_IN ", | ||
475 | "CVDD ", | ||
476 | "BatTemp ", | ||
477 | "MicSup1 ", | ||
478 | "MicSup2 ", | ||
479 | "VBE1 ", | ||
480 | "VBE2 ", | ||
481 | "I_MicSup1", | ||
482 | "I_MicSup2", | ||
483 | "VBAT ", | ||
484 | }; | ||
485 | |||
486 | lcd_clear_display(); | ||
487 | int i, btn; | ||
488 | |||
489 | while(1) | ||
490 | { | ||
491 | line = 0; | ||
492 | |||
493 | for(i=0; i<5; i++) | ||
494 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i) * 5); | ||
495 | for(; i<8; i++) | ||
496 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)*5/2); | ||
497 | #if LCD_HEIGHT < 176 /* clip */ | ||
498 | lcd_update(); | ||
499 | |||
500 | btn = button_get_w_tmo(HZ/10); | ||
501 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
502 | goto end; | ||
503 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
504 | break; | ||
505 | } | ||
506 | lcd_clear_display(); | ||
507 | while(1) | ||
508 | { | ||
509 | line = 0; | ||
510 | #endif | ||
511 | for(i=8; i<10; i++) | ||
512 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], adc_read(i)); | ||
513 | for(; i<12; i++) | ||
514 | lcd_putsf(0, line++, "%s: %d uA", adc_name[i], adc_read(i)); | ||
515 | lcd_putsf(0, line++, "%s: %d mV", adc_name[i], (adc_read(i) * 5)/2); | ||
516 | lcd_update(); | ||
517 | |||
518 | btn = button_get_w_tmo(HZ/10); | ||
519 | if(btn == (DEBUG_CANCEL|BUTTON_REL)) | ||
520 | goto end; | ||
521 | else if(btn == (BUTTON_DOWN|BUTTON_REL)) | ||
522 | break; | ||
523 | } | ||
452 | #endif | 524 | #endif |
453 | line++; | ||
454 | lcd_puts(0, line++, "[CP15]"); | ||
455 | lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); | ||
456 | lcd_update(); | ||
457 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | ||
458 | break; | ||
459 | } | 525 | } |
526 | |||
527 | end: | ||
460 | lcd_setfont(FONT_UI); | 528 | lcd_setfont(FONT_UI); |
461 | return false; | 529 | return false; |
462 | } | 530 | } |
diff --git a/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c b/firmware/target/arm/as3525/sansa-fuze/powermgmt-fuze.c index 23b278e955..545606b97f 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] = | |||
45 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | 45 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ |
46 | const unsigned short percent_to_volt_charge[11] = | 46 | const unsigned short percent_to_volt_charge[11] = |
47 | { | 47 | { |
48 | /* TODO: simple linear uncalibrated curve */ | 48 | 3364, 3816, 3879, 3903, 3934, 3983, 4051, 4119, 4188, 4188, 4188 |
49 | 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 | ||
50 | }; | 49 | }; |
51 | #endif /* CONFIG_CHARGING */ | 50 | #endif /* CONFIG_CHARGING */ |
52 | 51 | ||