Fixing our multiple report pixel transfer.
Implementing support for off screen mode which is now the default.
On screen mode is there for debug pruposes.
12 #define MIN(a,b) (((a)<(b))?(a):(b))
16 #define MAX(a,b) (((a)>(b))?(a):(b))
20 //This was computed from our number of pixels as follow 256x64/8/64 = 32 + 1 = 33
21 //+1 was added for our header
22 const int KFutabaMaxCommandOutputReport = 33;
23 //TODO: Get ride of that constant once we figure out a way to get it from hidapi
24 const int KFutabaMaxHidReportSize = 65;
26 const int KHidReportIdIndex=0;
27 const int KFutabaHidReportSizeIndex=1;
28 //Define Futaba vendor ID to filter our list of device
29 const unsigned short KFutabaVendorId = 0x1008;
30 const unsigned short KFutabaProductIdGP1212A01A = 0x100C;
31 const unsigned short KFutabaProductIdGP1212A02A = 0x1013; //Or is it 0x1015
33 //typedef struct hid_device_info HidDeviceInfo;
36 Define a Futaba HID report.
38 class FutabaVfdReport: public HidReport<KFutabaMaxHidReportSize>
47 Define a generic Futaba VFD command.
49 class FutabaVfdCommand
55 //void Create(int aMaxSize);
58 //inline unsigned char& operator[](int aIndex){return iBuffer[aIndex];}
63 //unsigned char* iBuffer;
64 FutabaVfdReport iReports[KFutabaMaxCommandOutputReport];
71 class FutabaVfd : public HidDevice
74 virtual int MinBrightness() const=0;
75 virtual int MaxBrightness() const=0;
76 virtual void SetBrightness(int aBrightness)=0;
77 virtual void Clear()=0;
83 class FutabaGraphicVfd : public FutabaVfd
86 virtual int WidthInPixels() const=0;
87 virtual int HeightInPixels() const=0;
88 virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn)=0;
89 virtual void SetAllPixels(unsigned char aOn)=0;
90 virtual int FrameBufferSizeInBytes() const=0;
94 Common functionality between GP1212A01A and GP1212A02A
96 class GP1212XXXX : public FutabaGraphicVfd
100 virtual int MinBrightness() const {return 0;};
101 virtual int MaxBrightness() const {return 5;};
105 GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
106 The module do not include character ROM, the customer will compile the character
107 by themselves (from main system).
109 class GP1212A01A : public GP1212XXXX
115 //From FutabaGraphicVfd
116 virtual int WidthInPixels() const {return 256;};
117 virtual int HeightInPixels() const {return 64;};
118 virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
119 virtual void SetAllPixels(unsigned char aPattern);
120 virtual int FrameBufferSizeInBytes() const {return 2048;}; //256*64/8
122 virtual void SetBrightness(int aBrightness);
123 virtual void Clear();
125 //Specific to GP1212A01A
126 void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
127 void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
129 void SetDisplayPosition(unsigned char aX, unsigned char aY);
133 void RequestFirmwareRevision();
134 void RequestPowerSupplyStatus();
136 void ToggleOffScreenMode();
137 bool OffScreenMode() const {return iOffScreenMode;};
146 void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
147 unsigned char OffScreenY() const;
148 void SendClearCommand();
149 void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
152 unsigned char iDisplayPositionX;
153 unsigned char iDisplayPositionY;
154 ///Off screen mode is the recommended default settings to avoid tearing.
155 ///Though turning it off can be useful for debugging
158 //FutabaVfdReport iReport;
160 //unsigned char iPixelBuffer[256][128];