From 1342ce812b22776446d32df0cc5fb90cd10add1f Mon Sep 17 00:00:00 2001 From: Stephen White Date: Thu, 14 Jun 2018 20:39:34 +1000 Subject: [PATCH] Fixed the emulation button debouncing issue. --- src/iec_bus.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/iec_bus.cpp b/src/iec_bus.cpp index 75ab9c3..1d70734 100644 --- a/src/iec_bus.cpp +++ b/src/iec_bus.cpp @@ -116,9 +116,15 @@ void IEC_Bus::ReadEmulationMode(void) IOPort* portB = 0; unsigned gplev0 = read32(ARM_GPIO_GPLEV0); - UpdateButton(emulationModeCheckButtonIndex, gplev0); - emulationModeCheckButtonIndex++; - emulationModeCheckButtonIndex %= buttonCount; + int buttonIndex; + for (buttonIndex = 0; buttonIndex < 3; ++buttonIndex) + { + UpdateButton(buttonIndex, gplev0); + } + // Doing it this way screws with the debounce counters. + //UpdateButton(emulationModeCheckButtonIndex, gplev0); + //emulationModeCheckButtonIndex++; + //emulationModeCheckButtonIndex %= buttonCount; portB = VIA->GetPortB();