Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add General Call addressing to AVR8Bit TWI - Define backward compatible API to be used for other cores #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edbaafi
Copy link

@edbaafi edbaafi commented Nov 12, 2011

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

…ress (broadcast) in addition to its own address. TwoWire::onReceive is overridden with a second function pointer to a general call receive callback. If the second callback is ommitted, general call is not enabled. This is fully backward compatible and reasonably well documented in the example sketches.
AlexanderBrevig pushed a commit that referenced this pull request Sep 24, 2012
Add debounce time check to button library
@edbaafi edbaafi mentioned this pull request Oct 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant