I needed to get an attiny84 to talk to an atmel at24c256 eeprom, i couldn’t figure out how to use the attiny84’s hardware twi implementation to act as a master (though it looks like it’d be easy to make it be a slave), so I implemented TWI in software.
If you’re trying to make an attiny be a TWI master, or if you just want to see how TWI works on the wire, I hope you find this useful (explanation of the code in
twi.h - low level twi wire protocol;
at24c256.h - communication with at24c256 eeprom;
pin_mapping.def - really simple and small IO code)
NB: That code doesn’t use arduino’s pinMode, digitalRead nor digitalWrite. It shouldn’t be hard to change, but if you’ve gotten the Arduino run time libs to run on an attiny you’re smarter than I am and probably don’t need this code in the first place.
Testing: Works for me.