SAM4S Xplained (both): Button interrupts not being disabled after being detached
This commit is contained in:
parent
dff01c3166
commit
4bac220b77
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user