mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Revision:
256:76fd9a263045
Parent:
251:de9a1e4ffd79
Child:
286:31249416b6f9
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c	Fri Jul 11 10:00:08 2014 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c	Tue Jul 15 07:45:08 2014 +0100
@@ -28,13 +28,13 @@
  * A future implementation may provide group interrupt support.
  */
 #if !defined(CORE_M0)
-#define CHANNEL_NUM    8
+#define CHANNEL_MAX    8
 #else
-#define CHANNEL_NUM    1
+#define CHANNEL_MAX    1
 #endif
 
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static uint32_t channel = 0;
+static uint32_t channel_ids[CHANNEL_MAX] = {0};
+static uint8_t channel = 0;
 static gpio_irq_handler irq_handler;
 
 static void handle_interrupt_in(void) {
@@ -43,19 +43,21 @@
     uint32_t pmask;
     int i;
 
-    for (i = 0; i < CHANNEL_NUM; i++) {
+    for (i = 0; i < CHANNEL_MAX; i++) {
         pmask = (1 << i);
         if (rise & pmask) {
             /* Rising edge interrupts */
-            if (channel_ids[i] != 0)
+            if (channel_ids[i] != 0) {
                 irq_handler(channel_ids[i], IRQ_RISE);
+            }
             /* Clear rising edge detected */
             LPC_GPIO_PIN_INT->RISE = pmask;
         }
         if (fall & pmask) {
             /* Falling edge interrupts */
-            if (channel_ids[i] != 0)
+            if (channel_ids[i] != 0) {
                 irq_handler(channel_ids[i], IRQ_FALL);
+            }
             /* Clear falling edge detected */
             LPC_GPIO_PIN_INT->FALL = pmask;
         }
@@ -100,7 +102,7 @@
 
     // Increment channel number
     channel++;
-    channel %= CHANNEL_NUM;
+    channel %= CHANNEL_MAX;
 
     return 0;
 }