mbed w/ spi bug fig
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_DISCO_F407VG/gpio_irq_api.c
- Revision:
- 242:7074e42da0b2
- Parent:
- 158:3121b9889f7b
--- a/targets/hal/TARGET_STM/TARGET_DISCO_F407VG/gpio_irq_api.c Thu Jun 26 10:30:09 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F407VG/gpio_irq_api.c Fri Jun 27 07:30:09 2014 +0100 @@ -32,7 +32,6 @@ #include "gpio_irq_api.h" #include "pinmap.h" -#include "stm32f4xx_hal.h" #include "error.h" #define EDGE_NONE (0) @@ -54,8 +53,7 @@ uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]); // Clear interrupt flag - if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) - { + if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) { __HAL_GPIO_EXTI_CLEAR_FLAG(pin); } @@ -64,20 +62,40 @@ // Check which edge has generated the irq if ((gpio->IDR & pin) == 0) { irq_handler(channel_ids[irq_index], IRQ_FALL); - } - else { + } else { irq_handler(channel_ids[irq_index], IRQ_RISE); } } // The irq_index is passed to the function -static void gpio_irq0(void) {handle_interrupt_in(0);} // EXTI line 0 -static void gpio_irq1(void) {handle_interrupt_in(1);} // EXTI line 1 -static void gpio_irq2(void) {handle_interrupt_in(2);} // EXTI line 2 -static void gpio_irq3(void) {handle_interrupt_in(3);} // EXTI line 3 -static void gpio_irq4(void) {handle_interrupt_in(4);} // EXTI line 4 -static void gpio_irq5(void) {handle_interrupt_in(5);} // EXTI lines 5 to 9 -static void gpio_irq6(void) {handle_interrupt_in(6);} // EXTI lines 10 to 15 +// EXTI line 0 +static void gpio_irq0(void) { + handle_interrupt_in(0); +} +// EXTI line 1 +static void gpio_irq1(void) { + handle_interrupt_in(1); +} +// EXTI line 2 +static void gpio_irq2(void) { + handle_interrupt_in(2); +} +// EXTI line 3 +static void gpio_irq3(void) { + handle_interrupt_in(3); +} +// EXTI line 4 +static void gpio_irq4(void) { + handle_interrupt_in(4); +} +// EXTI lines 5 to 9 +static void gpio_irq5(void) { + handle_interrupt_in(5); +} +// EXTI lines 10 to 15 +static void gpio_irq6(void) { + handle_interrupt_in(6); +} extern uint32_t Set_GPIO_Clock(uint32_t port_idx); @@ -138,7 +156,7 @@ irq_index = 6; break; default: - error("InterruptIn error: pin not supported."); + error("InterruptIn error: pin not supported.\n"); return -1; } @@ -187,8 +205,7 @@ if ((obj->event == EDGE_FALL) || (obj->event == EDGE_BOTH)) { mode = STM_MODE_IT_RISING_FALLING; obj->event = EDGE_BOTH; - } - else { // NONE or RISE + } else { // NONE or RISE mode = STM_MODE_IT_RISING; obj->event = EDGE_RISE; } @@ -198,14 +215,12 @@ if ((obj->event == EDGE_RISE) || (obj->event == EDGE_BOTH)) { mode = STM_MODE_IT_RISING_FALLING; obj->event = EDGE_BOTH; - } - else { // NONE or FALL + } else { // NONE or FALL mode = STM_MODE_IT_FALLING; obj->event = EDGE_FALL; } } - } - else { + } else { mode = STM_MODE_INPUT; pull = GPIO_NOPULL; obj->event = EDGE_NONE;