> The idea was every press would be registered correctly not matter how fast someone hit one, two, or three buttons. So simpler debounce algos were out.
...no ? Only if you care about both on and OFF timing you'd need to get creative.
You can just
* trigger on interrupt
* ignore that input for say 50ms (or how long you want your debounce period), whether by disabling interrupt or any other way.
That way you will always catch it, on the first bounce, the fastest possible way. And as you are "NANANA NOT LISTENING" on the pin, doesn't matter whether it bounces or not.
Same with holding, as long as previous registered state was ON and you get OFF, you just send the OFF higher up the stack, start the timer, and ignore any further input for that duration.
I think that's what your code is mostly trying to do
...no ? Only if you care about both on and OFF timing you'd need to get creative.
You can just
* trigger on interrupt
* ignore that input for say 50ms (or how long you want your debounce period), whether by disabling interrupt or any other way.
That way you will always catch it, on the first bounce, the fastest possible way. And as you are "NANANA NOT LISTENING" on the pin, doesn't matter whether it bounces or not.
Same with holding, as long as previous registered state was ON and you get OFF, you just send the OFF higher up the stack, start the timer, and ignore any further input for that duration.
I think that's what your code is mostly trying to do