summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d7c99e6)
INLINE bool i2c_bitbang_start_1(struct I2c *i2c)
{
bool ret;
INLINE bool i2c_bitbang_start_1(struct I2c *i2c)
{
bool ret;
+ /* Clear all error, we restart */
+ i2c->errors &= ~(I2C_NO_ACK | I2C_ARB_LOST);
+
i2c_halfbitDelay(I2C_DEV(i2c));
i2c_sdaLo(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
i2c_sdaLo(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
ret = !i2c_sdaIn(I2C_DEV(i2c));
}
ret = !i2c_sdaIn(I2C_DEV(i2c));
}
i2c_sclHi(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
}
i2c_sclHi(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
}
ack = !i2c_sdaIn(I2C_DEV(i2c));
ack = !i2c_sdaIn(I2C_DEV(i2c));
i2c_sclLo(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
}
if (!ack)
i2c_sclLo(I2C_DEV(i2c));
i2c_halfbitDelay(I2C_DEV(i2c));
}
if (!ack)
- {
- LOG_ERR("NO ACK received\n");
i2c->errors |= I2C_NO_ACK;
i2c->errors |= I2C_NO_ACK;
/* Generate stop condition (if requested) */
if (((i2c->xfer_size == 1) && (i2c->flags & I2C_STOP)) || i2c->errors)
/* Generate stop condition (if requested) */
if (((i2c->xfer_size == 1) && (i2c->flags & I2C_STOP)) || i2c->errors)