X-Git-Url: http://git.droids-corp.org/?p=protos%2Fimu.git;a=blobdiff_plain;f=i2cm_sw.c;h=e6a6748339f1e7c8baf0f33fe0bd7b14e1929bf9;hp=8c8e238bdf33ba66f9fec5ff93d51d45510f8844;hb=c746f87e35b7986d4f04f5b9bddfb1260a981497;hpb=b33a589412b67654829a1f10e7cac743681a24f4 diff --git a/i2cm_sw.c b/i2cm_sw.c index 8c8e238..e6a6748 100644 --- a/i2cm_sw.c +++ b/i2cm_sw.c @@ -112,7 +112,7 @@ void i2cm_register_event(void (*func)(i2cm_state state)) } -uint8_t i2cm_send_byte(uint8_t byte) +static uint8_t i2cm_send_byte(uint8_t byte) { uint8_t mask; uint8_t err = 0; @@ -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