diff options
author | Brandon Low <lostlogic@rockbox.org> | 2006-03-09 19:47:12 +0000 |
---|---|---|
committer | Brandon Low <lostlogic@rockbox.org> | 2006-03-09 19:47:12 +0000 |
commit | 19f4c2a093698940482aad6df0bd8478a82f2a9d (patch) | |
tree | 66de55749bcaaf45d95b828423ffca8c715b7112 /firmware/drivers/pcf50605.c | |
parent | 5ecac908a2738e7a83dc0227daef3aaf16787dbc (diff) | |
download | rockbox-19f4c2a093698940482aad6df0bd8478a82f2a9d.tar.gz rockbox-19f4c2a093698940482aad6df0bd8478a82f2a9d.zip |
Improve ipod i2c driver somewhat by at least taking advantage of the in-device addressing in the pcf50605, also switch to a 10bit resistive divider for the ipod battery reading, this is easily configurable if it needs changing, or even to become a user/runtime setting
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8980 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/pcf50605.c')
-rw-r--r-- | firmware/drivers/pcf50605.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c index c8ea4a499f..a8c61b1789 100644 --- a/firmware/drivers/pcf50605.c +++ b/firmware/drivers/pcf50605.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * KIND, either express or implied. | 23 | * KIND, either express or implied. |
24 | * | 24 | * |
25 | ****************************************************************************/ | 25 | ****************************************************************************/ |
26 | #include "system.h" | ||
26 | #include "config.h" | 27 | #include "config.h" |
27 | #if CONFIG_I2C == I2C_PP5020 | 28 | #if CONFIG_I2C == I2C_PP5020 |
28 | #include "i2c-pp5020.h" | 29 | #include "i2c-pp5020.h" |
@@ -72,15 +73,8 @@ int pcf50605_read(int address) | |||
72 | 73 | ||
73 | int pcf50605_read_multiple(int address, unsigned char* buf, int count) | 74 | int pcf50605_read_multiple(int address, unsigned char* buf, int count) |
74 | { | 75 | { |
75 | int i; | 76 | int read = i2c_readbytes(0x08, address, count, buf); |
76 | 77 | return read - count; | |
77 | for (i=0;i<count;i++) | ||
78 | { | ||
79 | buf[i]=pcf50605_read(address); | ||
80 | address++; | ||
81 | } | ||
82 | |||
83 | return 0; | ||
84 | } | 78 | } |
85 | 79 | ||
86 | int pcf50605_write(int address, unsigned char val) | 80 | int pcf50605_write(int address, unsigned char val) |