Skip to content

Commit dd5e082

Browse files
committed
docs: Update README conventions after snake_case migration.
1 parent c775c29 commit dd5e082

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ from apds9960 import APDS9960
249249
i2c = machine.I2C(1)
250250
apds = APDS9960(i2c)
251251

252-
apds.enableLightSensor()
253-
light = apds.readAmbientLight()
252+
apds.enable_light_sensor()
253+
light = apds.read_ambient_light()
254254

255255
```
256256

@@ -461,7 +461,7 @@ lib/<component>/
461461
### Coding conventions
462462

463463
- **Constants**: use `from micropython import const` wrapper in `const.py` files.
464-
- **Naming**: `snake_case` for new methods. Legacy `camelCase` is acceptable for I2C helpers to stay consistent with existing drivers.
464+
- **Naming**: `snake_case` for all methods and variables. Enforced by ruff (N802, N803, N806).
465465
- **Class inheritance**: `class Foo(object):` is the existing convention.
466466
- **Time**: use `from time import sleep_ms` (not `utime`, not `sleep()` with float seconds).
467467
- **Exceptions**: use `except Exception:` instead of bare `except:`.
@@ -471,7 +471,7 @@ lib/<component>/
471471

472472
- **Constructor signature**: `def __init__(self, i2c, ..., address=DEFAULT_ADDR)` — first parameter is always `i2c` (not `bus`), address uses keyword argument with a default from `const.py`.
473473
- **Attributes**: `self.i2c` for the I2C bus, `self.address` for the device address (not `self.bus`, `self.addr`).
474-
- **I2C helpers**: use private snake_case methods `_read_reg()`, `_write_reg()` for register access. Legacy names (`setReg`, `getReg`, `i2cReadBytes`, etc.) are acceptable in existing drivers but new drivers must use the standard naming.
474+
- **I2C helpers**: use private snake_case methods `_read_reg()`, `_write_reg()` for register access.
475475

476476
### Linting
477477

0 commit comments

Comments
 (0)