26#ifndef DETERMINISTICESPASYNCWEBSERVER_MPR121_H
27#define DETERMINISTICESPASYNCWEBSERVER_MPR121_H
33#define MPR121_ELECTRODES 12
36#define MPR121_INIT_MAX 82
66size_t mpr121_build_init(uint8_t *buf,
size_t cap, uint8_t n_electrodes, uint8_t touch_thr, uint8_t release_thr);
bool mpr121_overcurrent(uint8_t status_hi)
True if the over-current flag (status bit 15) is set (wiring fault / short).
uint16_t mpr121_read_filtered(uint8_t e)
Read electrode e's 10-bit filtered capacitance value.
uint16_t mpr121_read_touched()
Read the current 12-electrode touch bitmask (0 if the device is absent).
size_t mpr121_build_init(uint8_t *buf, size_t cap, uint8_t n_electrodes, uint8_t touch_thr, uint8_t release_thr)
Build the MPR121 bring-up sequence as consecutive (register, value) byte pairs.
bool mpr121_begin(uint8_t addr)
Reset + configure the MPR121 at addr over I2C.
bool mpr121_proximity(uint8_t status_hi)
True if the proximity electrode (status bit 12) is active.
bool mpr121_is_touched(uint16_t mask, uint8_t e)
True if electrode e (0..11) is touched in a mask from mpr121_touched.
uint16_t mpr121_word10(uint8_t lsb, uint8_t msb)
Combine a little-endian LSB/MSB register pair into a 10-bit value (filtered/baseline).
uint16_t mpr121_touched(uint8_t status_lo, uint8_t status_hi)
Decode the 12-electrode touch bitmask from the two status registers (0x00 low, 0x01 high)....