Skip to content

Commit 20e8e4c

Browse files
Moved busio import inside a try block to save memory
1 parent 413c89b commit 20e8e4c

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

adafruit_adt7410.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,33 @@
3636

3737
import time
3838
import struct
39-
import busio
4039
from adafruit_bus_device.i2c_device import I2CDevice
4140
from adafruit_register.i2c_bit import RWBit, ROBit
4241
from micropython import const
4342

44-
45-
__version__ = "0.0.0-auto.0"
46-
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ADT7410.git"
47-
48-
49-
_ADT7410_TEMPMSB = const(0x0)
50-
_ADT7410_TEMPLSB = const(0x1)
51-
_ADT7410_STATUS = const(0x2)
52-
_ADT7410_CONFIG = const(0x3)
53-
_ADT7410_THIGHMSB = const(0x4)
54-
_ADT7410_THIGHLSB = const(0x5)
55-
_ADT7410_TLOWMSB = const(0x6)
56-
_ADT7410_TLOWLSB = const(0x7)
57-
_ADT7410_TCRITMSB = const(0x8)
58-
_ADT7410_TCRITLSB = const(0x9)
59-
_ADT7410_THYST = const(0x0A)
60-
_ADT7410_ID = const(0xB)
61-
_ADT7410_SWRST = const(0x2F)
43+
try:
44+
# Used only for typing
45+
import busio # pylint: disable=unused-import
46+
except ImportError:
47+
pass
48+
49+
__version__: str = "0.0.0-auto.0"
50+
__repo__: str = "https://github.com/adafruit/Adafruit_CircuitPython_ADT7410.git"
51+
52+
53+
_ADT7410_TEMPMSB: int = const(0x0)
54+
_ADT7410_TEMPLSB: int = const(0x1)
55+
_ADT7410_STATUS: int = const(0x2)
56+
_ADT7410_CONFIG: int = const(0x3)
57+
_ADT7410_THIGHMSB: int = const(0x4)
58+
_ADT7410_THIGHLSB: int = const(0x5)
59+
_ADT7410_TLOWMSB: int = const(0x6)
60+
_ADT7410_TLOWLSB: int = const(0x7)
61+
_ADT7410_TCRITMSB: int = const(0x8)
62+
_ADT7410_TCRITLSB: int = const(0x9)
63+
_ADT7410_THYST: int = const(0x0A)
64+
_ADT7410_ID: int = const(0xB)
65+
_ADT7410_SWRST: int = const(0x2F)
6266

6367

6468
class ADT7410:

0 commit comments

Comments
 (0)