The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
Diff: drivers/DigitalInOut.h
- Revision:
- 171:3a7713b1edbc
- Parent:
- 170:e95d10626187
- Child:
- 172:65be27845400
--- a/drivers/DigitalInOut.h Thu Sep 06 13:39:34 2018 +0100 +++ b/drivers/DigitalInOut.h Thu Nov 08 11:45:42 2018 +0000 @@ -121,6 +121,13 @@ /** A shorthand for write() * \sa DigitalInOut::write() + * @code + * DigitalInOut inout(PIN); + * DigitalIn button(BUTTON1); + * inout.output(); + * + * inout = button; // Equivalent to inout.write(button.read()) + * @endcode */ DigitalInOut &operator= (int value) { @@ -129,7 +136,8 @@ return *this; } - /** A shorthand for write() + /**A shorthand for write() using the assignment operator which copies the + * state from the DigitalInOut argument. * \sa DigitalInOut::write() */ DigitalInOut &operator= (DigitalInOut &rhs) @@ -142,6 +150,13 @@ /** A shorthand for read() * \sa DigitalInOut::read() + * @code + * DigitalInOut inout(PIN); + * DigitalOut led(LED1); + * + * inout.input(); + * led = inout; // Equivalent to led.write(inout.read()) + * @endcode */ operator int() { @@ -150,7 +165,9 @@ } protected: + #if !defined(DOXYGEN_ONLY) gpio_t gpio; + #endif //!defined(DOXYGEN_ONLY) }; } // namespace mbed