nox771 / i2c_t3

Enhanced I2C library for Teensy 3.x devices
157 stars 44 forks source link

Wire status question #29

Open ttlappalainen opened 4 years ago

ttlappalainen commented 4 years ago

I have tried to find documentation for Wire status enums. In .h there is comment of stopped states.

Does states I2C_TIMEOUT, I2C_ADDR_NAK, I2C_DATA_NAK, I2C_ARB_LOST ,I2C_BUF_OVF, I2C_NOT_ACQ, I2C_DMA_ERR mean that comunication has been stopped and bus needs to be reset with resetBus to get it running again?

Or is there some better test forchecking need for reset?

I expect that I2C_WAITING is normal state - stopped, but waiting response and will change to some of above in case on error.

nox771 commented 4 years ago

Yes I2C_WAITING is the idle state. If you get a return error such as one of the above you can issue a resetBus() and retry the command. It is not necessarily the case that a resetBus() will fix it. For instance you can get an I2C_ADDR_NAK if a slave stops responding (perhaps it lost power, or connectivity).