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

wire.begin() not called inside ExternalEEPROM::begin() #35

Closed
ebabcock72 opened this issue Apr 1, 2024 · 1 comment
Closed

wire.begin() not called inside ExternalEEPROM::begin() #35

ebabcock72 opened this issue Apr 1, 2024 · 1 comment

Comments

@ebabcock72
Copy link

Subject of the issue

Every library I have used previously calls wire.begin() inside of the library's begin() function. This library requires you call wire.begin() prior to calling ExternalEEPROM::begin().

Your workbench

I'm using an ESP32 board from HiLetGo powered over USB. The Sparkfun EEPROM board is wired through a Proto board and soldered wires to the I2C bus.

Steps to reproduce

Call ExternalEEPROM::begin() without first calling wire.begin(). It fails to connect

Expected behavior

It should connect automatically by calling wire.begin() itself.

Actual behavior

Freezes and does not find the EEPROM.

@nseidle
Copy link
Member

nseidle commented Apr 2, 2024

I'm sorry, but we stopped using a Wire.begin() inside of libraries over four years ago. Calling Wire.begin inside a library is a bad idea for a variety of reasons. First it overwrites any previous Wire.setClock(). Second, if a user passes in a different Wire hardware port (ie, Wire1), and the user hasn't initiated that pointer, then initiating the library with a null pointer leads to bad things.

@nseidle nseidle closed this as completed Apr 2, 2024
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

No branches or pull requests

2 participants