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

I2C Autodetection #1072

Merged
merged 15 commits into from
Jul 31, 2024

Conversation

mikepparks
Copy link
Contributor

In an effort to reduce the amount of work needed for migration and configuration of I2C addons, this PR aims to allow all I2C addons to be autodetected on startup. This removes the need for I2C address and block fields in webconfig and subsequent configuration data. A device only needs to be included on a previously-enabled I2C peripheral block and its addon enabled.

  • When available() is called, if the addon is enabled, the list of known I2C addresses for the device will be passed to the PeripheralManager to be scanned.
  • If a device is found at the address, the addon currently treats it as available and enables itself. Otherwise, the addon is disabled, and does not get included in the list.
  • This currently does not include whether or not the device is compatible with the addon, only whether it exists at the address. Further detection would likely need to be done prior to inclusion in the update loop.

This approach does allow the autodetection of supported Display devices. However, further work will need to be done to either allow interoperability between the Display and other devices sharing the I2C block, or a "priority" mode where the block cannot be shared with others.

@mikepparks mikepparks marked this pull request as ready for review June 27, 2024 18:20
@mikepparks mikepparks changed the title [WIP] I2C Autodetection I2C Autodetection Jun 27, 2024
arntsonl
arntsonl previously approved these changes Jul 31, 2024
Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Very good feature to have with our i2c peripherals

@arntsonl arntsonl merged commit 3826b1b into OpenStickCommunity:main Jul 31, 2024
42 checks passed
@mikepparks mikepparks deleted the 20240617-i2c-autodetect branch October 4, 2024 18:54
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.

2 participants