File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -153,15 +153,17 @@ def invert_polarity(self) -> bool:
153
153
return True
154
154
return False
155
155
except AttributeError :
156
- print ("IO expander doesn't support inverting polarity! Continuing..." )
157
156
return False
158
157
159
158
@invert_polarity .setter
160
159
def invert_polarity (self , val : bool ) -> None :
161
- try :
162
- if val :
160
+ if val :
161
+ try :
163
162
self ._mcp .ipol = _enable_bit (self ._mcp .ipol , self ._pin )
164
- else :
163
+ except AttributeError as error :
164
+ raise ValueError ("Inverted polarity is not supported." ) from error
165
+ else :
166
+ try :
165
167
self ._mcp .ipol = _clear_bit (self ._mcp .ipol , self ._pin )
166
- except AttributeError :
167
- print ( "IO expander doesn't support inverting polarity! Continuing..." )
168
+ except AttributeError :
169
+ return
You can’t perform that action at this time.
0 commit comments