Skip to content

Commit

Permalink
toKey => toTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed May 5, 2015
1 parent 542b8de commit 6e92c63
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/keypad.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var Controllers = {
state.touches = touches(length);

this.io.i2cRead(address, 0, 2, function(bytes) {
var key = this.toKey(bytes);
var target = this.toTarget(bytes);
var mapped = null;
var alias = null;

Expand All @@ -98,7 +98,7 @@ var Controllers = {
mapped = alias;
}

if (key & (1 << i)) {
if (target & (1 << i)) {
if (state.touches[i] === 0) {

state.timeout = Date.now() + opts.holdTime;
Expand All @@ -125,7 +125,7 @@ var Controllers = {
}.bind(this));
}
},
toKey: {
toTarget: {
value: function(raw) {
if (raw.length !== 2) {
return null;
Expand Down Expand Up @@ -157,7 +157,7 @@ var Controllers = {

this.io.pinMode(this.pin, this.io.MODES.ANALOG);
this.io.analogRead(this.pin, function(adc) {
var key = this.toKey(adc);
var target = this.toTarget(adc);
var mapped = null;
var alias = null;

Expand All @@ -169,7 +169,7 @@ var Controllers = {
mapped = alias;
}

if (key === i) {
if (target === i) {
if (state.touches[i] === 0) {

state.timeout = Date.now() + opts.holdTime;
Expand All @@ -195,7 +195,7 @@ var Controllers = {
}.bind(this));
},
},
toKey: {
toTarget: {
value: function(raw) {
var state = priv.get(this);
var scale = state.scale;
Expand Down Expand Up @@ -257,7 +257,7 @@ var Controllers = {

this.io.pinMode(this.pin, this.io.MODES.ANALOG);
this.io.analogRead(this.pin, function(adc) {
var key = this.toKey(adc);
var target = this.toTarget(adc);
var mapped = null;
var alias = null;

Expand All @@ -269,7 +269,7 @@ var Controllers = {
mapped = alias;
}

if (key === i) {
if (target === i) {
if (state.touches[i] === 0) {
state.timeout = Date.now() + opts.holdTime;
trigger.call(this, "down", mapped);
Expand All @@ -294,7 +294,7 @@ var Controllers = {
}.bind(this));
}
},
toKey: {
toTarget: {
value: function(raw) {
var state = priv.get(this);
var ranges = state.ranges;
Expand Down

0 comments on commit 6e92c63

Please sign in to comment.