Wire library (TWI)

Good idea,

  • I propose post the code here so it can be peer reviewed and tested,
  • and lets discuss the (new) interface and how to keep it backwards compatible (important imho)
  • if it is stable it can be pushed to googlecode / git / whereever

I'm currently using I2C for 5 devices (ao PCF8574) and if it could be 4x as fast would be great!

  • update -
    a quick look shows the 1.0.3 version has the 400Khz and even 1Mhz numbers in place. So the most important point is the interface.

The begin method has a slave address as interface so I think the constructor should have the main param

TwoWire(int speed=100, uint8_t buffersize=32)  // max bufsize 255 ? or do we need an uint16_t for that? (MEGA / DUE?)
{
  if (speed == 1000) _speed = 1000;   // _speed in KHz
  else if (speed == 400) _speed = 400;  
  else _speed = 100;

  _bufsize = buffersize;
}

?