
This version is available on my 'Paynter's Palace' blog site at Integrating Time, Memory, and Heading Capability, Part V | Paynter's Palace. I made a local modification to the Wire library for my own use that merges the code from the 'I2C Master Library' and the twi.c/h changes posted by unaie, along with changes to the Wire class to allow the 'lockup reset counter' to be reset to zero and to be displayed by the user's arduino program. AFAIK, this library still uses the original twi.c/h with the same blocking while() loops.

I'm not an I2C expert, but apparently the 'repeated starts' feature is useful for at least some extant hardware. There is a 'I2C Master Library' written by DSSCircuits in September 2012, that modified the Wire library to accommodate the 'repeated starts' feature. The StreamFire library was posted in 2012. The 'StreamFire' wire library at GitHub - steamfire/WSWireLib: Arduino Wire Library modified to add timeouts to the freeze-prone TWI while() loops has the modifications that prevent infinite 'while()' loops originally posted two years earlier (September 2010) by 'unaie' in.

Just like the other posters here, I have tried to figure out why the original Wire library (with the broken twi.c) hasn't been fixed.

Like many others on this forum, I too have had problems with I2C, and after much experimentation it was clear the root problem is the blocking while() loops in twi.c.
