summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-05-28 15:07:45 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-05-28 15:07:45 +0000
commit95a323cbb1ae386c6f8bff55e3c5613c3581406a (patch)
tree94384f961ba410adf4cb07e86b4d3849650acb37 /firmware/drivers
parent166f3298df5d0fd89ed2b155234dcbcb2d045975 (diff)
downloadrockbox-95a323cbb1ae386c6f8bff55e3c5613c3581406a.tar.gz
rockbox-95a323cbb1ae386c6f8bff55e3c5613c3581406a.zip
getack didn't clean up after a NAK
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@768 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/i2c.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c
index 3ef2f48a6b..e9b06edb42 100644
--- a/firmware/drivers/i2c.c
+++ b/firmware/drivers/i2c.c
@@ -105,7 +105,7 @@ void i2c_ack(int bit)
105 105
106int i2c_getack(void) 106int i2c_getack(void)
107{ 107{
108 unsigned short x; 108 int ret = 1;
109 109
110 /* Here's the deal. The MAS is slow, and sometimes needs to wait 110 /* Here's the deal. The MAS is slow, and sometimes needs to wait
111 before it can send the acknowledge. Therefore it forces the clock 111 before it can send the acknowledge. Therefore it forces the clock
@@ -119,15 +119,15 @@ int i2c_getack(void)
119 while(!SCL) /* and wait for the MAS to release it */ 119 while(!SCL) /* and wait for the MAS to release it */
120 yield(); 120 yield();
121 121
122 x = SDA; 122 if (SDA)
123 if (x)
124 /* ack failed */ 123 /* ack failed */
125 return 0; 124 ret = 0;
125
126 SCL_OUTPUT; 126 SCL_OUTPUT;
127 SCL_LO; 127 SCL_LO;
128 SDA_HI; 128 SDA_HI;
129 SDA_OUTPUT; 129 SDA_OUTPUT;
130 return 1; 130 return ret;
131} 131}
132 132
133void i2c_outb(unsigned char byte) 133void i2c_outb(unsigned char byte)