mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Add ADC to I/O ports debug menu on H10. Fix battery level reading empty when starting up on H10. Calibrated battery for H10 20GB.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11036 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
193611367a
commit
5a79b4e015
6 changed files with 37 additions and 22 deletions
|
@ -1123,7 +1123,17 @@ bool dbg_ports(void)
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
|
snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l);
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
|
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
|
||||||
|
line++;
|
||||||
|
snprintf(buf, sizeof(buf), "ADC_BATTERY: %02x", adc_read(ADC_BATTERY));
|
||||||
|
lcd_puts(0, line++, buf);
|
||||||
|
snprintf(buf, sizeof(buf), "ADC_UNKNOWN_1: %02x", adc_read(ADC_UNKNOWN_1));
|
||||||
|
lcd_puts(0, line++, buf);
|
||||||
|
snprintf(buf, sizeof(buf), "ADC_UNKNOWN_2: %02x", adc_read(ADC_UNKNOWN_2));
|
||||||
|
lcd_puts(0, line++, buf);
|
||||||
|
snprintf(buf, sizeof(buf), "ADC_SCROLLPAD: %02x", adc_read(ADC_SCROLLPAD));
|
||||||
|
lcd_puts(0, line++, buf);
|
||||||
|
#endif
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (action_userabort(HZ/10))
|
if (action_userabort(HZ/10))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -417,7 +417,7 @@ void init(void)
|
||||||
|
|
||||||
settings_calc_config_sector();
|
settings_calc_config_sector();
|
||||||
|
|
||||||
#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD)
|
#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_H10_PAD)
|
||||||
#ifdef SETTINGS_RESET
|
#ifdef SETTINGS_RESET
|
||||||
/* Reset settings if holding the rec button. */
|
/* Reset settings if holding the rec button. */
|
||||||
if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET)
|
if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET)
|
||||||
|
|
|
@ -65,9 +65,7 @@
|
||||||
#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
|
#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
|
||||||
because of 'target' stuff */
|
because of 'target' stuff */
|
||||||
|
|
||||||
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity
|
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
|
||||||
TODO: check this, probably different
|
|
||||||
for different models too */
|
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
||||||
|
@ -83,7 +81,7 @@
|
||||||
#define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */
|
#define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */
|
||||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||||
#define BATTERY_SCALE_FACTOR 5865
|
#define BATTERY_SCALE_FACTOR 4688
|
||||||
|
|
||||||
/* Hardware controlled charging */
|
/* Hardware controlled charging */
|
||||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
#define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */
|
#define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */
|
||||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||||
#define BATTERY_SCALE_FACTOR 5865
|
#define BATTERY_SCALE_FACTOR 4688
|
||||||
|
|
||||||
/* Hardware controlled charging */
|
/* Hardware controlled charging */
|
||||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||||
|
|
|
@ -169,6 +169,10 @@ static const unsigned int battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
105, 115 /* alkaline, NiHM */
|
105, 115 /* alkaline, NiHM */
|
||||||
#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0 */
|
#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0 */
|
||||||
339
|
339
|
||||||
|
#elif CONFIG_BATTERY == BATT_LPCS355385 /* iriver H10 20GB */
|
||||||
|
378
|
||||||
|
#elif CONFIG_BATTERY == BATT_BP009 /* iriver H10 5/6GB */
|
||||||
|
378
|
||||||
#else /* Player/recorder, NiMH */
|
#else /* Player/recorder, NiMH */
|
||||||
475
|
475
|
||||||
#endif
|
#endif
|
||||||
|
@ -190,6 +194,12 @@ static const short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||||
* for the 1300 mAh stock battery. */
|
* for the 1300 mAh stock battery. */
|
||||||
// { 337, 358, 365, 369, 372, 377, 383, 389, 397, 406, 413 }
|
// { 337, 358, 365, 369, 372, 377, 383, 389, 397, 406, 413 }
|
||||||
{ 337, 366, 372, 374, 378, 381, 385, 392, 399, 408, 417 }
|
{ 337, 366, 372, 374, 378, 381, 385, 392, 399, 408, 417 }
|
||||||
|
#elif CONFIG_BATTERY == BATT_LPCS355385
|
||||||
|
/* iriver H10 20GB */
|
||||||
|
{ 378, 382, 386, 390, 395, 399, 404, 408, 413, 417, 422 }
|
||||||
|
#elif CONFIG_BATTERY == BATT_BP009
|
||||||
|
/* iriver H10 5/6GB: Same as 20GB for now */
|
||||||
|
{ 378, 382, 386, 390, 395, 399, 404, 408, 413, 417, 422 }
|
||||||
#elif CONFIG_BATTERY == BATT_1AA
|
#elif CONFIG_BATTERY == BATT_1AA
|
||||||
/* These values are the same as for 3AAA divided by 3. */
|
/* These values are the same as for 3AAA divided by 3. */
|
||||||
/* May need recalibration. */
|
/* May need recalibration. */
|
||||||
|
@ -213,6 +223,12 @@ static const short percent_to_volt_charge[11] =
|
||||||
/* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when
|
/* Calibrated for 1900 mAh Ionity battery (estimated 90% charge when
|
||||||
entering in trickle-charging). We will never reach 100%. */
|
entering in trickle-charging). We will never reach 100%. */
|
||||||
340, 390, 394, 399, 400, 404, 407, 413, 417, 422, 426
|
340, 390, 394, 399, 400, 404, 407, 413, 417, 422, 426
|
||||||
|
#elif CONFIG_BATTERY == BATT_LPCS355385
|
||||||
|
/* iriver H10 20GB: Same as iPod for now */
|
||||||
|
388, 392, 396, 400, 406, 410, 415, 419, 424, 428, 433
|
||||||
|
#elif CONFIG_BATTERY == BATT_BP009
|
||||||
|
/* iriver H10 5/6GB: Same as iPod for now */
|
||||||
|
388, 392, 396, 400, 406, 410, 415, 419, 424, 428, 433
|
||||||
#else
|
#else
|
||||||
/* values guessed, see
|
/* values guessed, see
|
||||||
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone
|
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone
|
||||||
|
|
|
@ -81,21 +81,12 @@ void adc_init(void)
|
||||||
|
|
||||||
/* Initialise */
|
/* Initialise */
|
||||||
ADC_INIT=0;
|
ADC_INIT=0;
|
||||||
ADC_ADDR=0x130;
|
|
||||||
ADC_STATUS=0;
|
|
||||||
|
|
||||||
/* Enable Channels 1-4 */
|
/* Force a scan of all channels to get initial values */
|
||||||
ADC_ADDR |= 0x1000000;
|
adc_scan(ADC_BATTERY);
|
||||||
ADC_ADDR |= 0x2000000;
|
adc_scan(ADC_UNKNOWN_1);
|
||||||
ADC_ADDR |= 0x4000000;
|
adc_scan(ADC_UNKNOWN_2);
|
||||||
ADC_ADDR |= 0x8000000;
|
adc_scan(ADC_SCROLLPAD);
|
||||||
|
|
||||||
/* Start? */
|
|
||||||
ADC_ADDR |= 0x20000000;
|
|
||||||
ADC_ADDR |= 0x80000000;
|
|
||||||
|
|
||||||
/* Wait 50ms for things to settle */
|
|
||||||
sleep(HZ/20);
|
|
||||||
|
|
||||||
tick_add_task(adc_tick);
|
tick_add_task(adc_tick);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue