Skip to content

Add define for screen I2C frequency#9898

Draft
oscgonfer wants to merge 1 commit intomeshtastic:developfrom
fablabbcn:enhancement/screen-bus-speed
Draft

Add define for screen I2C frequency#9898
oscgonfer wants to merge 1 commit intomeshtastic:developfrom
fablabbcn:enhancement/screen-bus-speed

Conversation

@oscgonfer
Copy link
Copy Markdown
Contributor

@oscgonfer oscgonfer commented Mar 13, 2026

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:

  • It'd be ideal to know if a screen is detected, what type it is (I2C or not at least), and have a getter method for knowing its speed. I am tagging @HarukiToreda for ideas or suggestions.
  • Once we know if a screen is detected, for non-ESP32 base variants, we still need to know what is the I2C speed without a screen. We can assume 100kHz, but I may be overlooking something.

I am setting this as a draft until we agree on the above.

@oscgonfer oscgonfer marked this pull request as draft March 13, 2026 11:30
@github-actions github-actions Bot added needs-review Needs human review hardware-support Hardware related: new devices or modules, problems specific to hardware labels Mar 13, 2026
@github-actions github-actions Bot added the Stale Issues that will be closed if not triaged. label Apr 28, 2026
@github-actions github-actions Bot closed this May 6, 2026
@oscgonfer oscgonfer reopened this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardware-support Hardware related: new devices or modules, problems specific to hardware needs-review Needs human review Stale Issues that will be closed if not triaged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant