@RWB, yes, I ported it okay, but have not turned into a library (I must learn how to do that one day)!
You just need to make these changes:
// HR's port
#define i2c_scl_release() \
pinMode(_sclPin, INPUT);
#define i2c_sda_release() \
pinMode(_sdaPin, INPUT);
// sets SCL low and drives output
#define i2c_scl_lo() \
pinResetFast(_sclPin); \
pinMode(_sclPin, OUTPUT);
// sets SDA low and drives output
#define i2c_sda_lo() \
pinResetFast(_sdaPin); \
pinMode(_sdaPin, OUTPUT);
// Setting SCL high and to input releases pin ie floating
// HR NOTE - not implementing PULLUP as is pulled up externally
#define i2c_scl_hi() \
pinSetFast(_sclPin); \
pinMode(_sclPin, INPUT);
// Setting SDA high and to input releases pin ie floating
// HR NOTE - not implementing PULLUP as is pulled up externally
#define i2c_sda_hi() \
pinSetFast(_sdaPin); \
pinMode(_sdaPin, INPUT);
Also follow these comments:
2016-09-19
- Removed i2c_init() from being called in SoftI2CMaster() constructor(s)
- Renamed i2c_init() to begin()
Hope this helps.