From 9ffa59f205076ffd3ea6ed3b242f0bdd97e4662e Mon Sep 17 00:00:00 2001 From: asmig Date: Mon, 18 Feb 2013 09:47:05 +0000 Subject: [PATCH] Minor improvements in I2C client: - cleaning up clock - pass back ACKed byte count on write git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1504 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- firmware/apps/i2c/i2c.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/firmware/apps/i2c/i2c.c b/firmware/apps/i2c/i2c.c index 1018c5f..7cc74c2 100644 --- a/firmware/apps/i2c/i2c.c +++ b/firmware/apps/i2c/i2c.c @@ -134,6 +134,7 @@ unsigned char I2C_ReadBit() SDAOUTPUT; I2CDELAY(1); I2C_CLOCK_LO(); + I2CDELAY(1); return c; } @@ -161,8 +162,9 @@ unsigned char I2C_ReadBit_Wait() SDAOUTPUT; I2CDELAY(1); I2C_CLOCK_LO(); + I2CDELAY(1); - return c; + return c?0:1; // return true on ACK (0) } //! Send a START Condition @@ -249,15 +251,19 @@ void i2c_handle_fn( uint8_t const app, break; case WRITE: I2C_Start(); - for(i=0; i