Added PushButton::setTouchThreshold() and PushButton::setTouchCycles()

Not implemented for ESP32-C3
This commit is contained in:
Gregg 2022-08-15 07:15:19 -05:00
parent 16b71af6f7
commit 754ffc7f34
2 changed files with 13 additions and 12 deletions

View File

@ -223,15 +223,6 @@ void PushButton::reset(){
//////////////////////////////////////
void PushButton::configureTouch(uint16_t measureTime, uint16_t sleepTime, uint16_t thresh){
#if SOC_TOUCH_SENSOR_NUM > 0
touchSetCycles(measureTime,sleepTime);
threshold=thresh;
#endif
}
//////////////////////////////////////
#if SOC_TOUCH_SENSOR_NUM > 0
touch_value_t PushButton::threshold=0;
#endif

View File

@ -162,13 +162,23 @@ class PushButton{
// Returns pin number
static void configureTouch(uint16_t measureTime, uint16_t sleepTime, uint16_t thresh);
#if SOC_TOUCH_SENSOR_NUM > 0
// Sets the measure time, sleep time, and lower threshold that triggers a touch - used only when buttonType=Button::TOUCH
static void setTouchCycles(uint16_t measureTime, uint16_t sleepTime){touchSetCycles(measureTime,sleepTime);}
// Sets the measure time and sleep time touch cycles , and lower threshold that triggers a touch - used only when buttonType=Button::TOUCH
// measureTime: duration of measurement time of all touch sensors in number of clock cycles
// sleepTime: duration of sleep time (between measurements) of all touch sensors number of clock cycles
// touchThreshhold: the read value of touch sensors, below which sensors are considered touched (i.e. "pressed")
static void setTouchThreshold(touch_value_t thresh){threshold=thresh;}
// Sets the threshold that triggers a touch - used only when buttonType=Button::TOUCH
// thresh: the read value of touch sensors, beyond which which sensors are considered touched (i.e. "pressed").
// This is a class-level value applied to all touch sensor buttons.
#endif
};