mbed library sources
Fork of mbed-src by
Diff: targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/gpio_irq_api.c
- Revision:
- 86:26fc69fd3b6c
- Parent:
- 82:0b31dbcd4769
- Child:
- 113:65a335a675de
--- a/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/gpio_irq_api.c Fri Feb 07 18:00:11 2014 +0000 +++ b/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/gpio_irq_api.c Sat Feb 08 12:00:07 2014 +0000 @@ -37,7 +37,9 @@ if (port->ISFR & pmask) { mask |= pmask; uint32_t id = channel_ids[ch_base + i]; - if (id == 0) continue; + if (id == 0) { + continue; + } FGPIO_Type *gpio; gpio_irq_event event = IRQ_NONE; @@ -55,8 +57,9 @@ event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL); break; } - if (event != IRQ_NONE) + if (event != IRQ_NONE) { irq_handler(id, event); + } } } port->ISFR = mask; @@ -159,3 +162,13 @@ NVIC_DisableIRQ(PORTD_IRQn); } } + +// Change the NMI pin to an input. This allows NMI pin to +// be used as a low power mode wakeup. The application will +// need to change the pin back to NMI_b or wakeup only occurs once! +extern void gpio_init(gpio_t *obj, PinName pin, PinDirection direction); +void NMI_Handler(void) +{ + gpio_t gpio; + gpio_init(&gpio, PTA4, PIN_INPUT); +}