ShiftReg library (74HC595, NUJ3711)
Diff: ShiftReg.h
- Revision:
- 1:3741bc0fbba8
- Parent:
- 0:5f1670338bef
diff -r 5f1670338bef -r 3741bc0fbba8 ShiftReg.h --- a/ShiftReg.h Sat Oct 24 16:30:11 2015 +0000 +++ b/ShiftReg.h Sat Oct 24 17:44:30 2015 +0000 @@ -3,18 +3,23 @@ #define HC595 //#define NJU3711 #include "mbed.h" - + +template <class T_bit> class ShiftReg { public: ShiftReg(PinName dataPin, PinName stbPin, PinName clkPin, PinName clrPin); - void send_data(uint8_t data); + void send_data(T_bit data, uint8_t size); + typedef ShiftReg<uint8_t> ShiftReg8; + typedef ShiftReg<uint16_t> ShiftReg16; + typedef ShiftReg<uint32_t> ShiftReg32; + private: DigitalOut DATA; DigitalOut STB; DigitalOut CLK; DigitalOut CLR; - void shiftOut(uint8_t data); + void shiftOut(T_bit data, uint8_t size); }; #endif \ No newline at end of file