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)
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)
int i2c_getack(void)
{
- unsigned short x;
+ int ret = 1;
/* Here's the deal. The MAS is slow, and sometimes needs to wait
before it can send the acknowledge. Therefore it forces the clock
@@ -119,15 +119,15 @@ int i2c_getack(void)
while(!SCL) /* and wait for the MAS to release it */
yield();
- x = SDA;
- if (x)
+ if (SDA)
/* ack failed */
- return 0;
+ ret = 0;
+
SCL_OUTPUT;
SCL_LO;
SDA_HI;
SDA_OUTPUT;
- return 1;
+ return ret;
}
void i2c_outb(unsigned char byte)