29
29
from adafruit_bus_device import i2c_device
30
30
from adafruit_register .i2c_struct import ROUnaryStruct , UnaryStruct
31
31
from adafruit_register .i2c_bit import RWBit
32
+ from adafruit_register .i2c_bits import RWBits
32
33
from micropython import const
33
34
34
35
__version__ = "0.0.0-auto.0"
46
47
47
48
# pylint: disable=invalid-name
48
49
50
+ # constant_current_range options
51
+ AW9523_4_4_RANGE = const (0 ) # Full range: 0 - 37 mA (typical)
52
+ AW9523_3_4_RANGE = const (1 ) # 3/4 range: 0 - 27.8 mA
53
+ AW9523_2_4_RANGE = const (2 ) # 2/4 range: 0 - 18.5 mA
54
+ AW9523_1_4_RANGE = const (3 ) # 1/4 range: 0 - 9.3 mA
55
+
49
56
50
57
class AW9523 :
51
58
"""CircuitPython helper class for using the AW9523 GPIO expander"""
@@ -67,6 +74,9 @@ class AW9523:
67
74
# Whether port 0 is push-pull
68
75
port0_push_pull = RWBit (_AW9523_REG_GCR , 4 )
69
76
77
+ # 256-step constant-current range selector 'ISEL' - choice of 'full' (4/4), 3/4, 2/4, or 1/4.
78
+ constant_current_range = RWBits (2 , _AW9523_REG_GCR , 0 )
79
+
70
80
def __init__ (self , i2c_bus , address = _AW9523_DEFAULT_ADDR , reset = True ):
71
81
self .i2c_device = i2c_device .I2CDevice (i2c_bus , address )
72
82
self ._buffer = bytearray (2 )
0 commit comments