Skip to content

Missing setDefaultFrequency() for Wire.begin() cleanup #5518

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

Closed
FStefanni opened this issue Aug 10, 2021 · 1 comment
Closed

Missing setDefaultFrequency() for Wire.begin() cleanup #5518

FStefanni opened this issue Aug 10, 2021 · 1 comment
Assignees
Labels
Status: Solved Type: Feature request Feature request for Arduino ESP32

Comments

@FStefanni
Copy link

Hi,

I am looking for a way to cleanup the call to Wire.begin(), as described in the issue #3779,
i.e. to set all relevant parameter before calling the begin() method.
At the moment, I see that the pins can be set with a call to setPins(), which is fine,
but we are missing an equivalent method to set the last parameter, i.e. the frequency.

I have seen the setClock() method, but for what I understand, calling it is not exactly the same, for example:

  • it seems that we cannot just pass 0 to set the default frequency
  • it actually does the frequency configuration, whilst we just want to set a default parameter for the future

Thus, I believe that adding a support method (e.g. setDefaultFrequency(), accepting also zero as default value), would be great,
since imho it will complete/refine the stuff of issue #3779. This change requires also some other code changes to manage the default frequency, where needed in the rest of the TwoWire class code.

Regards.

@VojtechBartoska VojtechBartoska added Type: Feature request Feature request for Arduino ESP32 Status: Awaiting triage Issue is waiting for triage labels Mar 30, 2022
@SuGlider SuGlider self-assigned this Jul 26, 2022
@SuGlider
Copy link
Collaborator

@FStefanni - Wire has been refactored.
As you can see, Wire::begin() overload is OK (#7000) and Wire::setClock() takes zero as argument and sets the I2C Frequency to the default 100KHz.
https://github.com/espressif/arduino-esp32/blob/master/libraries/Wire/src/Wire.cpp#L272-L293
https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-i2c.c#L267-L271

@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Solved Type: Feature request Feature request for Arduino ESP32
Projects
None yet
Development

No branches or pull requests

3 participants