@@ -127,25 +127,22 @@ class Seesaw:
127
127
128
128
:param ~busio.I2C i2c_bus: Bus the SeeSaw is connected to
129
129
:param int addr: I2C address of the SeeSaw device
130
- :param ~digitalio.DigitalInOut drdy: Pin connected to SeeSaw's 'ready' output"""
130
+ :param ~digitalio.DigitalInOut drdy: Pin connected to SeeSaw's 'ready' output
131
+ :param bool reset: Whether to do a software reset on init"""
131
132
132
133
INPUT = const (0x00 )
133
134
OUTPUT = const (0x01 )
134
135
INPUT_PULLUP = const (0x02 )
135
136
INPUT_PULLDOWN = const (0x03 )
136
137
137
- def __init__ (self , i2c_bus , addr = 0x49 , drdy = None ):
138
+ def __init__ (self , i2c_bus , addr = 0x49 , drdy = None , reset = True ):
138
139
self ._drdy = drdy
139
140
if drdy is not None :
140
141
drdy .switch_to_input ()
141
142
142
143
self .i2c_device = I2CDevice (i2c_bus , addr )
143
- self .sw_reset ()
144
-
145
- def sw_reset (self ):
146
- """Trigger a software reset of the SeeSaw chip"""
147
- self .write8 (_STATUS_BASE , _STATUS_SWRST , 0xFF )
148
- time .sleep (0.500 )
144
+ if reset :
145
+ self .sw_reset ()
149
146
150
147
self .chip_id = self .read8 (_STATUS_BASE , _STATUS_HW_ID )
151
148
@@ -175,6 +172,12 @@ def sw_reset(self):
175
172
self .pin_mapping = ATtiny8x7_Pinmap
176
173
# pylint: enable=import-outside-toplevel
177
174
175
+ def sw_reset (self ):
176
+ """Trigger a software reset of the SeeSaw chip"""
177
+ self .write8 (_STATUS_BASE , _STATUS_SWRST , 0xFF )
178
+ time .sleep (0.500 )
179
+
180
+
178
181
def get_options (self ):
179
182
"""Retrieve the 'options' word from the SeeSaw board"""
180
183
buf = bytearray (4 )
0 commit comments