Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ MPR121.prototype.config = function() {
* reset sensor
*/

MPR121.prototype.reset = function(touch, release){
MPR121.prototype.reset = function(touch = 12, release = 6){
// Soft reset of device.
this._write8Bits(MPR121_SOFTRESET, 0x63);

Expand All @@ -134,7 +134,7 @@ MPR121.prototype.reset = function(touch, release){
}

// Set threshold for touch and release to default values.
this.set_thresholds(12, 6);
this.set_thresholds(touch, release);
// Configure baseline filtering control registers.
this._write8Bits(MPR121_MHDR, 0x01);
this._write8Bits(MPR121_NHDR, 0x01);
Expand Down Expand Up @@ -181,7 +181,7 @@ MPR121.prototype.reset = function(touch, release){
*/

MPR121.prototype.filtered_data = function(pin) {
if (pin < 0 || pin >= 12) { return false; }
if (pin < 0 || pin >= 12) { return false; }
return this._read16Bits(MPR121_FILTDATA_0L + pin*2);
}

Expand All @@ -192,7 +192,7 @@ MPR121.prototype.reset = function(touch, release){
*/

MPR121.prototype.baseline_data = function(pin) {
if (pin < 0 || pin >= 12) { return false; }
if (pin < 0 || pin >= 12) { return false; }
var bl = this._read8Bits(MPR121_BASELINE_0 + pin);
return bl << 2;
}
Expand All @@ -215,7 +215,7 @@ MPR121.prototype.reset = function(touch, release){
*/

MPR121.prototype.is_touched = function(pin) {
if (pin < 0 || pin >= 12) { return false; }
if (pin < 0 || pin >= 12) { return false; }
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapping some invisible characters with an actual space character.

var t = this.touched();
return (t & (1 << pin)) > 0;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpr121",
"version": "0.0.5",
"version": "0.0.6",
"description": "Access the MPR121 chipset via node-i2c",
"main": "index.js",
"scripts": {
Expand Down