if (enable) {
hw_debounce_set(1, -1);
hw_debounce = 1;
- hw_debounce_set(-1, 0);
- hw_debounce_time = 0;
}
else {
hw_debounce_set(-1, 0);
if ((time < 0) || (time > 0xff))
return count;
+ if (!hw_debounce)
+ return count;
+
hw_debounce_set(-1, time);
hw_debounce_time = time;