Skip to content

feat(expander): default MCP INT output to active-HIGH in begin()#303

Merged
JosipKuci merged 2 commits into
SolderedElectronics:masterfrom
lanrat:fix/iocon-intpol-on-begin
May 19, 2026
Merged

feat(expander): default MCP INT output to active-HIGH in begin()#303
JosipKuci merged 2 commits into
SolderedElectronics:masterfrom
lanrat:fix/iocon-intpol-on-begin

Conversation

@lanrat
Copy link
Copy Markdown
Contributor

@lanrat lanrat commented May 19, 2026

On Inkplate 6 / 10 / 6PLUS the internal MCP23017's INT pin is wired to
an ESP32 GPIO that's used with ESP_EXT1_WAKEUP_ANY_HIGH for deep-sleep
wake. The MCP power-on default for IOCON is 0x00 (INTPOL=0,
active-LOW) — meaning the INT pin idles HIGH whenever no interrupt is
pending. Result: ext1 wakeup fires immediately on every sleep call,
producing a continuous wake/sleep loop.

v11.0.1 restored the setIntOutput() API (good) but doesn't call it
from begin(), so the library still doesn't work for deep-sleep wake
out of the box — every application has to know to call
setIntOutput() itself.

Fix

Call setIntOutput(PORTB, no-mirror, push-pull, active-HIGH) from
IOExpander::begin(). Applications with non-default needs can still
override after display.begin().

Verification

Inkplate 10 V1, arduino-esp32 3.3.7. Without the patch: device wakes
immediately every sleep cycle. With the patch: device sleeps for the
configured duration; ext1 only fires on real touchpad presses.

Compat / scope

Backward compatible — only changes a default; existing setIntOutput()
callers still win since they run after begin(). File is gated to
ARDUINO_INKPLATE6 || ARDUINO_INKPLATE10 || ARDUINO_INKPLATE6PLUS, so
no PCAL boards are affected.

lanrat and others added 2 commits May 18, 2026 17:14
… polarity

The MCP23017 power-on default for IOCON is 0x00 — which means INTPOL=0
(active-LOW): the INT pin drives HIGH when no interrupt is pending and only
drives LOW when one fires. On Inkplate hardware (and any design that wires
INT into a host MCU configured to wake on HIGH, e.g. ESP32
ESP_EXT1_WAKEUP_ANY_HIGH), this is exactly inverted from what is wanted,
causing the host to see a permanently asserted wake line every time it
sleeps.

v11.0.1 restored the setIntOutput() API that v11.0.0 removed, but did not
configure IOCON from begin(). This means each application that uses MCP-
driven wake must remember to call setIntOutput() with the right parameters
after display.begin(). For applications that don't, deep-sleep + MCP-driven
wake is non-functional out of the box: the host wakes immediately on every
sleep cycle regardless of pin activity.

Call setIntOutput() from begin() with sensible Inkplate-correct defaults
(active-HIGH, push-pull, ports not mirrored) so the library works correctly
on standard Inkplate wiring without requiring application code to know
about IOCON. Users with non-default wiring can still override by calling
setIntOutput() after begin().
@JosipKuci JosipKuci merged commit 0c0ad0f into SolderedElectronics:master May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants