Skip to content

drivers: Standardize I2C helper method naming.#67

Merged
nedseb merged 11 commits intomainfrom
fix/lis2mdl-i2c-helper-naming
Mar 13, 2026
Merged

drivers: Standardize I2C helper method naming.#67
nedseb merged 11 commits intomainfrom
fix/lis2mdl-i2c-helper-naming

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 12, 2026

Summary

Closes #61.

Standardizes I2C helper method names across all drivers to use _read_reg() / _write_reg() (private, snake_case) as documented in the README conventions.

Changes per driver

Driver Before After
lis2mdl setReg, read_reg _write_reg, _read_reg
hts221 setReg, getReg, get2Reg _write_reg, _read_reg, _read_reg16
bq27441 i2cReadBytes, i2cWriteBytes _read_reg, _write_reg
apds9960 _read_byte_data, _write_byte_data, _read_i2c_block_data _read_reg, _write_reg, _read_block
mcp23009e _read_register, _write_register _read_reg, _write_reg
vl53l1x writeReg, readReg, writeReg16Bit, readReg16Bit _write_reg, _read_reg, _write_reg16, _read_reg16
wsen-pads _read_u8, _write_u8, _read _read_reg, _write_reg, _read_block

Already compliant (no changes needed): wsen-hids, ssd1327 (display driver using write_cmd/write_data).

Test plan

  • ruff check passes (verified locally)
  • Hardware test: verify each driver still initializes and communicates correctly on the STeaMi board

@nedseb nedseb requested review from Charly-sketch and Copilot March 12, 2026 21:44
@nedseb nedseb self-assigned this Mar 12, 2026
@nedseb nedseb added the enhancement New feature or request label Mar 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Standardizes internal I2C register access helper names across multiple drivers to improve consistency with the documented driver API conventions (ref: issue #61).

Changes:

  • Renames per-driver I2C helper methods to _read_reg() / _write_reg() (plus _read_reg16(), _write_reg16(), _read_block() where applicable).
  • Updates call sites throughout each driver to use the renamed helpers.
  • Aligns several drivers more closely with the README “Driver API conventions” for private, snake_case I2C helpers.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/wsen-pads/wsen_pads/device.py Renames register helpers to _read_reg / _write_reg and introduces _read_block naming.
lib/vl53l1x/vl53l1x/device.py Renames VL53L1X register access helpers to private snake_case, including 16-bit variants.
lib/mcp23009e/mcp23009e/device.py Renames _read_register / _write_register to _read_reg / _write_reg.
lib/lis2mdl/lis2mdl/device.py Renames setReg / read_reg helpers to _write_reg / _read_reg and updates internal uses.
lib/hts221/hts221/device.py Renames setReg / getReg / get2Reg helpers to _write_reg / _read_reg / _read_reg16.
lib/bq27441/bq27441/device.py Renames i2cReadBytes / i2cWriteBytes helpers to _read_reg / _write_reg.
lib/apds9960/apds9960/device.py Renames low-level APDS9960 I2C helpers to _read_reg / _write_reg / _read_block across base + MicroPython subclass.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/lis2mdl/lis2mdl/device.py Outdated
Comment thread lib/hts221/hts221/device.py Outdated
Comment thread lib/bq27441/bq27441/device.py
@nedseb nedseb merged commit 2c1e7ab into main Mar 13, 2026
4 checks passed
@nedseb nedseb deleted the fix/lis2mdl-i2c-helper-naming branch March 13, 2026 11:45
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drivers: Standardize I2C helper method naming convention.

2 participants