Skip to content

Port B interrupt fixes #66

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 3 commits into from
Jul 18, 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
9 changes: 5 additions & 4 deletions src/Adafruit_MCP23XXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ uint8_t Adafruit_MCP23XXX::getLastInterruptPin() {

// Port A
Adafruit_BusIO_Register INTFA(i2c_dev, spi_dev, MCP23XXX_SPIREG,
getRegister(MCP23XXX_INTF));
getRegister(MCP23XXX_INTF, 0));
INTFA.read(&intf);
for (uint8_t pin = 0; pin < 8; pin++) {
if (intf & (1 << pin)) {
Expand All @@ -222,7 +222,7 @@ uint8_t Adafruit_MCP23XXX::getLastInterruptPin() {
// Port B and still not found?
if ((pinCount > 8) && (intpin == 255)) {
Adafruit_BusIO_Register INTFB(i2c_dev, spi_dev, MCP23XXX_SPIREG,
getRegister(MCP23XXX_INTF), 1);
getRegister(MCP23XXX_INTF, 1));
INTFB.read(&intf);
for (uint8_t pin = 0; pin < 8; pin++) {
if (intf & (1 << pin)) {
Expand All @@ -234,8 +234,9 @@ uint8_t Adafruit_MCP23XXX::getLastInterruptPin() {

// clear if found
if (intpin != 255) {
Adafruit_BusIO_Register INTCAP(i2c_dev, spi_dev, MCP23XXX_SPIREG,
getRegister(MCP23XXX_INTCAP));
Adafruit_BusIO_Register INTCAP(
i2c_dev, spi_dev, MCP23XXX_SPIREG,
getRegister(MCP23XXX_INTCAP, MCP_PORT(intpin)));
INTCAP.read();
}

Expand Down