author | StephaneLenclud |
Thu, 05 Feb 2015 22:26:15 +0100 | |
changeset 31 | 0a2b658e0d56 |
parent 15 | 105f2c0d3cf1 |
child 35 | 638eb0763e20 |
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 |
StephaneLenclud@25 | 31 |
const unsigned short KTargaVendorId = 0x19C2; |
sl@0 | 32 |
const unsigned short KFutabaVendorId = 0x1008; |
sl@0 | 33 |
const unsigned short KFutabaProductIdGP1212A01A = 0x100C; |
sl@10 | 34 |
const unsigned short KFutabaProductIdGP1212A02A = 0x1015; |
StephaneLenclud@25 | 35 |
const unsigned short KFutabaProductIdMDM166AA = 0x6A11; |
StephaneLenclud@25 | 36 |
|
sl@0 | 37 |
|
sl@0 | 38 |
//typedef struct hid_device_info HidDeviceInfo; |
sl@0 | 39 |
|
sl@0 | 40 |
/** |
sl@0 | 41 |
Define a Futaba HID report. |
sl@0 | 42 |
*/ |
sl@0 | 43 |
class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize> |
sl@0 | 44 |
{ |
sl@0 | 45 |
|
sl@0 | 46 |
private: |
sl@0 | 47 |
|
sl@0 | 48 |
}; |
sl@0 | 49 |
|
sl@0 | 50 |
|
sl@0 | 51 |
/** |
sl@0 | 52 |
Define a generic Futaba VFD command. |
sl@0 | 53 |
*/ |
sl@0 | 54 |
class FutabaVfdCommand |
sl@0 | 55 |
{ |
sl@0 | 56 |
public: |
sl@0 | 57 |
FutabaVfdCommand(); |
sl@0 | 58 |
~FutabaVfdCommand(); |
sl@0 | 59 |
// |
sl@0 | 60 |
//void Create(int aMaxSize); |
sl@0 | 61 |
//void Delete(); |
sl@0 | 62 |
|
sl@0 | 63 |
//inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];} |
sl@0 | 64 |
|
sl@0 | 65 |
void Reset(); |
sl@0 | 66 |
|
sl@0 | 67 |
private: |
sl@0 | 68 |
//unsigned char* iBuffer; |
sl@0 | 69 |
FutabaVfdReport iReports[KFutabaMaxCommandOutputReport]; |
sl@0 | 70 |
int iSize; |
sl@0 | 71 |
int iMaxSize; |
sl@0 | 72 |
}; |
sl@0 | 73 |
|
sl@9 | 74 |
/** |
sl@9 | 75 |
*/ |
sl@15 | 76 |
class FutabaGraphicDisplay : public GraphicDisplay |
sl@9 | 77 |
{ |
sl@9 | 78 |
public: |
sl@9 | 79 |
//From DisplayBase |
sl@9 | 80 |
virtual void Close(); |
sl@9 | 81 |
|
sl@9 | 82 |
}; |
sl@9 | 83 |
|
sl@0 | 84 |
|
sl@0 | 85 |
#endif |