Skip to content

Commit

Permalink
Update MCP23S17.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
olkal committed Jun 11, 2024
1 parent b36c997 commit 3c7660d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MCP23S17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ bool MCP23S17::begin(bool pullup)
// 1 = Sequential operation disabled, address pointer does not increment.
// 0 = Sequential operation enabled, address pointer increments.
// if (! writeReg(MCP23017_IOCR, MCP23017_IOCR_SEQOP)) return false;
uint8_t reg = readReg(MCP23017_IOCR);
if (reg & MCP23017_IOCR_SEQOP) // check if already zero
{
reg &= ~MCP23017_IOCR_SEQOP; // clear SEQOP bit for sequential read/write
if (! writeReg(MCP23017_IOCR, reg)) return false;
}

if (pullup)
{
Expand Down

0 comments on commit 3c7660d

Please sign in to comment.