mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
186:707f6e361f3e
Parent:
175:af195413fb11
Child:
187:0387e8f68319
--- a/drivers/InterruptIn.cpp	Thu Apr 19 17:12:19 2018 +0100
+++ b/drivers/InterruptIn.cpp	Fri Jun 22 16:45:37 2018 +0100
@@ -19,14 +19,31 @@
 
 namespace mbed {
 
+// Note: This single-parameter constructor exists to maintain binary
+//       compatibility.
+//       If not for that, we could simplify by having only the 2-param
+//       constructor, with a default value for the PinMode.
 InterruptIn::InterruptIn(PinName pin) : gpio(),
                                         gpio_irq(),
                                         _rise(NULL),
                                         _fall(NULL) {
     // No lock needed in the constructor
+    irq_init(pin);
+    gpio_init_in(&gpio, pin);
+}
 
-    gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
-    gpio_init_in(&gpio, pin);
+InterruptIn::InterruptIn(PinName pin, PinMode mode) :
+                                        gpio(),
+                                        gpio_irq(),
+                                        _rise(NULL),
+                                        _fall(NULL) {
+    // No lock needed in the constructor
+    irq_init(pin);
+    gpio_init_in_ex(&gpio, pin, mode);
+}
+
+void InterruptIn::irq_init(PinName pin) {
+   gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
 }
 
 InterruptIn::~InterruptIn() {