• Hi! It doesn't support it, but it should be easy enough to add. If you stick this code after you instantiate it, it should add the functionality:

    mpr.readWord = function(reg) {
          i2c.writeTo({address:0x5A, stop:false}, reg);
          var data = i2c.readFrom(0x5A, 2);
          return (data[1] << 8) || data[0];
        };
    mpr.readByte = function(reg) {
          i2c.writeTo({address:0x5A, stop:false}, reg);
          return i2c.readFrom(0x5A, 1)[0];
        };
    mpr.filteredData = function(pin) {
        if (pin<0 || pin>=12) throw new Error("Invalid pin");
        return this.readWord(0x04 + pin*2);
     };
    mpr.baselineData = function(pin) {
        if (pin<0 || pin>=12) throw new Error("Invalid pin");
        return this.readByte(0x1E + pin)<<2;
     };
    

    If you can let me know if it works for you then I'll add it into the main module - but I can't test it here as I don't have the hardware :)

About

Avatar for Gordon @Gordon started