X-Git-Url: http://git.droids-corp.org/?p=protos%2Fimu.git;a=blobdiff_plain;f=i2cm_sw.c;h=6c2534a1c03372d0ea0f0f8a30d9b38a68c9f633;hp=92f23216548bfd54df1305be968e2bac4c347d51;hb=c4c55774fa78dc2e7f5824750c4c4ce10f62db1b;hpb=9c35c09227041d2d23477b19443b3f707fddc664 diff --git a/i2cm_sw.c b/i2cm_sw.c index 92f2321..6c2534a 100644 --- a/i2cm_sw.c +++ b/i2cm_sw.c @@ -49,11 +49,11 @@ void (*g_i2cm_event)(i2cm_state state); A5 = PC5/SCL */ -#define I2CM_SCL_PORT PORTC -#define I2CM_SCL_BIT 5 +#define I2CM_SCL_PORT PORTD +#define I2CM_SCL_BIT 6 -#define I2CM_SDA_PORT PORTC -#define I2CM_SDA_BIT 4 +#define I2CM_SDA_PORT PORTD +#define I2CM_SDA_BIT 5 #define I2CM_SCL I2CM_SCL_PORT, I2CM_SCL_BIT #define I2CM_SDA I2CM_SDA_PORT, I2CM_SDA_BIT @@ -136,9 +136,6 @@ uint8_t i2cm_send_byte(uint8_t byte) I2CM_DELAY(); mask >>=1; - // delay needed ? - //I2CM_DELAY(); - // clock High I2C_HIGH(I2CM_SCL_PORT, I2CM_SCL_BIT); I2CM_DELAY(); @@ -160,8 +157,8 @@ uint8_t i2cm_send_byte(uint8_t byte) I2CM_DELAY(); while ( bit_is_clear(PIN(I2CM_SCL_PORT), I2CM_SCL_BIT) );// slave handshake - // receive ACK - if (bit_is_set(I2CM_SDA_PORT, I2CM_SDA_BIT)) + // we should receive ACK + if (bit_is_set(PIN(I2CM_SDA_PORT), I2CM_SDA_BIT)) err = I2CM_SENT_NO_ACK; // clock low