author | sl |
Sun, 31 Aug 2014 18:33:31 +0200 | |
changeset 16 | 42ba42be810d |
parent 10 | 1c3a4964a5bd |
child 25 | 3fa4007c0b19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// |
sl@0 | 2 |
// |
sl@0 | 3 |
// |
sl@0 | 4 |
|
sl@0 | 5 |
#ifndef FUTABA_VFD_H |
sl@0 | 6 |
#define FUTABA_VFD_H |
sl@0 | 7 |
|
sl@0 | 8 |
#include "hidapi.h" |
sl@0 | 9 |
#include "BitArray.h" |
sl@4 | 10 |
#include "MiniDisplay.h" |
sl@9 | 11 |
#include "Display.h" |
sl@0 | 12 |
|
sl@0 | 13 |
#ifndef MIN |
sl@0 | 14 |
#define MIN(a,b) (((a)<(b))?(a):(b)) |
sl@0 | 15 |
#endif |
sl@0 | 16 |
|
sl@0 | 17 |
#ifndef MAX |
sl@0 | 18 |
#define MAX(a,b) (((a)>(b))?(a):(b)) |
sl@0 | 19 |
#endif |
sl@0 | 20 |
|
sl@0 | 21 |
|
sl@0 | 22 |
//This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33 |
sl@0 | 23 |
//+1 was added for our header |
sl@0 | 24 |
const int KFutabaMaxCommandOutputReport = 33; |
sl@0 | 25 |
//TODO: Get ride of that constant once we figure out a way to get it from hidapi |
sl@0 | 26 |
const int KFutabaMaxHidReportSize = 65; |
sl@0 | 27 |
|
sl@0 | 28 |
const int KHidReportIdIndex=0; |
sl@0 | 29 |
const int KFutabaHidReportSizeIndex=1; |
sl@0 | 30 |
//Define Futaba vendor ID to filter our list of device |
sl@0 | 31 |
const unsigned short KFutabaVendorId = 0x1008; |
sl@0 | 32 |
const unsigned short KFutabaProductIdGP1212A01A = 0x100C; |
sl@10 | 33 |
const unsigned short KFutabaProductIdGP1212A02A = 0x1015; |
sl@0 | 34 |
|
sl@0 | 35 |
//typedef struct hid_device_info HidDeviceInfo; |
sl@0 | 36 |
|
sl@0 | 37 |
/** |
sl@0 | 38 |
Define a Futaba HID report. |
sl@0 | 39 |
*/ |
sl@0 | 40 |
class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize> |
sl@0 | 41 |
{ |
sl@0 | 42 |
|
sl@0 | 43 |
private: |
sl@0 | 44 |
|
sl@0 | 45 |
}; |
sl@0 | 46 |
|
sl@0 | 47 |
|
sl@0 | 48 |
/** |
sl@0 | 49 |
Define a generic Futaba VFD command. |
sl@0 | 50 |
*/ |
sl@0 | 51 |
class FutabaVfdCommand |
sl@0 | 52 |
{ |
sl@0 | 53 |
public: |
sl@0 | 54 |
FutabaVfdCommand(); |
sl@0 | 55 |
~FutabaVfdCommand(); |
sl@0 | 56 |
// |
sl@0 | 57 |
//void Create(int aMaxSize); |
sl@0 | 58 |
//void Delete(); |
sl@0 | 59 |
|
sl@0 | 60 |
//inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];} |
sl@0 | 61 |
|
sl@0 | 62 |
void Reset(); |
sl@0 | 63 |
|
sl@0 | 64 |
private: |
sl@0 | 65 |
//unsigned char* iBuffer; |
sl@0 | 66 |
FutabaVfdReport iReports[KFutabaMaxCommandOutputReport]; |
sl@0 | 67 |
int iSize; |
sl@0 | 68 |
int iMaxSize; |
sl@0 | 69 |
}; |
sl@0 | 70 |
|
sl@9 | 71 |
/** |
sl@9 | 72 |
*/ |
sl@15 | 73 |
class FutabaGraphicDisplay : public GraphicDisplay |
sl@9 | 74 |
{ |
sl@9 | 75 |
public: |
sl@9 | 76 |
//From DisplayBase |
sl@9 | 77 |
virtual void Close(); |
sl@9 | 78 |
|
sl@9 | 79 |
}; |
sl@9 | 80 |
|
sl@0 | 81 |
|
sl@0 | 82 |
#endif |