diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-07 11:47:25 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-07 11:47:25 (GMT) |
| commit | e5f455b5ba9e2230b1de13cb5038196bc095ce67 (patch) | |
| tree | 5ea829c3a1a7149bc5279758157ea8c6d7fbe97b /wasp/drivers/cst816s.py | |
| parent | 6dd50f89ba6ee95660c07551076e9ab95dc2eff7 (diff) | |
drivers: cst816s: Decouple from the watch module
Diffstat (limited to 'wasp/drivers/cst816s.py')
| -rw-r--r-- | wasp/drivers/cst816s.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/wasp/drivers/cst816s.py b/wasp/drivers/cst816s.py index 5157650..4a372c0 100644 --- a/wasp/drivers/cst816s.py +++ b/wasp/drivers/cst816s.py @@ -1,13 +1,11 @@ """Hynitron CST816S touch contoller driver for MicroPython.""" -import watch - class CST816S: """Hynitron CST816S I2C touch controller driver.""" - def __init__(self): + def __init__(self, bus): + self.i2c = bus self.dbuf = bytearray(6) - pass def get_event(self, queue): """Receive a touch event. @@ -20,7 +18,7 @@ class CST816S: dbuf = self.dbuf try: - watch.i2c.readfrom_mem_into(21, 1, dbuf) + self.i2c.readfrom_mem_into(21, 1, dbuf) except OSError: return False |
