diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-06-15 12:43:33 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-06-15 12:43:33 -0600 |
commit | be84b0a1dfdf9541112930896119db0a9daf5256 (patch) | |
tree | 910bc0d1010005a4ae0d913974f1b9b2456b617f /nuttx/configs/sam4s-xplained-pro | |
parent | 02a2e058213b5023be23949add9efcc72f2c3732 (diff) | |
download | px4-nuttx-be84b0a1dfdf9541112930896119db0a9daf5256.tar.gz px4-nuttx-be84b0a1dfdf9541112930896119db0a9daf5256.tar.bz2 px4-nuttx-be84b0a1dfdf9541112930896119db0a9daf5256.zip |
SAM4S Xplained (both): Button interrupts not being disabled after being detached
Diffstat (limited to 'nuttx/configs/sam4s-xplained-pro')
-rw-r--r-- | nuttx/configs/sam4s-xplained-pro/src/sam_buttons.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/nuttx/configs/sam4s-xplained-pro/src/sam_buttons.c b/nuttx/configs/sam4s-xplained-pro/src/sam_buttons.c index 5d3c7d92e..49b983383 100644 --- a/nuttx/configs/sam4s-xplained-pro/src/sam_buttons.c +++ b/nuttx/configs/sam4s-xplained-pro/src/sam_buttons.c @@ -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); } |