SAM4S Xplained (both): Button interrupts not being disabled after being detached

This commit is contained in:
Gregory Nutt 2014-06-15 12:43:33 -06:00
parent dff01c3166
commit 4bac220b77
2 changed files with 34 additions and 8 deletions

View File

@ -141,11 +141,24 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
oldhandler = g_irqsw0;
g_irqsw0 = irqhandler;
/* Configure the interrupt */
/* Are we attaching or detaching? */
if (irqhandler != NULL)
{
/* Configure the interrupt */
sam_gpioirq(IRQ_SW0);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_gpioirqenable(IRQ_SW0);
}
else
{
/* Detach and disable the interrupt */
(void)irq_detach(IRQ_SW0)
sam_gpioirqdisable(IRQ_SW0);
}
sam_gpioirq(IRQ_SW0);
(void)irq_attach(IRQ_SW0, irqhandler);
sam_gpioirqenable(IRQ_SW0);
irqrestore(flags);
}

View File

@ -140,11 +140,24 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
oldhandler = *g_irqbp2;
*g_irqbp2 = irqhandler;
/* Configure the interrupt */
/* Are we attaching or detaching? */
if (irqhandler != NULL)
{
/* Configure the interrupt */
sam_gpioirq(IRQ_BP2);
(void)irq_attach(IRQ_BP2, irqhandler);
sam_gpioirqenable(IRQ_BP2);
}
else
{
/* Detach and disable the interrupt */
(void)irq_detach(IRQ_BP2)
sam_gpioirqdisable(IRQ_BP2);
}
sam_gpioirq(IRQ_BP2);
(void)irq_attach(IRQ_BP2, irqhandler);
sam_gpioirqenable(IRQ_BP2);
irqrestore(flags);
}