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.

Revision:
170:e95d10626187
Parent:
156:ff21514d8981
Child:
171:3a7713b1edbc
--- a/drivers/DigitalInOut.h	Fri Jun 22 15:38:59 2018 +0100
+++ b/drivers/DigitalInOut.h	Thu Sep 06 13:39:34 2018 +0100
@@ -36,7 +36,8 @@
      *
      *  @param pin DigitalInOut pin to connect to
      */
-    DigitalInOut(PinName pin) : gpio() {
+    DigitalInOut(PinName pin) : gpio()
+    {
         // No lock needed in the constructor
         gpio_init_in(&gpio, pin);
     }
@@ -48,7 +49,8 @@
      *  @param mode the initial mode of the pin
      *  @param value the initial value of the pin if is an output
      */
-    DigitalInOut(PinName pin, PinDirection direction, PinMode mode, int value) : gpio() {
+    DigitalInOut(PinName pin, PinDirection direction, PinMode mode, int value) : gpio()
+    {
         // No lock needed in the constructor
         gpio_init_inout(&gpio, pin, direction, mode, value);
     }
@@ -58,7 +60,8 @@
      *  @param value An integer specifying the pin output value,
      *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
-    void write(int value) {
+    void write(int value)
+    {
         // Thread safe / atomic HAL call
         gpio_write(&gpio, value);
     }
@@ -69,14 +72,16 @@
      *    an integer representing the output setting of the pin if it is an output,
      *    or read the input if set as an input
      */
-    int read() {
+    int read()
+    {
         // Thread safe / atomic HAL call
         return gpio_read(&gpio);
     }
 
     /** Set as an output
      */
-    void output() {
+    void output()
+    {
         core_util_critical_section_enter();
         gpio_dir(&gpio, PIN_OUTPUT);
         core_util_critical_section_exit();
@@ -84,7 +89,8 @@
 
     /** Set as an input
      */
-    void input() {
+    void input()
+    {
         core_util_critical_section_enter();
         gpio_dir(&gpio, PIN_INPUT);
         core_util_critical_section_exit();
@@ -94,7 +100,8 @@
      *
      *  @param pull PullUp, PullDown, PullNone, OpenDrain
      */
-    void mode(PinMode pull) {
+    void mode(PinMode pull)
+    {
         core_util_critical_section_enter();
         gpio_mode(&gpio, pull);
         core_util_critical_section_exit();
@@ -106,7 +113,8 @@
      *    Non zero value if pin is connected to uc GPIO
      *    0 if gpio object was initialized with NC
      */
-    int is_connected() {
+    int is_connected()
+    {
         // Thread safe / atomic HAL call
         return gpio_is_connected(&gpio);
     }
@@ -114,7 +122,8 @@
     /** A shorthand for write()
      * \sa DigitalInOut::write()
      */
-    DigitalInOut& operator= (int value) {
+    DigitalInOut &operator= (int value)
+    {
         // Underlying write is thread safe
         write(value);
         return *this;
@@ -123,7 +132,8 @@
     /** A shorthand for write()
      * \sa DigitalInOut::write()
      */
-    DigitalInOut& operator= (DigitalInOut& rhs) {
+    DigitalInOut &operator= (DigitalInOut &rhs)
+    {
         core_util_critical_section_enter();
         write(rhs.read());
         core_util_critical_section_exit();
@@ -133,7 +143,8 @@
     /** A shorthand for read()
      * \sa DigitalInOut::read()
      */
-    operator int() {
+    operator int()
+    {
         // Underlying call is thread safe
         return read();
     }