On 30/09/2023 7:24 am, M. Simon wrote:
The SR Latch is well known for doing this for an SPDT. I make it work for the much more common and single input wire SPST.
Eliminate SPST Debounce Delay with an SR Latch https://spacetimepro.blogspot.com/2023/09/switch-debouncer.html
Didn't look into the logic but the redundant jumps were easy enough
to eliminate.
: SWITCH-STATE? ( what is the current state of the switch ? "1" if open or opening "0" if closed or closing )
Switch-State @ ( - SW-State )
Switch-Debouncing? ( - SW-State t/f )
IF EXIT THEN
Switch-Port @ Switch-Mask AND DUP Switch-In ! ( - SW-State SW-Port ) 10uSec-Wait
Switch-Port @ Switch-Mask AND ( - SW-State SW-Port SW-Port )
10uSec-Wait
Switch-Port @ Switch-Mask AND ( - SW-State SW-Port SW-Port SW-Port )
Three=? ( - SW-State t/f )
IF
Switch-In @
=
IF
Switch-State @ EXIT
THEN
Switch-In @ DUP Switch-State !
Start-Debouncing
THEN
;
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)