Add define for screen I2C frequency#9898
Draft
oscgonfer wants to merge 1 commit intomeshtastic:developfrom
Draft
Add define for screen I2C frequency#9898oscgonfer wants to merge 1 commit intomeshtastic:developfrom
oscgonfer wants to merge 1 commit intomeshtastic:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a define for bus frequency for screens that are I2C based.
The reason for adding this is because many I2C sensors can't work at speeds higher than 400kHz. Currently, we are reclocking the I2C bus, but only ESP32 variants can do so. For more details, see arduino/Arduino#11457
Currently, only ESP32 can getClock(), while all cores can setClock():
For cases when I2C speed is different to the ones defined by sensors (see defines in sensor classes), we need to reclock I2C and set it back to the previous desired speed. Only for cases where we can know it OR predefine the speed, we can do this. Currently, the screen library is setting the I2C clock speed, but we are using the default from the library itself (700kHz), which is hardcoded as default on the init function.
Ideally, with this PR, we can move a step forward towards having support for these sensors on devices with or without screens, no matter the variant.
However, some things are pending:
I am setting this as a draft until we agree on the above.