Start of init function
The first parts of the init function. This should be the most neccesary info that the class needs.
This commit is contained in:
@@ -9,7 +9,6 @@ import requests
|
|||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
DEVICE_BUS = 1
|
DEVICE_BUS = 1
|
||||||
DEVICE_ADDR = 0x58
|
|
||||||
BASELINE_FILENAME = os.path.expanduser("~/sgp_config_data.txt")
|
BASELINE_FILENAME = os.path.expanduser("~/sgp_config_data.txt")
|
||||||
|
|
||||||
class _commands():
|
class _commands():
|
||||||
@@ -31,6 +30,12 @@ class _commands():
|
|||||||
|
|
||||||
class Sgp30():
|
class Sgp30():
|
||||||
|
|
||||||
|
def __init__(self,bus,device_address = 0x58):
|
||||||
|
self._bus = bus
|
||||||
|
self._device_addr = device_address
|
||||||
|
self.rw=partial(read_write,bus=bus)
|
||||||
|
self._start_time = time()
|
||||||
|
|
||||||
Sgp30Answer = namedtuple("Sgp30Answer",["data","raw"])
|
Sgp30Answer = namedtuple("Sgp30Answer",["data","raw"])
|
||||||
|
|
||||||
def read_write(cmd,bus,addr=DEVICE_ADDR):
|
def read_write(cmd,bus,addr=DEVICE_ADDR):
|
||||||
|
Reference in New Issue
Block a user