annotate examples/06-Sensors/mpr121/I2C_MPR121.h @ 498:c932df224fd3 prerelease

FIXED the heavy pitchbend range
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 20:07:10 +0100
parents 8fcfbfb32aa0
children
rev   line source
robert@464 1 /*
robert@464 2 * MPR121 Bela demo
robert@464 3 *
robert@464 4 * Andrew McPherson
robert@464 5 * Based on Adafruit library by Limor Fried/Ladyada
robert@464 6 */
robert@464 7
robert@464 8 #ifndef I2CTK_H_
robert@464 9 #define I2CTK_H_
robert@464 10
robert@464 11 #include <I2c.h>
robert@464 12 #include "Utilities.h"
robert@464 13
robert@464 14 typedef bool boolean;
robert@464 15
robert@464 16 #define MPR121_I2CADDR_DEFAULT 0x5A
robert@464 17
robert@464 18 #define MPR121_TOUCHSTATUS_L 0x00
robert@464 19 #define MPR121_TOUCHSTATUS_H 0x01
robert@464 20 #define MPR121_FILTDATA_0L 0x04
robert@464 21 #define MPR121_FILTDATA_0H 0x05
robert@464 22 #define MPR121_BASELINE_0 0x1E
robert@464 23 #define MPR121_MHDR 0x2B
robert@464 24 #define MPR121_NHDR 0x2C
robert@464 25 #define MPR121_NCLR 0x2D
robert@464 26 #define MPR121_FDLR 0x2E
robert@464 27 #define MPR121_MHDF 0x2F
robert@464 28 #define MPR121_NHDF 0x30
robert@464 29 #define MPR121_NCLF 0x31
robert@464 30 #define MPR121_FDLF 0x32
robert@464 31 #define MPR121_NHDT 0x33
robert@464 32 #define MPR121_NCLT 0x34
robert@464 33 #define MPR121_FDLT 0x35
robert@464 34
robert@464 35 #define MPR121_TOUCHTH_0 0x41
robert@464 36 #define MPR121_RELEASETH_0 0x42
robert@464 37 #define MPR121_DEBOUNCE 0x5B
robert@464 38 #define MPR121_CONFIG1 0x5C
robert@464 39 #define MPR121_CONFIG2 0x5D
robert@464 40 #define MPR121_CHARGECURR_0 0x5F
robert@464 41 #define MPR121_CHARGETIME_1 0x6C
robert@464 42 #define MPR121_ECR 0x5E
robert@464 43 #define MPR121_AUTOCONFIG0 0x7B
robert@464 44 #define MPR121_AUTOCONFIG1 0x7C
robert@464 45 #define MPR121_UPLIMIT 0x7D
robert@464 46 #define MPR121_LOWLIMIT 0x7E
robert@464 47 #define MPR121_TARGETLIMIT 0x7F
robert@464 48
robert@464 49 #define MPR121_GPIODIR 0x76
robert@464 50 #define MPR121_GPIOEN 0x77
robert@464 51 #define MPR121_GPIOSET 0x78
robert@464 52 #define MPR121_GPIOCLR 0x79
robert@464 53 #define MPR121_GPIOTOGGLE 0x7A
robert@464 54
robert@464 55 #define MPR121_SOFTRESET 0x80
robert@464 56
robert@464 57 class I2C_MPR121 : public I2c
robert@464 58 {
robert@464 59 public:
robert@464 60 // Hardware I2C
robert@464 61 I2C_MPR121();
robert@464 62
robert@464 63 boolean begin(uint8_t bus = 1, uint8_t i2caddr = MPR121_I2CADDR_DEFAULT);
robert@464 64
robert@464 65 uint16_t filteredData(uint8_t t);
robert@464 66 uint16_t baselineData(uint8_t t);
robert@464 67
robert@464 68 uint8_t readRegister8(uint8_t reg);
robert@464 69 uint16_t readRegister16(uint8_t reg);
robert@464 70 void writeRegister(uint8_t reg, uint8_t value);
robert@464 71 uint16_t touched(void);
robert@464 72
robert@464 73 void setThresholds(uint8_t touch, uint8_t release);
robert@464 74
robert@464 75 int readI2C() { return 0; } // Unused
robert@464 76
robert@464 77 private:
robert@464 78 int _i2c_address;
robert@464 79 };
robert@464 80
robert@464 81
robert@464 82 #endif /* I2CTK_H_ */