29
29
30
30
try :
31
31
from busio import I2C
32
- from typing_extensions import NoReturn
33
32
except ImportError :
34
33
pass
35
34
53
52
def _generate_crc (data : int ) -> int :
54
53
"""8-bit CRC algorithm for checking data
55
54
56
- :param bytearray data: The data to generate a CRC for
55
+ :param int data: The data to generate a CRC for
57
56
"""
58
57
59
58
crc = _AGS02MA_CRC8_INIT
@@ -73,7 +72,9 @@ class AGS02MA:
73
72
"""Driver for the AGS02MA air quality sensor.
74
73
75
74
.. warning::
76
- I2C communication rate cannot be higher than 30KHZ
75
+ I2C communication rate cannot be higher than 30KHZ. Refer to
76
+ https://cdn-shop.adafruit.com/product-files/5593/datasheet+ags02ma.pdf
77
+ Section 3.
77
78
78
79
:param ~busio.I2C i2c_bus: The I2C bus the AGS02MA is connected to.
79
80
:param int address: The I2C device address. Defaults to :const:`0x1A`
@@ -123,7 +124,7 @@ def firmware_version(self) -> int:
123
124
return self ._read_reg (_AGS02MA_VERSION_REG , 30 )
124
125
125
126
@property
126
- def gas_resistance (self ) -> float :
127
+ def gas_resistance (self ) -> int :
127
128
"""The resistance of the MEMS gas sensor"""
128
129
return self ._read_reg (_AGS02MA_GASRES_REG , 1500 ) * 100 # in 0.1Kohm
129
130
@@ -140,7 +141,7 @@ def TVOC(self) -> int: # pylint: disable=invalid-name
140
141
raise RuntimeError ("Sensor still preheating" )
141
142
return val & 0xFFFFFF
142
143
143
- def set_address (self , new_addr : int ) -> NoReturn :
144
+ def set_address (self , new_addr : int ) -> None :
144
145
"""Set the address for the I2C interface, from 0x0 to 0x7F
145
146
The sensor supports modifying the I2C address. After sending
146
147
this command, the new address will take effect immediately,
0 commit comments