summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-10-30 11:33:38 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-10-30 11:33:38 +0000
commit9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04 (patch)
treee5b0bd4076b66c55b49f36cdd0898de2e2717a86 /firmware/export
parentede3d646b9a248a1893ec20482eaa30641df078e (diff)
downloadrockbox-9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04.tar.gz
rockbox-9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04.zip
General: changed local adc to voltage conversions in several places to use battery_voltage. Added battery_read_info function for unfiltered battery information. x5: removed adc_read as a distinct function. Removed adc tick task. adc_init is empty inline. Adjusted battery scale, voltage to level array and read 10 bits from the ADC for battery since 255 levels is not enough for true centivolt resolution.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-iaudiox5.h13
-rw-r--r--firmware/export/config.h1
-rw-r--r--firmware/export/powermgmt.h5
3 files changed, 12 insertions, 7 deletions
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index df24850892..3e835605da 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -113,12 +113,13 @@
113#define CPU_FREQ 11289600 113#define CPU_FREQ 11289600
114 114
115/* Type of mobile power */ 115/* Type of mobile power */
116#define CONFIG_BATTERY BATT_LIPOL1300 116#define X5_BATT_CONFIG 2
117#define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */ 117#define CONFIG_BATTERY BATT_IAUDIO_X5
118#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */ 118#define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */
119#define BATTERY_CAPACITY_INC 50 /* capacity increment */ 119#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
120#define BATTERY_TYPES_COUNT 1 /* only one type */ 120#define BATTERY_CAPACITY_INC 50 /* capacity increment */
121#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ 121#define BATTERY_TYPES_COUNT 1 /* only one type */
122#define BATTERY_SCALE_FACTOR 5859 /* (420703125 + 35900) / 71800 */
122 123
123/* define this if you have a real-time clock */ 124/* define this if you have a real-time clock */
124#define CONFIG_RTC RTC_PCF50606 125#define CONFIG_RTC RTC_PCF50606
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 6f6d253fe9..765bcfdb07 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -70,6 +70,7 @@
70#define BATT_LIION2200 2200 /* FM/V2 recorder type */ 70#define BATT_LIION2200 2200 /* FM/V2 recorder type */
71#define BATT_4AA_NIMH 1500 71#define BATT_4AA_NIMH 1500
72#define BATT_3AAA 1000 /* Ondio */ 72#define BATT_3AAA 1000 /* Ondio */
73#define BATT_IAUDIO_X5 950
73#define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */ 74#define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */
74#define BATT_LPCS355385 1550 /* iriver h10 20Gb - SKC LPCS355385 */ 75#define BATT_LPCS355385 1550 /* iriver h10 20Gb - SKC LPCS355385 */
75#define BATT_BP009 820 /* iriver H10 5/6Gb - iriver BP009 */ 76#define BATT_BP009 820 /* iriver H10 5/6Gb - iriver BP009 */
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 30fe60c293..ba2cc02318 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -63,7 +63,7 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute
63 63
64#if CONFIG_CHARGING >= CHARGING_MONITOR 64#if CONFIG_CHARGING >= CHARGING_MONITOR
65typedef enum { /* sorted by increasing charging current */ 65typedef enum { /* sorted by increasing charging current */
66 DISCHARGING = 0, 66 DISCHARGING = 0,
67 TRICKLE, /* Can occur for CONFIG_CHARGING >= CHARGING_MONITOR */ 67 TRICKLE, /* Can occur for CONFIG_CHARGING >= CHARGING_MONITOR */
68 TOPOFF, /* Can occur for CONFIG_CHARGING == CHARGING_CONTROL */ 68 TOPOFF, /* Can occur for CONFIG_CHARGING == CHARGING_CONTROL */
69 CHARGING /* Can occur for all CONFIG_CHARGING options */ 69 CHARGING /* Can occur for all CONFIG_CHARGING options */
@@ -126,6 +126,9 @@ int battery_time(void); /* minutes */
126 126
127unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */ 127unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */
128 128
129/* read unfiltered battery info */
130void battery_read_info(int *adc, int *voltage, int *level);
131
129/* Tells if the battery level is safe for disk writes */ 132/* Tells if the battery level is safe for disk writes */
130bool battery_level_safe(void); 133bool battery_level_safe(void);
131 134