ShiftReg library (74HC595, NUJ3711)

Committer:
kysiki
Date:
Sat Oct 24 17:44:30 2015 +0000
Revision:
1:3741bc0fbba8
Parent:
0:5f1670338bef
8bit, 16bit, 32bit???

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kysiki 0:5f1670338bef 1 #ifndef MBED_SHIFTREG_H
kysiki 0:5f1670338bef 2 #define MBED_SHIFTREG_H
kysiki 0:5f1670338bef 3 #define HC595
kysiki 0:5f1670338bef 4 //#define NJU3711
kysiki 0:5f1670338bef 5 #include "mbed.h"
kysiki 1:3741bc0fbba8 6
kysiki 1:3741bc0fbba8 7 template <class T_bit>
kysiki 0:5f1670338bef 8 class ShiftReg {
kysiki 0:5f1670338bef 9 public:
kysiki 0:5f1670338bef 10 ShiftReg(PinName dataPin, PinName stbPin, PinName clkPin, PinName clrPin);
kysiki 1:3741bc0fbba8 11 void send_data(T_bit data, uint8_t size);
kysiki 1:3741bc0fbba8 12 typedef ShiftReg<uint8_t> ShiftReg8;
kysiki 1:3741bc0fbba8 13 typedef ShiftReg<uint16_t> ShiftReg16;
kysiki 1:3741bc0fbba8 14 typedef ShiftReg<uint32_t> ShiftReg32;
kysiki 1:3741bc0fbba8 15
kysiki 0:5f1670338bef 16
kysiki 0:5f1670338bef 17 private:
kysiki 0:5f1670338bef 18 DigitalOut DATA;
kysiki 0:5f1670338bef 19 DigitalOut STB;
kysiki 0:5f1670338bef 20 DigitalOut CLK;
kysiki 0:5f1670338bef 21 DigitalOut CLR;
kysiki 1:3741bc0fbba8 22 void shiftOut(T_bit data, uint8_t size);
kysiki 0:5f1670338bef 23 };
kysiki 0:5f1670338bef 24
kysiki 0:5f1670338bef 25 #endif