sl@8
|
1 |
//
|
sl@8
|
2 |
//
|
sl@8
|
3 |
//
|
sl@8
|
4 |
|
sl@8
|
5 |
#ifndef FUTABA_GP1212A02_H
|
sl@8
|
6 |
#define FUTABA_GP1212A02_H
|
sl@8
|
7 |
|
sl@8
|
8 |
#include "FutabaGP1212.h"
|
sl@10
|
9 |
#include "FutabaVfd.h"
|
sl@10
|
10 |
|
sl@10
|
11 |
/**
|
StephaneLenclud@25
|
12 |
GP1212A02A is a graphic display module using a FUTABA 256x64dots VFD.
|
StephaneLenclud@25
|
13 |
The module will support the interface of I2C, RS-232C and USB2.0 communications.
|
StephaneLenclud@25
|
14 |
The module include flash ROM (4Mbyte), the customer will definable the BMP data and download
|
StephaneLenclud@25
|
15 |
character.
|
StephaneLenclud@25
|
16 |
It realizes displaying a Japanese font (refer to Table-24) and BMP by I2C, RS-232C or USB2.0
|
StephaneLenclud@25
|
17 |
communications. Other font tables (ex. Chinese, Korean, European and custom font) can be appended to
|
StephaneLenclud@25
|
18 |
flash ROM.
|
StephaneLenclud@25
|
19 |
Since a DC/DC converter is included, 5V power source is required to operate the module.
|
sl@10
|
20 |
*/
|
sl@10
|
21 |
class GP1212A02A : public GP1212XXXX
|
sl@10
|
22 |
{
|
sl@10
|
23 |
public:
|
sl@10
|
24 |
|
sl@10
|
25 |
GP1212A02A();
|
sl@10
|
26 |
~GP1212A02A();
|
sl@10
|
27 |
|
sl@10
|
28 |
//From DisplayBase
|
StephaneLenclud@29
|
29 |
virtual int Open();
|
sl@10
|
30 |
virtual void SwapBuffers();
|
sl@16
|
31 |
virtual void TurnPowerOn();
|
sl@16
|
32 |
virtual void TurnPowerOff();
|
sl@17
|
33 |
virtual bool SupportPowerOnOff(){return true;}
|
sl@17
|
34 |
virtual void ShowClock();
|
sl@17
|
35 |
virtual void HideClock();
|
sl@17
|
36 |
virtual bool SupportClock(){return true;}
|
StephaneLenclud@29
|
37 |
virtual void SetBrightness(int aBrightness);
|
StephaneLenclud@29
|
38 |
virtual void Clear();
|
StephaneLenclud@29
|
39 |
virtual void Fill();
|
StephaneLenclud@29
|
40 |
virtual TMiniDisplayRequest AttemptRequestCompletion();
|
StephaneLenclud@29
|
41 |
virtual void Request(TMiniDisplayRequest aRequest);
|
sl@17
|
42 |
|
sl@16
|
43 |
|
sl@10
|
44 |
|
sl@10
|
45 |
//From GraphicDisplay
|
sl@22
|
46 |
virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
|
sl@10
|
47 |
virtual void SetAllPixels(unsigned char aPattern);
|
sl@10
|
48 |
virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
|
StephaneLenclud@29
|
49 |
|
sl@10
|
50 |
|
sl@15
|
51 |
|
sl@10
|
52 |
//
|
sl@10
|
53 |
void ToggleOffScreenMode();
|
sl@10
|
54 |
void SetOffScreenMode(bool aOn);
|
sl@10
|
55 |
bool OffScreenMode() const {return iOffScreenMode;}
|
sl@10
|
56 |
//
|
sl@10
|
57 |
void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
|
sl@10
|
58 |
bool FrameDifferencing() const {return iUseFrameDifferencing;}
|
sl@10
|
59 |
FutabaVfdReport& InputReport() {return iInputReport;}
|
sl@10
|
60 |
|
sl@17
|
61 |
private:
|
sl@17
|
62 |
|
sl@14
|
63 |
enum TBmpBoxId
|
sl@14
|
64 |
{
|
sl@14
|
65 |
EBmpBoxIdNull=0x30,
|
sl@14
|
66 |
EBmpBoxIdOne=0x31,
|
sl@14
|
67 |
EBmpBoxIdTwo=0x32,
|
sl@14
|
68 |
EBmpBoxIdThree=0x33
|
sl@14
|
69 |
};
|
sl@14
|
70 |
|
sl@14
|
71 |
enum TTarget
|
sl@14
|
72 |
{
|
sl@14
|
73 |
ETargetDisplayWindow=0x30,
|
sl@14
|
74 |
ETargetDataMemory=0x31
|
sl@14
|
75 |
};
|
sl@14
|
76 |
|
sl@14
|
77 |
enum TDirection
|
sl@14
|
78 |
{
|
sl@14
|
79 |
EDirectionY=0x30,
|
sl@14
|
80 |
EDirectionX=0x31
|
sl@14
|
81 |
};
|
sl@14
|
82 |
|
sl@16
|
83 |
enum TPowerStatus
|
sl@16
|
84 |
{
|
sl@16
|
85 |
EPowerOff=0x30,
|
sl@16
|
86 |
EPowerOn=0x31
|
sl@16
|
87 |
};
|
sl@14
|
88 |
|
sl@17
|
89 |
enum TWeekDay
|
sl@17
|
90 |
{
|
sl@17
|
91 |
ESunday = 0x00,
|
sl@17
|
92 |
EMonday = 0x01,
|
sl@17
|
93 |
ETuesday = 0x02,
|
sl@17
|
94 |
EWednesday = 0x03,
|
sl@17
|
95 |
EThrusday = 0x04,
|
sl@17
|
96 |
EFriday = 0x05,
|
sl@17
|
97 |
ESaturday = 0x06
|
sl@17
|
98 |
};
|
sl@17
|
99 |
|
sl@17
|
100 |
enum TClockFormat
|
sl@17
|
101 |
{
|
sl@17
|
102 |
EClock24 = 0x00,
|
sl@17
|
103 |
EClockDay24 = 0x01,
|
sl@17
|
104 |
EClock12 = 0x10,
|
sl@17
|
105 |
EClockDay12 = 0x11
|
sl@17
|
106 |
};
|
sl@17
|
107 |
|
sl@21
|
108 |
enum TFontSizeLogical
|
sl@17
|
109 |
{
|
sl@21
|
110 |
EFontTiny = 0x30,
|
sl@21
|
111 |
EFontSmall = 0x31,
|
sl@21
|
112 |
EFontMedium = 0x32,
|
sl@21
|
113 |
EFontLarge = 0x33
|
sl@17
|
114 |
};
|
sl@17
|
115 |
|
sl@20
|
116 |
enum TFontSize
|
sl@20
|
117 |
{
|
sl@20
|
118 |
EFont6x8 = 0x30,
|
sl@20
|
119 |
EFont8x16 = 0x31,
|
sl@20
|
120 |
EFont12x24 = 0x32,
|
sl@20
|
121 |
EFont16x32 = 0x33,
|
sl@20
|
122 |
EFont16x16 = 0x34,
|
sl@20
|
123 |
EFont24x24 = 0x35,
|
sl@20
|
124 |
EFont32x32 = 0x36
|
sl@20
|
125 |
};
|
sl@20
|
126 |
|
sl@20
|
127 |
enum TFontAction
|
sl@20
|
128 |
{
|
sl@20
|
129 |
EFontStore = 0x30,
|
sl@20
|
130 |
EFontTransfer = 0x31,
|
sl@20
|
131 |
EFontDelete = 0x32
|
sl@20
|
132 |
};
|
sl@20
|
133 |
|
sl@17
|
134 |
|
sl@15
|
135 |
private:
|
sl@15
|
136 |
//Specific to GP1212A02A
|
sl@14
|
137 |
//General setting command
|
sl@17
|
138 |
void SendCommandClear();
|
sl@20
|
139 |
void SendCommandReset();
|
sl@17
|
140 |
//
|
sl@14
|
141 |
void BmpDataInput(TTarget aTarget, unsigned short aAddress, TDirection aDirection, unsigned short aSize, unsigned char* aPixels);
|
sl@17
|
142 |
//
|
sl@17
|
143 |
void SendCommandPower(TPowerStatus aPowerStatus);
|
sl@17
|
144 |
//Clock commands
|
sl@17
|
145 |
void SendCommandClockSetting(TWeekDay aWeekDay, unsigned char aHour, unsigned char aMinute);
|
sl@21
|
146 |
void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize);
|
sl@17
|
147 |
void SendCommandClockCancel();
|
sl@20
|
148 |
//Font commands
|
sl@20
|
149 |
void SendCommandDefineCharacter(TFontSize aFontSize, unsigned short aCharacterCode, unsigned char* aPixelData);
|
sl@20
|
150 |
void SendCommandFontAction(TFontAction aFontAction);
|
sl@21
|
151 |
void SendCommandSelectFontSize(TFontSizeLogical aFontSoze);
|
sl@17
|
152 |
|
sl@14
|
153 |
|
sl@14
|
154 |
//BMP box
|
sl@14
|
155 |
void BmpBoxSetting(TBmpBoxId aBoxId, unsigned short aAddress, int aWidth, int aHeight);
|
sl@14
|
156 |
void BmpBoxSelect(TBmpBoxId aBoxId);
|
sl@14
|
157 |
void BmpBoxDataMemoryTransfer(unsigned short aAddress);
|
sl@14
|
158 |
void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels);
|
sl@17
|
159 |
|
sl@17
|
160 |
//Clock utilities
|
sl@17
|
161 |
int ClockCharCount(TClockFormat aFormat);
|
sl@21
|
162 |
int ClockCharWidthInPixels(TFontSizeLogical aSize);
|
sl@21
|
163 |
int ClockCharHeightInPixels(TFontSizeLogical aSize);
|
sl@21
|
164 |
unsigned short ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize);
|
sl@20
|
165 |
//Font utilities
|
sl@20
|
166 |
int CharacterSizeInBytes(TFontSize aFontSize);
|
sl@14
|
167 |
|
sl@10
|
168 |
private:
|
sl@15
|
169 |
void RequestDeviceId();
|
sl@15
|
170 |
void RequestFirmwareRevision();
|
sl@15
|
171 |
void RequestPowerSupplyStatus();
|
sl@17
|
172 |
//
|
sl@17
|
173 |
void SetClockSetting();
|
sl@15
|
174 |
|
sl@15
|
175 |
|
sl@15
|
176 |
private:
|
sl@17
|
177 |
unsigned char OffScreenY() const;
|
sl@10
|
178 |
void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
|
sl@10
|
179 |
void ResetBuffers();
|
sl@10
|
180 |
|
sl@10
|
181 |
private:
|
sl@10
|
182 |
unsigned char iDisplayPositionX;
|
sl@10
|
183 |
unsigned char iDisplayPositionY;
|
sl@10
|
184 |
///Off screen mode is the recommended default settings to avoid tearing.
|
sl@10
|
185 |
///Though turning it off can be useful for debugging
|
sl@10
|
186 |
bool iOffScreenMode;
|
sl@10
|
187 |
///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
|
sl@10
|
188 |
bool iUseFrameDifferencing;
|
sl@10
|
189 |
///
|
sl@10
|
190 |
//FutabaVfdReport iReport;
|
sl@10
|
191 |
///
|
sl@10
|
192 |
//unsigned char iFrameBuffer[256*64];
|
sl@13
|
193 |
BitArrayLow* iFrameNext;
|
sl@13
|
194 |
BitArrayLow* iFrameCurrent;
|
sl@13
|
195 |
BitArrayLow* iFramePrevious;
|
sl@10
|
196 |
//
|
sl@13
|
197 |
BitArrayLow* iFrameAlpha;
|
sl@13
|
198 |
BitArrayLow* iFrameBeta;
|
sl@13
|
199 |
BitArrayLow* iFrameGamma;
|
sl@10
|
200 |
//
|
sl@10
|
201 |
int iNeedFullFrameUpdate;
|
StephaneLenclud@29
|
202 |
//
|
sl@10
|
203 |
FutabaVfdReport iInputReport;
|
sl@10
|
204 |
//
|
sl@15
|
205 |
unsigned short iNextFrameAddress;
|
sl@10
|
206 |
};
|
sl@10
|
207 |
|
sl@8
|
208 |
|
sl@8
|
209 |
|
sl@8
|
210 |
#endif
|