mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Revision:
7:73c5efe92a6c
Parent:
0:8024c367e29f
Child:
8:c14af7958ef5
--- a/InterruptIn.h	Fri Oct 12 10:06:08 2012 +0000
+++ b/InterruptIn.h	Tue Oct 23 09:20:18 2012 +0000
@@ -1,7 +1,6 @@
 /* mbed Microcontroller Library - InterruptIn
  * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */ 
- 
+ */
 #ifndef MBED_INTERRUPTIN_H
 #define MBED_INTERRUPTIN_H
 
@@ -9,18 +8,13 @@
 
 #if DEVICE_INTERRUPTIN
 
+#include "gpio_api.h"
+#include "gpio_irq_api.h"
+
 #include "platform.h"
-#include "gpio_api.h"
-#include "PeripheralNames.h"
 #include "Base.h"
 #include "FunctionPointer.h"
 
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-#define CHANNEL_NUM   48
-#elif defined(TARGET_LPC11U24)
-#define CHANNEL_NUM    8
-#endif
-
 namespace mbed {
 
 /* Class: InterruptIn
@@ -58,9 +52,7 @@
      *  name - (optional) A string to identify the object
      */
     InterruptIn(PinName pin, const char *name = NULL);
-#if defined(TARGET_LPC11U24)
     virtual ~InterruptIn();
-#endif
  
      int read();
 #ifdef MBED_OPERATORS
@@ -86,7 +78,7 @@
     template<typename T>
     void rise(T* tptr, void (T::*mptr)(void)) {
         _rise.attach(tptr, mptr);
-        setup_interrupt(1, 1);
+        gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
     }
 
     /* Function: fall
@@ -107,7 +99,7 @@
     template<typename T>
     void fall(T* tptr, void (T::*mptr)(void)) {
         _fall.attach(tptr, mptr);
-        setup_interrupt(0, 1);
+        gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
     }
 
     /* Function: mode
@@ -118,28 +110,14 @@
      */
     void mode(PinMode pull);
     
-    static InterruptIn *_irq_objects[CHANNEL_NUM];
+    static void _irq_handler(uint32_t id, gpio_irq_event event);
     
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-    static void _irq();
-#elif defined(TARGET_LPC11U24)
-    static void handle_interrupt_in(unsigned int channel);
-    static void _irq0(); static void _irq1();
-    static void _irq2(); static void _irq3();
-    static void _irq4(); static void _irq5();
-    static void _irq6(); static void _irq7();
-#endif
-
 protected:
     gpio_object gpio;
-#if defined(TARGET_LPC11U24)
-    Channel _channel;
-#endif
+    gpio_irq_object gpio_irq;
+    
     FunctionPointer _rise;
     FunctionPointer _fall;
-
-    void setup_interrupt(int rising, int enable);
-    
 };
 
 } // namespace mbed