I have noticed that when I2C_DATA_LOW or I2C_CLOCK_LOW are called, the compiler first enables the output driver and then writes a zero to the port register bit. This may violate the I2C spec because if the port bit was 1, the driver will drive a high output to the bus before it is reset to zero. A driver on a I2C bus should be either in hi-z (input mode) or driving low.
The defines should be as follows:
#define I2C_DATA_LOW Set I2C_DATA Off: Dir I2C_DATA Out
and
#define I2C_CLOCK_LOW Set I2C_CLOCK Off: Dir I2C_CLOCK Out
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have noticed that when I2C_DATA_LOW or I2C_CLOCK_LOW are called, the compiler first enables the output driver and then writes a zero to the port register bit. This may violate the I2C spec because if the port bit was 1, the driver will drive a high output to the bus before it is reset to zero. A driver on a I2C bus should be either in hi-z (input mode) or driving low.
The defines should be as follows:
#define I2C_DATA_LOW Set I2C_DATA Off: Dir I2C_DATA Out
and
#define I2C_CLOCK_LOW Set I2C_CLOCK Off: Dir I2C_CLOCK Out