Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: api/BusOut.h
- Revision:
- 456:8bc3a354916d
- Parent:
- 212:34d62c0b2af6
--- a/api/BusOut.h Tue Jan 27 07:15:07 2015 +0000
+++ b/api/BusOut.h Tue Jan 27 13:30:08 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&);