Mosaic
Well-Known Member
hello:
If u guys are interested I did up a low overhead, scalable debouncer based around a 10ms ISR. About 50 asm instructions, using 2 bytes per switch, delivering debounce & standard press/hold/release switch states with a transition switch bit to allow for non repeating selections. No computed gotos, just some indirect addressing for scalable looping.
I call it low overhead cuz it only runs once per 10ms and uses 1 byte for debounce & press-hold delay & 1 switch state byte per switch. Only 1 local temp byte used.
So for 8 switches u only need 16bytes of GPR and under 7 words of code space per switch .The local temp byte is reusable in any other parts of your code as it keeps no data necessary for the next debounce iteration.
It can easily scale to as many switches as u like.
If u guys are interested I did up a low overhead, scalable debouncer based around a 10ms ISR. About 50 asm instructions, using 2 bytes per switch, delivering debounce & standard press/hold/release switch states with a transition switch bit to allow for non repeating selections. No computed gotos, just some indirect addressing for scalable looping.
I call it low overhead cuz it only runs once per 10ms and uses 1 byte for debounce & press-hold delay & 1 switch state byte per switch. Only 1 local temp byte used.
So for 8 switches u only need 16bytes of GPR and under 7 words of code space per switch .The local temp byte is reusable in any other parts of your code as it keeps no data necessary for the next debounce iteration.
It can easily scale to as many switches as u like.