The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Revision:
93:e188a91d3eaa
Parent:
85:024bf7f99721
--- a/BusOut.h	Thu Nov 27 13:33:22 2014 +0000
+++ b/BusOut.h	Tue Feb 03 15:31:20 2015 +0000
@@ -56,12 +56,26 @@
      */
     int read();
 
+    /** 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()
      */
     BusOut& operator= (int v);
     BusOut& operator= (BusOut& rhs);
 
+    /** Access to particular bit in random-iterator fashion
+     */
+    DigitalOut& operator[] (int index);
+
     /** A shorthand for read()
      */
     operator int();
@@ -70,6 +84,12 @@
 protected:
     DigitalOut* _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:
     BusOut(const BusOut&);