Skip to content

Conversation

@andr35
Copy link

@andr35 andr35 commented Jun 2, 2019

I've add a line to initialize the Wire library during the I2C setup.
I've tested the code on an ESP8266 and without the init line the I2C protocol doesn't work.

@nseidle
Copy link
Member

nseidle commented Jun 3, 2019

Wire.begin is left to the user to do in their setup() or elsewhere. It should not be in a library.

I really appreciate the PR but we refrain from Wire.begins() inside libraries for a variety of reasons.

  • Wire.begin can overwrite the user's previous Wire.setClock settings
  • Calling Wire.begin multiple times can cause some platforms to crash (I believe ESP8266 had this issue)
  • A well written library does not hard code Wire. See this post

Please keep the PRs coming. We can always make things better.

@nseidle nseidle closed this Jun 3, 2019
@andr35
Copy link
Author

andr35 commented Jun 3, 2019

I've got the point.
Thanks for the reference!

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.

3 participants