Modified InOut library
Diff: DigitalInOut2.h
- Revision:
- 1:f3a86fb2a054
- Parent:
- 0:1d15d1ea182e
- Child:
- 2:291f43f0b5a2
diff -r 1d15d1ea182e -r f3a86fb2a054 DigitalInOut2.h --- a/DigitalInOut2.h Sun Oct 12 23:47:17 2014 +0000 +++ b/DigitalInOut2.h Sun Oct 12 23:51:11 2014 +0000 @@ -12,11 +12,13 @@ class DigitalInOut2 { public: + gpio_t gpio; + /** Create a DigitalInOut connected to the specified pin * * @param pin DigitalInOut pin to connect to */ - DigitalInOut(PinName pin) { + DigitalInOut2(PinName pin) { gpio_init(&gpio, pin, PIN_INPUT); } @@ -62,12 +64,12 @@ #ifdef MBED_OPERATORS /** A shorthand for write() */ - DigitalInOut& operator= (int value) { + DigitalInOut2& operator= (int value) { write(value); return *this; } - DigitalInOut& operator= (DigitalInOut& rhs) { + DigitalInOut2& operator= (DigitalInOut2& rhs) { write(rhs.read()); return *this; } @@ -79,7 +81,6 @@ } #endif - gpio_t gpio; }; } // namespace mbed