Add default interrupt handler for Freescale NMI_b pins.

pull/160/head
sg- 2014-02-07 18:20:45 -06:00
parent 7ef411e7fb
commit fad5c27038
3 changed files with 40 additions and 4 deletions

View File

@ -37,7 +37,9 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
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;
@ -170,3 +172,13 @@ void gpio_irq_disable(gpio_irq_t *obj) {
NVIC_DisableIRQ(PORTB_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, PTB5, PIN_INPUT);
}

View File

@ -37,7 +37,9 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
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 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
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 @@ void gpio_irq_disable(gpio_irq_t *obj) {
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);
}

View File

@ -37,8 +37,9 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
if (port->ISFR & pmask) {
mask |= pmask;
uint32_t id = channel_ids[ch_base + i];
if (id == 0)
if (id == 0) {
continue;
}
FGPIO_Type *gpio;
gpio_irq_event event = IRQ_NONE;
@ -181,3 +182,13 @@ void gpio_irq_disable(gpio_irq_t *obj) {
NVIC_DisableIRQ(PORTC_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);
}