14
14
Implementation Notes
15
15
--------------------
16
16
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
-
22
17
**Software and Dependencies:**
23
18
24
19
* Adafruit CircuitPython firmware for the supported boards:
25
20
https://circuitpython.org/downloads
26
21
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
29
23
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
32
24
"""
33
25
34
26
import time
@@ -65,8 +57,9 @@ def _generate_crc(data):
65
57
66
58
class AGS02MA :
67
59
"""Driver for the AGS02MA air quality sensor
60
+
68
61
: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`
70
63
"""
71
64
72
65
def __init__ (self , i2c_bus , address = AGS02MA_I2CADDR_DEFAULT ):
@@ -99,7 +92,11 @@ def TVOC(self): # pylint: disable=invalid-name
99
92
return val & 0xFFFFFF
100
93
101
94
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
+
103
100
_buf = bytearray (
104
101
[
105
102
_AGS02MA_SETADDR_REG ,
@@ -115,6 +112,12 @@ def set_address(self, new_addr):
115
112
i2c .write (_buf )
116
113
117
114
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
+
118
121
with self .i2c_device as i2c :
119
122
self ._addr [0 ] = addr
120
123
i2c .write (self ._addr )
0 commit comments