summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/adc.c9
-rw-r--r--firmware/drivers/pcf50605.c12
-rw-r--r--firmware/export/config-ipodvideo.h4
3 files changed, 9 insertions, 16 deletions
diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c
index e5dd4c1e53..a75f788417 100644
--- a/firmware/drivers/adc.c
+++ b/firmware/drivers/adc.c
@@ -298,12 +298,17 @@ static struct adc_struct adcdata[NUM_ADC_CHANNELS] IDATA_ATTR;
298 * a 13 bit value corresponding to 0-5.4v, the resulting range is 13FB-17FA, 298 * a 13 bit value corresponding to 0-5.4v, the resulting range is 13FB-17FA,
299 * representing 3.1-5.4v */ 299 * representing 3.1-5.4v */
300static unsigned short ten_bit_subtractor(unsigned short data) { 300static unsigned short ten_bit_subtractor(unsigned short data) {
301 return (data<<2)+0x13FB; 301 return (data<<2)+0x4FB;
302} 302}
303 303
304static unsigned short _adc_scan(struct adc_struct *adc) 304static unsigned short _adc_scan(struct adc_struct *adc)
305{ 305{
306 unsigned short data = pcf50605_a2d_read(adc->channelnum); 306 unsigned short data;
307
308 /* ADCC1, 8 bit, start */
309 pcf50605_write(0x2f, 0x80 | (adc->channelnum << 1) | 0x1);
310 data = pcf50605_read(0x30); /* ADCS1 */
311
307 if (adc->conversion) { 312 if (adc->conversion) {
308 data = adc->conversion(data); 313 data = adc->conversion(data);
309 } 314 }
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c
index 7d2036e807..c8ea4a499f 100644
--- a/firmware/drivers/pcf50605.c
+++ b/firmware/drivers/pcf50605.c
@@ -98,18 +98,6 @@ int pcf50605_write_multiple(int address, const unsigned char* buf, int count)
98 return 0; 98 return 0;
99} 99}
100 100
101unsigned short pcf50605_a2d_read(int adc_input)
102{
103 unsigned short hi;
104 unsigned char lo;
105
106 ipod_i2c_send(0x8, 0x2f, (adc_input<<1) | 0x1); /* ADCC2, ADCMUX = adc_input, ADCSTART = 1 */
107 hi = i2c_readbyte(0x8, 0x30); /* ADCS1 */
108 lo = (i2c_readbyte(0x8, 0x31) & 0x3); /* ADCS2 */
109
110 return (hi << 2) | lo;
111}
112
113/* The following command puts the iPod into a deep sleep. Warning 101/* The following command puts the iPod into a deep sleep. Warning
114 from the good people of ipodlinux - never issue this command 102 from the good people of ipodlinux - never issue this command
115 without setting CHGWAK or EXTONWAK if you ever want to be able to 103 without setting CHGWAK or EXTONWAK if you ever want to be able to
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 1fa778dbc4..9a561c3adc 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -61,10 +61,10 @@
61/* Type of mobile power */ 61/* Type of mobile power */
62#define CONFIG_BATTERY BATT_LIPOL1300 62#define CONFIG_BATTERY BATT_LIPOL1300
63 63
64#define BATTERY_SCALE_FACTOR 586 /* FIX: this value is picked at random */ 64#define BATTERY_SCALE_FACTOR 2353
65 65
66/* Define this if the platform can charge batteries */ 66/* Define this if the platform can charge batteries */
67//#define HAVE_CHARGING 1 67#define HAVE_CHARGING 1
68 68
69/* define this if the hardware can be powered off while charging */ 69/* define this if the hardware can be powered off while charging */
70//#define HAVE_POWEROFF_WHILE_CHARGING 70//#define HAVE_POWEROFF_WHILE_CHARGING