diff -r 69f1fcfdf6a5 -r 4a5538e0ccbf inc/FutabaVfd.h --- a/inc/FutabaVfd.h Thu May 22 07:30:05 2014 +0200 +++ b/inc/FutabaVfd.h Thu May 22 07:50:02 2014 +0200 @@ -4,6 +4,7 @@ #define FUTABA_VFD_H #include "hidapi.h" +#include "HidDevice.h" //This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33 //+1 was added for our header @@ -21,61 +22,6 @@ //typedef struct hid_device_info HidDeviceInfo; -/** -TODO: move to another header -*/ -template -class HidReport - { -public: - HidReport(){Reset();}; - void Reset(); - inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];} - const unsigned char* Buffer() const {return iBuffer;}; - unsigned char* Buffer() {return iBuffer;}; -protected: - unsigned char iBuffer[S]; - }; - -template -void HidReport::Reset() - { - memset(iBuffer,0,sizeof(iBuffer)); - } - -/** -TODO: move to another header -*/ -class HidDevice - { -public: - int Open(const char* aPath); - int Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber); - void Close(); - bool IsOpen(); - // - int SetNonBlocking(int aNonBlocking); - // - template - int Write(const HidReport& aOutputReport); - // - const wchar_t* Error(); - - - -private: - ///Our USB HID device - hid_device* iHidDevice; - }; - - -/** -*/ -template -int HidDevice::Write(const HidReport& aOutputReport) - { - return hid_write(iHidDevice,aOutputReport.Buffer(),S); - } /**