kopia lustrzana https://github.com/micropython/micropython-lib
dht: Change the sequence for importing dht_readinto.
Check the machine module first, then search in previous places. This supports having machine.dht_readinto as the new standard, while still being backwards compatible.pull/570/head
rodzic
900dd1c61b
commit
0e25b109c2
|
@ -2,17 +2,16 @@
|
||||||
# MIT license; Copyright (c) 2016 Damien P. George
|
# MIT license; Copyright (c) 2016 Damien P. George
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import machine
|
||||||
|
|
||||||
if sys.platform.startswith("esp"):
|
if hasattr(machine, "dht_readinto"):
|
||||||
from esp import dht_readinto
|
|
||||||
elif sys.platform == "mimxrt":
|
|
||||||
from mimxrt import dht_readinto
|
|
||||||
elif sys.platform == "rp2":
|
|
||||||
from rp2 import dht_readinto
|
|
||||||
elif sys.platform == "pyboard":
|
|
||||||
from pyb import dht_readinto
|
|
||||||
else:
|
|
||||||
from machine import dht_readinto
|
from machine import dht_readinto
|
||||||
|
elif sys.platform.startswith("esp"):
|
||||||
|
from esp import dht_readinto
|
||||||
|
else:
|
||||||
|
dht_readinto = __import__(sys.platform).dht_readinto
|
||||||
|
|
||||||
|
del machine
|
||||||
|
|
||||||
|
|
||||||
class DHTBase:
|
class DHTBase:
|
||||||
|
|
Ładowanie…
Reference in New Issue