This simple example shows how to setup a debounce filter on a button using the the Timeout service XMEGA.
The timeout service can be found here.
All XMEGA devices with RTC or RTC32 can be used
This example will demonstrate the effect of a debounce filter on a push button. Button0 includes the debounce filter and toggles LED0 when toggled. Button1 will toggle LED1, but without the debounce filter causing a jittering and unpredictable behaviour.
This software was written for the GNU GCC for AVR. Other compilers may or may not work.
For further information, visit Microchip.
Support and FAQ: https://www.microchip.com/support/