http://www.crennsmind.com/Code/Maple/Wire-Snapshot-110913.zip
Currently I'm not happy with the current implementation because to use multiple Hardware I2C ports, you'd need to create new instances of the class. I'm looking at doing something similar as with the Serial ports. So an instance of the class TwoWire called Wire will be a software implementation (using the Wire implementation currently included with Maple IDE v0.0.11) on pins 19 and 20 (for Arduino shield compatibility reasons), another instance of TwoWire called Wire1 will use Hardware I2C port 1, and another called Wire2 will use Hardware I2C port 2. Any thoughts on this?
Anyway, the main difference between the Arduino implementation and the current implementation is calls to begin(). This is subject to change:
Wire.begin();
Defaults to using Hardware I2C Port 1 at 100kHz.
Wire.begin(<I2C Maple Address>);
Same behaviour as above, currently own addresses are not yet supported in the i2c.h and i2c.c files. However, implementation in Wire library is possible.
Wire.begin(<I2C Maple Address>, <I2C Type>);
You can pick which Hardware I2C port you wish to use at 100kHz, or use the software I2C (master mode only) with the default pins (20 and 21). Selections are for the I2C Type:
-PORTI2C1
-PORTI2C2
-I2CSOFT
Wire.begin(<I2C Maple Address>, <I2C Type>, <I2C Flags>);
This follows the above call but allows for flags to be passed to allow for I2C_FAST_MODE (400kHz instead of 100kHz), I2C_DUTY_16_9(Alternative duty cycle of the clock), and I2C_REMAP(Only available for hardware I2C port 1, remaps to 9 (SDA) and 8(SCL)) . These flags will have no effect for Software I2C which will automatically ignore the flags and set itself using the default software I2C pins.
Wire.begin(<I2C Maple Address>, <I2C Type>, <SDA Pin or I2C Flags>, <SCL Pin>);
This allows for different pins to be used for the software I2C implementation, but this isn't available for the hardware I2C ports to change pins (apart from port 1 being remapped). You can pass flags for the Hardware I2C port as above though.
I believe that should be enough information to get people going, there is still work to be done before this will be finalised and finished.
-Crenn