Skip to content

Commit 79dd315

Browse files
committed
more linty
1 parent b202f4b commit 79dd315

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Introduction
1212
:target: https://discord.gg/nBQh6qu
1313
:alt: Discord
1414
15-
TODO
15+
A CircuitPython driver for the Sensirion SGP30 gas sensor with eCO2 and TVOC output. This sensor uses I2C!
1616

1717
Dependencies
1818
=============

adafruit_sgp30.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR):
5454
self._device = I2CDevice(i2c, address)
5555

5656
# get unique serial, its 48 bits so we store in an array
57-
self._serial = self._i2c_read_words_from_cmd([0x36, 0x82], 0.01, 3)
57+
self.serial = self._i2c_read_words_from_cmd([0x36, 0x82], 0.01, 3)
5858
# get featuerset
5959
featureset = self._i2c_read_words_from_cmd([0x20, 0x2f], 0.01, 1)
6060
if featureset[0] != _SGP30_FEATURESET:

examples/sgp30_test.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1+
""" Example for using the SGP30 with CircuitPython and the Adafruit library"""
2+
3+
import time
14
import board
25
import busio
3-
import time
46
import adafruit_sgp30
57

68
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
7-
9+
810
# Create library object on our I2C port
911
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
10-
11-
print("SGP30 serial #", [hex(i) for i in sgp30._serial])
1212

13-
sgp30.sgp_iaq_init()
14-
sgp30.sgp_set_iaq_baseline(0x8973, 0x8aae)
13+
print("SGP30 serial #", [hex(i) for i in sgp30.serial])
14+
15+
sgp30.iaq_init()
16+
sgp30.set_iaq_baseline(0x8973, 0x8aae)
1517

1618
elapsed_sec = 0
1719

1820
while True:
19-
co2eq, tvoc = sgp30.sgp_iaq_measure()
21+
co2eq, tvoc = sgp30.iaq_measure()
2022
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
2123
time.sleep(1)
2224
elapsed_sec += 1
2325
if elapsed_sec > 10:
2426
elapsed_sec = 0
25-
co2eq_base, tvoc_base = sgp30.sgp_get_iaq_baseline()
27+
co2eq_base, tvoc_base = sgp30.get_iaq_baseline()
2628
print("**** Baseline values: CO2eq = 0x%x, TVOC = 0x%x" % (co2eq_base, tvoc_base))

0 commit comments

Comments
 (0)