mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

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&);