Skip to content

Commit 9da9424

Browse files
authored
Merge pull request #25 from tekktrik/docstring-touchup
Add param types to docstrings, use tables
2 parents b63af0d + 1b3592d commit 9da9424

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

adafruit_vl6180x.py

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ class VL6180X:
9595
"""Create an instance of the VL6180X distance sensor. You must pass in
9696
the following parameters:
9797
98-
:param i2c: An instance of the I2C bus connected to the sensor.
98+
:param ~I2C i2c: An instance of the I2C bus connected to the sensor.
9999
100100
Optionally you can specify:
101101
102-
:param address: The I2C address of the sensor. If not specified the sensor's
102+
:param int address: The I2C address of the sensor. If not specified the sensor's
103103
default value will be assumed.
104+
:param int offset: The offset to be applied to measurements, in mm
104105
"""
105106

106107
def __init__(
@@ -168,7 +169,8 @@ def range_history_enabled(self) -> bool:
168169

169170
def start_range_continuous(self, period: int = 100) -> None:
170171
"""Start continuous range mode
171-
:param period: Time delay between measurements in ms
172+
173+
:param int period: Time delay between measurements, in milliseconds
172174
"""
173175
# Set range between measurements
174176
period_reg: int = 0
@@ -230,14 +232,22 @@ def _read_range_continuous(self) -> int:
230232
def read_lux(self, gain: int) -> float:
231233
"""Read the lux (light value) from the sensor and return it. Must
232234
specify the gain value to use for the lux reading:
233-
- ALS_GAIN_1 = 1x
234-
- ALS_GAIN_1_25 = 1.25x
235-
- ALS_GAIN_1_67 = 1.67x
236-
- ALS_GAIN_2_5 = 2.5x
237-
- ALS_GAIN_5 = 5x
238-
- ALS_GAIN_10 = 10x
239-
- ALS_GAIN_20 = 20x
240-
- ALS_GAIN_40 = 40x
235+
236+
================= =====
237+
Setting Value
238+
================= =====
239+
``ALS_GAIN_1`` 1x
240+
``ALS_GAIN_1_25`` 1.25x
241+
``ALS_GAIN_1_67`` 1.67x
242+
``ALS_GAIN_2_5`` 2.5x
243+
``ALS_GAIN_5`` 5x
244+
``ALS_GAIN_10`` 10x
245+
``ALS_GAIN_20`` 20x
246+
``ALS_GAIN_40`` 40x
247+
================= =====
248+
249+
:param int gain: The gain value to use
250+
241251
"""
242252
reg = self._read_8(_VL6180X_REG_SYSTEM_INTERRUPT_CONFIG)
243253
reg &= ~0x38
@@ -286,17 +296,22 @@ def range_status(self) -> int:
286296
"""Retrieve the status/error from a previous range read. This will
287297
return a constant value such as:
288298
289-
- ERROR_NONE - No error
290-
- ERROR_SYSERR_1 - System error 1 (see datasheet)
291-
- ERROR_SYSERR_5 - System error 5 (see datasheet)
292-
- ERROR_ECEFAIL - ECE failure
293-
- ERROR_NOCONVERGE - No convergence
294-
- ERROR_RANGEIGNORE - Outside range ignored
295-
- ERROR_SNR - Too much noise
296-
- ERROR_RAWUFLOW - Raw value underflow
297-
- ERROR_RAWOFLOW - Raw value overflow
298-
- ERROR_RANGEUFLOW - Range underflow
299-
- ERROR_RANGEOFLOW - Range overflow
299+
===================== ==============================
300+
Error Description
301+
===================== ==============================
302+
``ERROR_NONE`` No error
303+
``ERROR_SYSERR_1`` System error 1 (see datasheet)
304+
``ERROR_SYSERR_5`` System error 5 (see datasheet)
305+
``ERROR_ECEFAIL`` ECE failure
306+
``ERROR_NOCONVERGE`` No convergence
307+
``ERROR_RANGEIGNORE`` Outside range ignored
308+
``ERROR_SNR`` Too much noise
309+
``ERROR_RAWUFLOW`` Raw value underflow
310+
``ERROR_RAWOFLOW`` Raw value overflow
311+
``ERROR_RANGEUFLOW`` Range underflow
312+
``ERROR_RANGEOFLOW`` Range overflow
313+
===================== ==============================
314+
300315
"""
301316
return self._read_8(_VL6180X_REG_RESULT_RANGE_STATUS) >> 4
302317

0 commit comments

Comments
 (0)