Shift registers working
Diff: ShiftReg.h
- Revision:
- 1:9cc13bd590df
- Parent:
- 0:a0e3fd47970f
diff -r a0e3fd47970f -r 9cc13bd590df ShiftReg.h --- a/ShiftReg.h Fri Nov 09 01:03:30 2012 +0000 +++ b/ShiftReg.h Tue May 07 13:19:27 2019 +0000 @@ -63,10 +63,7 @@ { public: /** Bit order out format */ - enum BitOrd { - MSBFirst = 0x80, /**< Most significant bit first */ - LSBFirst = 0x01 /**< Least significant bit first */ - }; + enum BitOrd {MSBFirst = 0x8000, /**< Most significant bit first */LSBFirst = 0x0001 /**< Least significant bit first */}; /** Create a ShiftReg interface to shift register * @@ -74,36 +71,24 @@ * @param store Pin to store register * @param clock Pin to shift into register */ - ShiftReg - (PinName data - ,PinName store - ,PinName clock - ); + ShiftReg(PinName data, PinName store, PinName clock);//Constructor /** Shift out 8-bit data via the serial pin * * @param data Data to be shifted out via the serial pin * @param order Bit order to shift out data. Default is MSBFirst */ - void - ShiftByte - (int8_t data - ,BitOrd ord = MSBFirst - ); + void ShiftByte(uint16_t data,BitOrd ord = MSBFirst);//Shifting the data member function /** Shift out 1-bit data via the serial pin * * @param data Data to be shifted out via the serial pin */ - void - ShiftBit - (int8_t data = 0 - ); + void ShiftBit(int8_t data = 0);//Shifting a single bit in /** Latch data out */ - void - Latch(); + void Latch(); private: DigitalOut _ds; // Serial in