mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/PortIn.h
- Revision:
- 187:0387e8f68319
- Parent:
- 167:e84263d55307
- Child:
- 188:bcfe06ba3d64
--- a/drivers/PortIn.h Fri Jun 22 16:45:37 2018 +0100 +++ b/drivers/PortIn.h Thu Sep 06 13:40:20 2018 +0100 @@ -60,7 +60,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) */ - PortIn(PortName port, int mask = 0xFFFFFFFF) { + PortIn(PortName port, int mask = 0xFFFFFFFF) + { core_util_critical_section_enter(); port_init(&_port, port, mask, PIN_INPUT); core_util_critical_section_exit(); @@ -71,7 +72,8 @@ * @returns * An integer with each bit corresponding to associated port pin setting */ - int read() { + int read() + { return port_read(&_port); } @@ -79,7 +81,8 @@ * * @param mode PullUp, PullDown, PullNone, OpenDrain */ - void mode(PinMode mode) { + void mode(PinMode mode) + { core_util_critical_section_enter(); port_mode(&_port, mode); core_util_critical_section_exit(); @@ -87,7 +90,8 @@ /** A shorthand for read() */ - operator int() { + operator int() + { return read(); }