/* PB26 is digital Pin 22, view Datasheet page 647 */pinMode(22, INPUT);digitalWrite(22, HIGH); // PullupattachInterrupt(22, myInterruptServiceRoutine, FALLING);REG_PIOB_IFER |= 1<<26; // Input Filter Enable RegisterPIOB->PIO_DIFSR |= 1<<26; // Debouncing Input Filter Select RegisterPIOB->PIO_SCDR |= 0xff; // Slow Clock Divider Register
When the glitch or debouncing filter is enabled, a glitch or pulse with a duration of less than 1/2Selected Clock Cycle (Selected Clock represents MCK or Divided Slow Clock depending onPIO_SCIFSR and PIO_DIFSR programming) is automatically rejected, while a pulse with aduration of 1 Selected Clock (MCK or Divided Slow Clock) cycle or more is accepted.
Your code example is working perfectly.
from a quick read of the data sheet I think the filter can go as slow as 1 second
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16