Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
Diff: inc/drivers/MicroBitPin.h
- Revision:
- 63:b4372a29994f
- Parent:
- 53:ee44932401cb
- Child:
- 65:f7ebabf23e15
diff -r e633e0eeaf19 -r b4372a29994f inc/drivers/MicroBitPin.h
--- a/inc/drivers/MicroBitPin.h	Wed Jul 13 12:18:41 2016 +0100
+++ b/inc/drivers/MicroBitPin.h	Wed Jul 13 12:18:42 2016 +0100
@@ -95,8 +95,8 @@
 {
     // The mbed object looking after this pin at any point in time (untyped due to dynamic behaviour).
     void *pin;
-
     PinCapability capability;
+    uint8_t pullMode;
 
     /**
       * Disconnect any attached mBed IO from this pin.
@@ -200,6 +200,21 @@
     int getDigitalValue();
 
     /**
+      * Configures this IO pin as a digital input with the specified internal pull-up/pull-down configuraiton (if necessary) and tests its current value.
+      *
+      * @param pull one of the mbed pull configurations: PullUp, PullDown, PullNone
+      *
+      * @return 1 if this input is high, 0 if input is LO, or MICROBIT_NOT_SUPPORTED
+      *         if the given pin does not have digital capability.
+      *
+      * @code
+      * MicroBitPin P0(MICROBIT_ID_IO_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_BOTH);
+      * P0.getDigitalValue(PullUp); // P0 is either 0 or 1;
+      * @endcode
+      */
+    int getDigitalValue(PinMode pull);
+
+    /**
       * Configures this IO pin as an analog/pwm output, and change the output value to the given level.
       *
       * @param value the level to set on the output pin, in the range 0 - 1024
    