|
@ -4,7 +4,7 @@ |
|
|
Keyboard::Keyboard() { |
|
|
Keyboard::Keyboard() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Keyboard::init() { |
|
|
void Keyboard::init() { |
|
|
this->thresholds = {40, 0, 0, 40, 40, 40, 40, 40, 20, 20}; |
|
|
this->thresholds = {40, 0, 0, 40, 40, 40, 40, 40, 20, 20}; |
|
|
this->touchDetected = {false, false, false, false, false, false, false, false, false, false}; |
|
|
this->touchDetected = {false, false, false, false, false, false, false, false, false, false}; |
|
|
touchAttachInterrupt(T0, gotTouch0, threshold[0]); |
|
|
touchAttachInterrupt(T0, gotTouch0, threshold[0]); |
|
@ -19,52 +19,52 @@ Keyboard::init() { |
|
|
touchAttachInterrupt(T9, gotTouch9, threshold[9]); |
|
|
touchAttachInterrupt(T9, gotTouch9, threshold[9]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Keyboard::gotTouch0() { |
|
|
void Keyboard::gotTouch0() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T0) < threshold[0]) |
|
|
if (touchRead(T0) < threshold[0]) |
|
|
this->touchDetected[0] = true; |
|
|
this->touchDetected[0] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch1() { |
|
|
void Keyboard::gotTouch1() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T1) < threshold[1]) |
|
|
if (touchRead(T1) < threshold[1]) |
|
|
this->touchDetected[1] = true; |
|
|
this->touchDetected[1] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch2() { |
|
|
void Keyboard::gotTouch2() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T2) < threshold[2]) |
|
|
if (touchRead(T2) < threshold[2]) |
|
|
this->touchDetected[2] = true; |
|
|
this->touchDetected[2] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch3() { |
|
|
void Keyboard::gotTouch3() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T3) < threshold[3]) |
|
|
if (touchRead(T3) < threshold[3]) |
|
|
this->touchDetected[3] = true; |
|
|
this->touchDetected[3] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch4() { |
|
|
void Keyboard::gotTouch4() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T4) < threshold[4]) |
|
|
if (touchRead(T4) < threshold[4]) |
|
|
this->touchDetected[4] = true; |
|
|
this->touchDetected[4] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch5() { |
|
|
void Keyboard::gotTouch5() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T5) < threshold[5]) |
|
|
if (touchRead(T5) < threshold[5]) |
|
|
this->touchDetected[5] = true; |
|
|
this->touchDetected[5] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch6() { |
|
|
void Keyboard::gotTouch6() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T6) < threshold[6]) |
|
|
if (touchRead(T6) < threshold[6]) |
|
|
this->touchDetected[6] = true; |
|
|
this->touchDetected[6] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch7() { |
|
|
void Keyboard::gotTouch7() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T7) < threshold[7]) |
|
|
if (touchRead(T7) < threshold[7]) |
|
|
this->touchDetected[7] = true; |
|
|
this->touchDetected[7] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch8() { |
|
|
void Keyboard::gotTouch8() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T8) < threshold[8]) |
|
|
if (touchRead(T8) < threshold[8]) |
|
|
this->touchDetected[8] = true; |
|
|
this->touchDetected[8] = true; |
|
|
} |
|
|
} |
|
|
Keyboard::gotTouch9() { |
|
|
void Keyboard::gotTouch9() { |
|
|
delay(10); |
|
|
delay(10); |
|
|
if (touchRead(T9) < threshold[9]) |
|
|
if (touchRead(T9) < threshold[9]) |
|
|
this->touchDetected[9] = true; |
|
|
this->touchDetected[9] = true; |
|
|