Device support for MPR121 12x Capacitive Touch Sensor. More...
Device support for MPR121 12x Capacitive Touch Sensor.
#include <mpr121.h>
Classes | |
struct | Config |
Public Types | |
enum | Result { OK = 0 , ERR } |
enum | RegMap { MPR121_TOUCHSTATUS_L = 0x00 , MPR121_TOUCHSTATUS_H = 0x01 , MPR121_FILTDATA_0L = 0x04 , MPR121_FILTDATA_0H = 0x05 , MPR121_BASELINE_0 = 0x1E , MPR121_MHDR = 0x2B , MPR121_NHDR = 0x2C , MPR121_NCLR = 0x2D , MPR121_FDLR = 0x2E , MPR121_MHDF = 0x2F , MPR121_NHDF = 0x30 , MPR121_NCLF = 0x31 , MPR121_FDLF = 0x32 , MPR121_NHDT = 0x33 , MPR121_NCLT = 0x34 , MPR121_FDLT = 0x35 , MPR121_TOUCHTH_0 = 0x41 , MPR121_RELEASETH_0 = 0x42 , MPR121_DEBOUNCE = 0x5B , MPR121_CONFIG1 = 0x5C , MPR121_CONFIG2 = 0x5D , MPR121_CHARGECURR_0 = 0x5F , MPR121_CHARGETIME_1 = 0x6C , MPR121_ECR = 0x5E , MPR121_AUTOCONFIG0 = 0x7B , MPR121_AUTOCONFIG1 = 0x7C , MPR121_UPLIMIT = 0x7D , MPR121_LOWLIMIT = 0x7E , MPR121_TARGETLIMIT = 0x7F , MPR121_GPIODIR = 0x76 , MPR121_GPIOEN = 0x77 , MPR121_GPIOSET = 0x78 , MPR121_GPIOCLR = 0x79 , MPR121_GPIOTOGGLE = 0x7A , MPR121_SOFTRESET = 0x80 } |
Public Member Functions | |
Mpr121 () | |
~Mpr121 () | |
Result | Init (Config config) |
void | SetThresholds (uint8_t touch, uint8_t release) |
uint16_t | FilteredData (uint8_t t) |
uint16_t | BaselineData (uint8_t t) |
uint16_t | Touched () |
uint8_t | ReadRegister8 (uint8_t reg) |
uint16_t | ReadRegister16 (uint8_t reg) |
void | WriteRegister (uint8_t reg, uint8_t value) |
Device register map
|
inline |
|
inline |
Read the baseline value for the channel. The 3rd level filtered result is internally 10bit but only high 8 bits are readable from registers 0x1E~0x2A as the baseline value output for each channel.
t | the channel to read. |
Read the filtered data from channel t. The ADC raw data outputs run through 3 levels of digital filtering to filter out the high frequency and low frequency noise encountered. For detailed information on this filtering see page 6 of the device datasheet.
t | the channel to read |
Initialize the MPR121 device
config | Configuration settings |
|
inline |
Read the contents of a 16 bit device register.
reg | the register address to read from |
|
inline |
Read the contents of an 8 bit device register.
reg | the register address to read from |
|
inline |
Set the touch and release thresholds for all 13 channels on the device to the passed values.
touch | The touch threshold value from 0 to 255. |
release | The release threshold from 0 to 255. |
|
inline |
Read the touch status of all 13 channels as bit values in a 12 bit integer.
|
inline |
Writes 8-bits to the specified destination register
reg | the register address to write to |
value | the value to write |