adafruit/Adafruit-MCP23008-library — pull request #3 by dcheckoway (2013-02-05 16:32:18+00:00)
Title: ATtiny85 support

Unlike a lot of people, who try Arduino and then end up moving in a direction of more power and more capability (bigger and better), I'm going in the opposite direction. :-) I've been getting into ATtiny stuff...to see just how much I can squeeze out of these (um) tiny chips.

I did find one other library out there (LiquidCrystal_I2C) with TinyWireM support, but it's written for the PCF8574 IO expander, not the MCP23008. So that didn't work with the Adafruit LCD backpack...and I was determined to stick with that hardware and get it working with the ATtiny85 with the least amount of work possible. :-)

Turns out it was trivial. All I did was tweak Adafruit_MCP23008.cpp, using TinyWireM library calls in place of Wire calls, and badabing badaboom.

I've tested this with both 1 MHz and 8 MHz internal oscillator frequencies with both of the common flavors of ATtiny85 cores:

http://hlt.media.mit.edu/?p=1695
...and:
http://code.google.com/p/arduino-tiny/

...and it works swimmingly. Please consider integrating this change to the library. Thanks!