Skip to content

Commit 89eba2b

Browse files
authored
Merge pull request #55 from PsuFan/master
Turn off Interrupt Triggers and Pull Up Resistors on begin()
2 parents c5e361a + ffc8a64 commit 89eba2b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Adafruit_MCP23017.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ void Adafruit_MCP23017::begin(uint8_t addr, TwoWire *theWire) {
128128
// all inputs on port A and B
129129
writeRegister(MCP23017_IODIRA, 0xff);
130130
writeRegister(MCP23017_IODIRB, 0xff);
131+
132+
// Turn off interrupt triggers
133+
writeRegister(MCP23017_GPINTENA, 0x00);
134+
writeRegister(MCP23017_GPINTENB, 0x00);
135+
136+
// Turn off pull up resistors
137+
writeRegister(MCP23017_GPPUA, 0x00);
138+
writeRegister(MCP23017_GPPUB, 0x00);
131139
}
132140

133141
/**

examples/interrupt/interrupt.ino

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ void cleanInterrupts(){
103103
* and you can wait for interrupts while waiting.
104104
*/
105105
void loop(){
106+
// Clear Previous Interrupts
107+
if (digitalRead(arduinoIntPin) == LOW) {
108+
mcp.digitalRead(0);
109+
mcp.digitalRead(7);
110+
}
106111

107112
// enable interrupts before going to sleep/wait
108113
// And we setup a callback for the arduino INT handler.

0 commit comments

Comments
 (0)