Trim some fat from twi/Wire!

I saw today that the "twi.c" file, used to talk to the TWI interface of the Atmega, contains no less than three full-size buffers for TWI data packets. In addition, the "Wire.cpp" file used to wrap the twi.c file in a class interface adds another two buffers!

I think the buffers in Wire could pretty easily be eliminated by implementing the state machine from twi.c into the Wire.cpp class.

Additionally, the code says things like "I have to do this in this order, because I make take an interrupt at any time" -- while I'm sure that's true, it could also just turn off interrupts for the duration of the critical section, and possibly be a little clearer. Dunno if it would actually save any instructions, so that might be of secondary importance.

also it's a good idea to make the library not-locking, or at least implement timeout.
Do you want to be the first to post the modified code?

My TWI code ended up using other custom functions I have for dieing-on-usage-error, and for scheduling-completion-callback, so it wouldn't fit inside the Arduino framework.

seems a good thing, why should not being implemented?

It is a good thing, but it is totally different from the standard Arduino project.

If we want to turn Arduino into more of a mini-tasking/executive system, and less of a Wiring clone, that would be one thing, but I think that wouldn't be well received. I could be wrong, though!