microbit-dal

Dependencies:   BLE_API mbed-dev-bin nRF51822

Fork of microbit-dal by Lancaster University

Revision:
36:6837feb07da4
Parent:
35:8ce23bc1af38
Child:
37:b624ae5e94a5
--- a/source/drivers/MicroBitPin.cpp	Wed Jul 13 12:18:14 2016 +0100
+++ b/source/drivers/MicroBitPin.cpp	Wed Jul 13 12:18:15 2016 +0100
@@ -442,6 +442,31 @@
 }
 
 /**
+  * Configures the pull of this pin.
+  *
+  * @param pull one of the mbed pull configurations: PullUp, PullDown, PullNone, OpenDrain
+  *
+  * @return MICROBIT_NOT_SUPPORTED if the current pin configuration is anything other
+  *         than a digital input, otherwise MICROBIT_OK.
+  */
+int MicroBitPin::setPull(PinMode pull)
+{
+    if ((status & IO_STATUS_DIGITAL_IN))
+    {
+        ((DigitalIn *)pin)->mode(pull);
+        return MICROBIT_OK;
+    }
+
+    if((status & IO_STATUS_EVENT_ON_EDGE) || (status & IO_STATUS_EVENT_PULSE_ON_EDGE))
+    {
+        ((TimedInterruptIn *)pin)->mode(pull);
+        return MICROBIT_OK;
+    }
+
+    return MICROBIT_NOT_SUPPORTED;
+}
+
+/**
   * This member function manages the calculation of the timestamp of a pulse detected
   * on a pin whilst in IO_STATUS_EVENT_PULSE_ON_EDGE or IO_STATUS_EVENT_ON_EDGE modes.
   *