ads1115 only
Fork of mbed by
Diff: BusInOut.h
- Revision:
- 93:e188a91d3eaa
- Parent:
- 85:024bf7f99721
- Child:
- 122:f9eeca106725
--- a/BusInOut.h Thu Nov 27 13:33:22 2014 +0000 +++ b/BusInOut.h Tue Feb 03 15:31:20 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&);