ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
mpr121.h File Reference

NXP MPR121 12-channel capacitive-touch controller codec (PROTOCORE_ENABLE_MPR121). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

NXP MPR121 12-channel capacitive-touch controller codec (PROTOCORE_ENABLE_MPR121).

The MPR121 reports a 16-bit touch-status word (registers 0x00/0x01): bits 0-11 are the twelve electrodes, bit 12 is the proximity electrode, and bit 15 is the over-current flag. It also exposes 10-bit filtered capacitance and 8-bit baseline per electrode. Bringing it up is a fixed sequence of register writes (soft reset, the NXP filter/AFE defaults, per-electrode touch/release thresholds, and the electrode-configuration register that starts it running).

This codec is pure and host-tested: ::protocore_mpr121_touched / ::protocore_mpr121_word10 decode the reported words, and ::protocore_mpr121_build_init emits the whole bring-up sequence as (register, value) byte pairs (so the exact bytes are verifiable off-target). On an ESP32 the binding replays that sequence over I2C (Wire) and reads the status; only that touches hardware.

A cheap solder-and-bench-test breakout for touch buttons / sliders: wire it up, touch a pad, watch the bit set.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file mpr121.h.