Add General Call addressing to AVR8Bit TWI - Define backward compatible API to be used for other cores #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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