Skip to content

Commit 1ebd4ed

Browse files
committed
Add additional docstrings
1 parent ac789fb commit 1ebd4ed

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

adafruit_ags02ma.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,13 @@
1414
Implementation Notes
1515
--------------------
1616
17-
**Hardware:**
18-
19-
.. todo:: Add links to any specific hardware product page(s), or category page(s).
20-
Use unordered list & hyperlink rST inline format: "* `Link Text <url>`_"
21-
2217
**Software and Dependencies:**
2318
2419
* Adafruit CircuitPython firmware for the supported boards:
2520
https://circuitpython.org/downloads
2621
27-
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies
28-
based on the library's use of either.
22+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2923
30-
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
31-
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
3224
"""
3325

3426
import time
@@ -65,8 +57,9 @@ def _generate_crc(data):
6557

6658
class AGS02MA:
6759
"""Driver for the AGS02MA air quality sensor
60+
6861
:param ~busio.I2C i2c_bus: The I2C bus the AGS02MA is connected to.
69-
:param address: The I2C device address. Defaults to :const:`0x1A`
62+
:param int address: The I2C device address. Defaults to :const:`0x1A`
7063
"""
7164

7265
def __init__(self, i2c_bus, address=AGS02MA_I2CADDR_DEFAULT):
@@ -99,7 +92,11 @@ def TVOC(self): # pylint: disable=invalid-name
9992
return val & 0xFFFFFF
10093

10194
def set_address(self, new_addr):
102-
"""Set the address for the I2C interface, from 0x0 to 0x7F"""
95+
"""Set the address for the I2C interface, from 0x0 to 0x7F
96+
97+
:param int new_addr: THe new address
98+
"""
99+
103100
_buf = bytearray(
104101
[
105102
_AGS02MA_SETADDR_REG,
@@ -115,6 +112,12 @@ def set_address(self, new_addr):
115112
i2c.write(_buf)
116113

117114
def _read_reg(self, addr, delayms):
115+
"""Read a register
116+
117+
:param int addr: The address to read
118+
:param int delayms: The delay between writes and reads, in milliseconds
119+
"""
120+
118121
with self.i2c_device as i2c:
119122
self._addr[0] = addr
120123
i2c.write(self._addr)

0 commit comments

Comments
 (0)