drivers: Standardize device identification to device_id().#142
Merged
Conversation
f2a0060 to
b1705b6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Standardizes device identification APIs across multiple I2C drivers by introducing/renaming to a common device_id() method, and updates scenario tests and documentation to use the unified interface.
Changes:
- Rename per-driver ID methods (e.g.,
who_am_i(),read_who_am_i(),read_model_id(),device_type()) todevice_id()across several drivers. - Update YAML scenario tests (mock + hardware) and an example script to call
device_id(). - Document the
device_id()convention in the root README and adddevice_id()to the APDS9960 driver.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scenarios/vl53l1x.yaml | Updates identity check to call device_id() |
| tests/scenarios/lis2mdl.yaml | Updates WHO_AM_I checks/scripts to call device_id() |
| tests/scenarios/ism330dl.yaml | Updates WHO_AM_I method call to device_id() |
| tests/scenarios/hts221.yaml | Updates WHO_AM_I method call to device_id() |
| README.md | Documents repo-wide device_id() convention for drivers |
| lib/vl53l1x/vl53l1x/device.py | Renames read_model_id() to device_id() and updates init check |
| lib/lis2mdl/lis2mdl/device.py | Renames read_who_am_i() to device_id() |
| lib/lis2mdl/examples/magnet_test.py | Updates example to call device_id() |
| lib/ism330dl/ism330dl/device.py | Renames who_am_i() to device_id() and updates device check |
| lib/hts221/hts221/device.py | Renames who_am_i() to device_id() |
| lib/bq27441/bq27441/device.py | Renames device_type() to device_id() and updates validity check |
| lib/apds9960/apds9960/device.py | Adds device_id() helper method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Closes #77
Summary
Standardize all device identification methods to
device_id(), consistent with WSEN-HIDS and WSEN-PADS which already use this name.who_am_i()device_id()who_am_i()device_id()read_who_am_i()device_id()read_model_id()device_id()device_type()device_id()device_id()addeddevice_id()device_id()Drivers without an ID register (MCP23009E, SSD1327) are not concerned.
Also updated README to document the
device_id()convention.Test plan