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.
Fork of mbed by
Diff: PortOut.h
- Revision:
- 55:d722ed6a4237
- Parent:
- 54:71b101360fb9
- Child:
- 59:0883845fe643
--- a/PortOut.h Tue Jan 08 12:46:36 2013 +0000
+++ b/PortOut.h Wed Jan 16 12:56:34 2013 +0000
@@ -34,7 +34,7 @@
* Example:
* @code
* // Toggle all four LEDs
- *
+ *
* #include "mbed.h"
*
* // LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23
@@ -51,7 +51,7 @@
* }
* }
* @endcode
- */
+ */
class PortOut {
public:
@@ -59,19 +59,19 @@
*
* @param port Port to connect to (Port0-Port5)
* @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
- */
+ */
PortOut(PortName port, int mask = 0xFFFFFFFF) {
port_init(&_port, port, mask, PIN_OUTPUT);
}
-
+
/** Write the value to the output port
*
* @param value An integer specifying a bit to write for every corresponding PortOut pin
- */
+ */
void write(int value) {
port_write(&_port, value);
}
-
+
/** Read the value currently output on the port
*
* @returns
@@ -82,20 +82,20 @@
}
/** A shorthand for write()
- */
- PortOut& operator= (int value) {
+ */
+ PortOut& operator= (int value) {
write(value);
return *this;
}
-
- PortOut& operator= (PortOut& rhs) {
+
+ PortOut& operator= (PortOut& rhs) {
write(rhs.read());
return *this;
}
-
+
/** A shorthand for read()
*/
- operator int() {
+ operator int() {
return read();
}
