-
Notifications
You must be signed in to change notification settings - Fork 38
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
A library should never call begin() on a shared bus #9
Comments
hiya, wontfix - this is 100% the standard operation procedure for arduino libaries and we've done it 200+ times for 10 years. Wire.begin() should be idempotent in the board support implementation, as it is in all official Arduino boards! |
its also what Arduino does for their libraries, in case you think we're doing it wrong ;) |
That doesn't mean it is the right thing to do. I'm not suggesting you should change it to all, only if you want to consider it for this one and future libraries. |
nope, wontfix - if you have a 'fork' and its not compatible with arduino's official libraries, its your fork thats the issue :) Wire.begin() was designed to be callable as many times as you like, if that implementation is broken, it needs to be fixed, not a decade worth of libraries |
See:
Adafruit_SGP30/Adafruit_SGP30.cpp
Line 50 in 00569ee
The library for this sensor does call
begin()
on the I2C bus.A library should never call functions like these on a shared medium without explicit call to do so.
A library should just add support for some sensor or device and should never change things on a shared medium.
This does cause undefined behavior when using the library together with other sensors on the same bus.
If you really need to have it done in the
begin
function of your library, then please either add an optional parameter to not call begin or use defines in the code to exclude it.The text was updated successfully, but these errors were encountered: