mbed library sources

Fork of mbed-src by mbed official

Revision:
455:8bc3a354916d
Parent:
212:34d62c0b2af6
--- a/api/BusInOut.h	Tue Jan 27 07:15:07 2015 +0000
+++ b/api/BusInOut.h	Tue Jan 27 13:30:08 2015 +0000
@@ -51,7 +51,6 @@
      */
     void write(int value);
 
-
     /** Read the value currently output on the bus
      *
      *  @returns
@@ -73,12 +72,26 @@
      */
     void mode(PinMode pull);
 
+    /** Binary mask of bus pins connected to actual pins (not NC pins)
+     *  If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
+     *
+     *  @returns
+     *    Binary mask of connected pins
+     */
+    int mask() {
+        return _nc_mask;
+    }
+
 #ifdef MBED_OPERATORS
      /** A shorthand for write()
      */
     BusInOut& operator= (int v);
     BusInOut& operator= (BusInOut& rhs);
 
+    /** Access to particular bit in random-iterator fashion
+    */
+    DigitalInOut& operator[] (int index);
+
     /** A shorthand for read()
      */
     operator int();
@@ -87,6 +100,12 @@
 protected:
     DigitalInOut* _pin[16];
 
+    /** Mask of bus's NC pins
+     * If bit[n] is set to 1 - pin is connected
+     * if bit[n] is cleared - pin is not connected (NC)
+     */
+    int _nc_mask;
+
     /* disallow copy constructor and assignment operators */
 private:
     BusInOut(const BusInOut&);