Skip to content

MCP23017 GPIO & Interrupt API

Latest

Choose a tag to compare

@dsmurph dsmurph released this 16 Jan 06:21
c9bb543

This repository provides a lightweight, Arduino-style API for the MCP23017.
Focus: clean GPIO abstraction and full interrupt control without overhead.


GPIO

  • pinMode(pin, OUTPUT | INPUT | INPUT_PULLUP) – Configure pin direction

  • pinWrite(pin, HIGH | LOW) – Set output state

  • pinRead(pin) – Read digital input

Interrupts

  • enableInt(pin, true | false) – Enable/disable interrupt per pin

  • intOutputMode(HIGH | LOW, ODR, MIRROR) – Level, open-drain, separate A/B

  • intTriggerMode(RISING | FALLING | BOTH) – Interrupt trigger mode

  • getInterruptFlags(clear) – Interrupt events as bitmask

  • getInterruptPins(clear) – Interrupt events as pin numbers

  • getIntCapture(clear) – Pin state captured at interrupt edge

  • clearIntCapture(pin) – Reset capture bit

  • clearInterrupts() – Reset interrupt configuration and status


Goal
No hidden logic
Direct register control
Suitable for embedded and Linux environments