summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-12 14:13:51 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-12 14:13:51 -0400
commit0d27f4d9a66dcb47b545e715d1833094b0c7b484 (patch)
tree14c17d103d0dfddae7f031aa4fdb004c5ebca2e1 /drivers
parent7c219600a246d8956d0b23ea3f5d125a820e6b6a (diff)
continued WIP: almost compiling
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dht/dht.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/drivers/dht/dht.py b/drivers/dht/dht.py
deleted file mode 100644
index eed61df7c..000000000
--- a/drivers/dht/dht.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# DHT11/DHT22 driver for MicroPython on ESP8266
-# MIT license; Copyright (c) 2016 Damien P. George
-
-try:
- from esp import dht_readinto
-except:
- from pyb import dht_readinto
-
-class DHTBase:
- def __init__(self, pin):
- self.pin = pin
- self.buf = bytearray(5)
-
- def measure(self):
- buf = self.buf
- dht_readinto(self.pin, buf)
- if (buf[0] + buf[1] + buf[2] + buf[3]) & 0xff != buf[4]:
- raise Exception("checksum error")
-
-class DHT11(DHTBase):
- def humidity(self):
- return self.buf[0]
-
- def temperature(self):
- return self.buf[2]
-
-class DHT22(DHTBase):
- def humidity(self):
- return (self.buf[0] << 8 | self.buf[1]) * 0.1
-
- def temperature(self):
- t = ((self.buf[2] & 0x7f) << 8 | self.buf[3]) * 0.1
- if self.buf[2] & 0x80:
- t = -t
- return t