WiringProject/Wiring — pull request #1 by edbaafi (2011-11-12 20:30:29+00:00)
Title: Add General Call addressing to AVR8Bit TWI - Define backward compatible API to be used for other cores  

This patch adds "General Call" capabilities to the AVR8Bit TWI (I2C) implementation.

General Call is like a broadcast that can be received by many listeners at the same same. This is useful when you don't know the address of the device you want to talk to or it can be used as a sort of interrupt over the TWI (I2C). For more info on General Call, please see the I2C specs.

With this patch, the Wire library (AVR8Bit) now supports General Call by adding a second receive callback to Wire.onReceive(). This second callback will be called whenever a message is received over the general call address. If a second callback is not defined, general call addressing will not be enabled in the TWI driver (utility).

This patch and the API change is backward compatible and is reasonably well documented in the example sketch. Also see the comments re: bug uncovered while testing the example.

While this patch is generally useful, it is motivated by Modkit's work on dynamic TWI (I2C) addressing for OpenShield.

Thanks,
-Ed