mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal
Dependencies: BLE_API nRF51822 mbed-dev-bin
Dependents: microbit Microbit IoTChallenge1 microbit ... more
Diff: inc/drivers/MicroBitPin.h
- Revision:
- 66:2fc7d7c2fffc
- Parent:
- 65:f7ebabf23e15
--- a/inc/drivers/MicroBitPin.h Wed Jul 13 12:18:45 2016 +0100 +++ b/inc/drivers/MicroBitPin.h Wed Jul 13 12:18:46 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