We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3c78abf commit da6daa8Copy full SHA for da6daa8
1 file changed
mdbook/src/15-interrupts/examples/count-debounce.rs
@@ -67,6 +67,12 @@ fn main() -> ! {
67
unsafe { pac::NVIC::unmask(pac::Interrupt::GPIOTE) };
68
pac::NVIC::unpend(pac::Interrupt::GPIOTE);
69
70
+ // Because we're not disabling GPIOTE interrupts even during the debounce timer countdown,
71
+ // we can get extra button interrupts even during the debounce interval.
72
+ // It would be reasonable to disable button interrupts when the debounce timer is started
73
+ // and re-enable them when it expires, but this would require a debounce timer interrupt handler.
74
+ // To make a simple "fix" for this that doesn't hurt the readability,
75
+ // we introduce the cur_count "guard" variable.
76
let mut cur_count = 0;
77
loop {
78
// "wait for interrupt": CPU goes to sleep until an interrupt.
0 commit comments