Skip to content

Commit 6317393

Browse files
committed
Add INTCAP register access
1 parent a691635 commit 6317393

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

adafruit_mcp230xx/mcp23017.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,31 @@ def int_flagb(self):
288288
flags = [pin + 8 for pin in range(8) if intfb & (1 << pin)]
289289
return flags
290290

291+
@property
292+
def int_cap(self):
293+
"""Returns a list with the pin values at time of interrupt
294+
port A ----> pins 0-7
295+
port B ----> pins 8-15
296+
"""
297+
intcap = self._read_u16le(_MCP23017_INTCAPA)
298+
return [(intcap >> pin) & 1 for pin in range(16)]
299+
300+
@property
301+
def int_capa(self):
302+
"""Returns a list of pin values at time of interrupt
303+
pins: 0-7
304+
"""
305+
intcapa = self._read_u8(_MCP23017_INTCAPA)
306+
return [(intcapa >> pin) & 1 for pin in range(8)]
307+
308+
@property
309+
def int_capb(self):
310+
"""Returns a list of pin values at time of interrupt
311+
pins: 8-15
312+
"""
313+
intcapb = self._read_u8(_MCP23017_INTCAPB)
314+
return [(intcapb >> pin) & 1 for pin in range(8)]
315+
291316
def clear_ints(self):
292317
"""Clears interrupts by reading INTCAP."""
293318
self._read_u16le(_MCP23017_INTCAPA)

0 commit comments

Comments
 (0)