vail-adapter/touchbounce.cpp

12 lines
277 B
C++
Raw Normal View History

2022-05-21 20:14:03 -06:00
#include "touchbounce.h"
void TouchBounce::attach(int pin) {
2022-06-26 10:55:28 -06:00
this->qt = Adafruit_FreeTouch(pin, OVERSAMPLE_2, RESISTOR_0, FREQ_MODE_SPREAD);
2022-05-21 20:14:03 -06:00
this->qt.begin();
}
bool TouchBounce::readCurrentState() {
int val = this->qt.measure();
2022-06-26 10:55:28 -06:00
return val > QT_THRESHOLD;
2022-05-21 20:14:03 -06:00
}