Bsongis/rotary encoder delay (#6503)

Rotary encoder fixed on X10 / X12S
This commit is contained in:
Bertrand Songis
2019-06-14 19:19:52 +02:00
committed by GitHub
parent 618bcfe72f
commit 55ec942610
16 changed files with 195 additions and 146 deletions
@@ -49,23 +49,8 @@ void setSelectedUsbMode(int mode)
int usbPlugged()
{
// debounce
static uint8_t debounced_state = 0;
static uint8_t last_state = 0;
if (GPIO_ReadInputDataBit(USB_GPIO, USB_GPIO_PIN_VBUS)) {
if (last_state) {
debounced_state = 1;
}
last_state = 1;
}
else {
if (!last_state) {
debounced_state = 0;
}
last_state = 0;
}
return debounced_state;
static PinDebounce debounce;
return debounce.debounce(USB_GPIO, USB_GPIO_PIN_VBUS);
}
USB_OTG_CORE_HANDLE USB_OTG_dev;