My fork
Dependencies: BLE_API nRF51822-bluetooth-mdw
Fork of microbit-dal by
Diff: source/drivers/MicroBitPin.cpp
- Revision:
- 65:f7ebabf23e15
- Parent:
- 63:b4372a29994f
- Child:
- 66:2fc7d7c2fffc
diff -r 98cb56bf7711 -r f7ebabf23e15 source/drivers/MicroBitPin.cpp --- a/source/drivers/MicroBitPin.cpp Wed Jul 13 12:18:43 2016 +0100 +++ b/source/drivers/MicroBitPin.cpp Wed Jul 13 12:18:45 2016 +0100 @@ -57,7 +57,6 @@ this->id = id; this->name = name; this->capability = capability; - this->pullMode = MICROBIT_DEFAULT_PULLMODE; // Power up in a disconnected, low power state. // If we're unused, this is how it will stay... @@ -160,7 +159,7 @@ if (!(status & (IO_STATUS_DIGITAL_IN | IO_STATUS_EVENT_ON_EDGE | IO_STATUS_EVENT_PULSE_ON_EDGE))) { disconnect(); - pin = new DigitalIn(name, (PinMode)pullMode); + pin = new DigitalIn(name,PullDown); status |= IO_STATUS_DIGITAL_IN; } @@ -170,25 +169,6 @@ return ((DigitalIn *)pin)->read(); } -/** - * 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 MicroBitPin::getDigitalValue(PinMode pull) -{ - setPull(pull); - return getDigitalValue(); -} - int MicroBitPin::obtainAnalogChannel() { // Move into an analogue input state if necessary, if we are no longer the focus of a DynamicPWM instance, allocate ourselves again! @@ -471,8 +451,6 @@ */ int MicroBitPin::setPull(PinMode pull) { - pullMode = pull; - if ((status & IO_STATUS_DIGITAL_IN)) { ((DigitalIn *)pin)->mode(pull); @@ -550,7 +528,7 @@ disconnect(); pin = new TimedInterruptIn(name); - ((TimedInterruptIn *)pin)->mode((PinMode)pullMode); + ((TimedInterruptIn *)pin)->mode(PullDown); ((TimedInterruptIn *)pin)->rise(this, &MicroBitPin::onRise); ((TimedInterruptIn *)pin)->fall(this, &MicroBitPin::onFall); }