You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -249,8 +249,8 @@ from apds9960 import APDS9960
249
249
i2c = machine.I2C(1)
250
250
apds = APDS9960(i2c)
251
251
252
-
apds.enableLightSensor()
253
-
light = apds.readAmbientLight()
252
+
apds.enable_light_sensor()
253
+
light = apds.read_ambient_light()
254
254
255
255
```
256
256
@@ -461,7 +461,7 @@ lib/<component>/
461
461
### Coding conventions
462
462
463
463
-**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).
465
465
-**Class inheritance**: `class Foo(object):` is the existing convention.
466
466
-**Time**: use `from time import sleep_ms` (not `utime`, not `sleep()` with float seconds).
467
467
-**Exceptions**: use `except Exception:` instead of bare `except:`.
@@ -471,7 +471,7 @@ lib/<component>/
471
471
472
472
-**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`.
473
473
-**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.
0 commit comments