File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 46
46
47
47
import struct
48
48
import adafruit_bus_device .i2c_device as i2cdevice
49
+ from micropython import const
49
50
50
51
__version__ = "0.0.0-auto.0"
51
52
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_TLV493D.git"
52
53
54
+ _TLV493D_DEFAULT_ADDRESS = const (0x5E )
55
+
53
56
54
57
class TLV493D :
55
58
"""Driver for the TLV493D 3-axis Magnetometer.
56
59
57
60
:param busio.I2C i2c_bus: The I2C bus the TLV493D is connected to.
61
+ :param int address: The I2C address of the TLV493D. Defaults to 0x5E.
58
62
59
63
"""
60
64
@@ -89,8 +93,8 @@ class TLV493D:
89
93
"RES3" : (3 , 0x1F , 0 ),
90
94
}
91
95
92
- def __init__ (self , i2c_bus ):
93
- self .i2c_device = i2cdevice .I2CDevice (i2c_bus , 0x5E )
96
+ def __init__ (self , i2c_bus , address = _TLV493D_DEFAULT_ADDRESS ):
97
+ self .i2c_device = i2cdevice .I2CDevice (i2c_bus , address )
94
98
self .read_buffer = bytearray (10 )
95
99
self .write_buffer = bytearray (4 )
96
100
You can’t perform that action at this time.
0 commit comments