mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/PortOut.h
- Revision:
- 187:0387e8f68319
- Parent:
- 167:e84263d55307
- Child:
- 188:bcfe06ba3d64
diff -r 707f6e361f3e -r 0387e8f68319 drivers/PortOut.h --- a/drivers/PortOut.h Fri Jun 22 16:45:37 2018 +0100 +++ b/drivers/PortOut.h Thu Sep 06 13:40:20 2018 +0100 @@ -59,7 +59,8 @@ * @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) { + PortOut(PortName port, int mask = 0xFFFFFFFF) + { core_util_critical_section_enter(); port_init(&_port, port, mask, PIN_OUTPUT); core_util_critical_section_exit(); @@ -69,7 +70,8 @@ * * @param value An integer specifying a bit to write for every corresponding PortOut pin */ - void write(int value) { + void write(int value) + { port_write(&_port, value); } @@ -78,14 +80,16 @@ * @returns * An integer with each bit corresponding to associated PortOut pin setting */ - int read() { + int read() + { return port_read(&_port); } /** A shorthand for write() * \sa PortOut::write() */ - PortOut& operator= (int value) { + PortOut &operator= (int value) + { write(value); return *this; } @@ -93,7 +97,8 @@ /** A shorthand for read() * \sa PortOut::read() */ - PortOut& operator= (PortOut& rhs) { + PortOut &operator= (PortOut &rhs) + { write(rhs.read()); return *this; } @@ -101,7 +106,8 @@ /** A shorthand for read() * \sa PortOut::read() */ - operator int() { + operator int() + { return read(); }