Skip to content

Add INTCAP register access #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions adafruit_mcp230xx/mcp23017.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,31 @@ def int_flagb(self):
flags = [pin + 8 for pin in range(8) if intfb & (1 << pin)]
return flags

@property
def int_cap(self):
"""Returns a list with the pin values at time of interrupt
port A ----> pins 0-7
port B ----> pins 8-15
"""
intcap = self._read_u16le(_MCP23017_INTCAPA)
return [(intcap >> pin) & 1 for pin in range(16)]

@property
def int_capa(self):
"""Returns a list of pin values at time of interrupt
pins: 0-7
"""
intcapa = self._read_u8(_MCP23017_INTCAPA)
return [(intcapa >> pin) & 1 for pin in range(8)]

@property
def int_capb(self):
"""Returns a list of pin values at time of interrupt
pins: 8-15
"""
intcapb = self._read_u8(_MCP23017_INTCAPB)
return [(intcapb >> pin) & 1 for pin in range(8)]

def clear_ints(self):
"""Clears interrupts by reading INTCAP."""
self._read_u16le(_MCP23017_INTCAPA)
Expand Down