FabGL
ESP32 Display Controller and Graphics Library

◆ enableInterrupt()

void enableInterrupt ( int  gpio,
MCPIntTrigger  trigger,
bool  defaultValue = false,
uint8_t  hwAddr = 0 
)

Enables interrupt on the specific pin.

Interrupt flags are cleared reading GPIO or calling getPortIntCaptured().

Parameters
gpioInput pin to setup as interrupt source (MCP_A0...MCP_A7 and MCP_B0...MCP_B7)
triggerType of interrupt trigger. MCPIntTrigger::DefaultChange, trigs interrupt if pin is different than defaultValue parameter. MCPIntTrigger::PreviousChange trigs interrupt if pin just changes its value.
defaultValueDefault value when trigger is MCPIntTrigger::DefaultChange. False = low, True = high
hwAddrOptional hardware device address

Example:

// INTA or INTB are high on interrupt
io.setINTActiveHigh(true);

// INTB is high whenever B1 changes its value
io.enableInterrupt(MCP_B1, MCPIntTrigger::PreviousChange);

// INTA is high whenever A2 is high
io.enableInterrupt(MCP_A2, MCPIntTrigger::DefaultChange, false);
Examples:
VGA/HardwareTest/HardwareTest.ino.

Definition at line 280 of file MCP23S17.cpp.