Merge pull request #1443 from 0xc0170/fix_interruptin_clear

InterrupIn - attach with null clears the function pointer
pull/2453/head^2
Martin Kojtal 2015-11-26 13:19:50 +00:00
commit d2dde861b4
1 changed files with 2 additions and 0 deletions

View File

@ -44,6 +44,7 @@ void InterruptIn::rise(void (*fptr)(void)) {
_rise.attach(fptr);
gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
} else {
_rise.attach(NULL);
gpio_irq_set(&gpio_irq, IRQ_RISE, 0);
}
}
@ -53,6 +54,7 @@ void InterruptIn::fall(void (*fptr)(void)) {
_fall.attach(fptr);
gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
} else {
_fall.attach(NULL);
gpio_irq_set(&gpio_irq, IRQ_FALL, 0);
}
}