sl@2
|
1 |
|
sl@2
|
2 |
#include "MiniDisplay.h"
|
sl@8
|
3 |
#include "FutabaGP1212A01.h"
|
sl@10
|
4 |
#include "FutabaGP1212A02.h"
|
sl@2
|
5 |
|
sl@2
|
6 |
|
StephaneLenclud@18
|
7 |
MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType, bool aAutoDetect)
|
sl@2
|
8 |
{
|
sl@10
|
9 |
GraphicDisplay* device=NULL;
|
sl@10
|
10 |
|
sl@10
|
11 |
switch (aType)
|
sl@10
|
12 |
{
|
sl@10
|
13 |
case EMiniDisplayAutoDetect:
|
sl@10
|
14 |
case EMiniDisplayFutabaGP1212A01:
|
sl@10
|
15 |
device=new GP1212A01A();
|
sl@10
|
16 |
break;
|
sl@10
|
17 |
|
sl@10
|
18 |
case EMiniDisplayFutabaGP1212A02:
|
sl@10
|
19 |
device=new GP1212A02A();
|
sl@10
|
20 |
break;
|
StephaneLenclud@18
|
21 |
|
StephaneLenclud@18
|
22 |
case EMiniDisplayAutoDetectFailed:
|
StephaneLenclud@18
|
23 |
//Auto detect sequence failed
|
StephaneLenclud@18
|
24 |
return NULL;
|
StephaneLenclud@18
|
25 |
break;
|
sl@10
|
26 |
};
|
sl@10
|
27 |
|
sl@2
|
28 |
int success = device->Open();
|
sl@2
|
29 |
if (!success)
|
sl@2
|
30 |
{
|
sl@2
|
31 |
delete device;
|
sl@10
|
32 |
device=NULL;
|
StephaneLenclud@18
|
33 |
if (aAutoDetect)
|
StephaneLenclud@18
|
34 |
{
|
StephaneLenclud@18
|
35 |
//Go recursive for auto detect
|
StephaneLenclud@18
|
36 |
int typeValue=(int)aType;
|
StephaneLenclud@18
|
37 |
typeValue++;
|
StephaneLenclud@18
|
38 |
TMiniDisplayType nextType=(TMiniDisplayType)typeValue;
|
StephaneLenclud@18
|
39 |
return MiniDisplayOpen(nextType,aAutoDetect);
|
StephaneLenclud@18
|
40 |
}
|
sl@2
|
41 |
}
|
sl@2
|
42 |
|
sl@2
|
43 |
return device;
|
sl@2
|
44 |
}
|
sl@2
|
45 |
|
StephaneLenclud@18
|
46 |
|
StephaneLenclud@18
|
47 |
//Open & Close functions
|
StephaneLenclud@18
|
48 |
MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType)
|
StephaneLenclud@18
|
49 |
{
|
StephaneLenclud@18
|
50 |
bool autoDetect=aType==EMiniDisplayAutoDetect;
|
sl@19
|
51 |
//If we want auto detect we need to pass in our first display type
|
sl@19
|
52 |
//If we don't want auto detect we just pass in the given display type.
|
sl@19
|
53 |
return MiniDisplayOpen((autoDetect?EMiniDisplayFutabaGP1212A01:aType),autoDetect);
|
StephaneLenclud@18
|
54 |
}
|
StephaneLenclud@18
|
55 |
|
StephaneLenclud@18
|
56 |
|
StephaneLenclud@18
|
57 |
|
StephaneLenclud@18
|
58 |
|
sl@10
|
59 |
//
|
sl@10
|
60 |
|
sl@2
|
61 |
void MiniDisplayClose(MiniDisplayDevice aDevice)
|
sl@4
|
62 |
{
|
sl@10
|
63 |
delete ((GraphicDisplay*)aDevice);
|
sl@2
|
64 |
}
|
sl@2
|
65 |
|
sl@2
|
66 |
|
sl@2
|
67 |
void MiniDisplayClear(MiniDisplayDevice aDevice)
|
sl@2
|
68 |
{
|
sl@2
|
69 |
if (!aDevice)
|
sl@2
|
70 |
{
|
sl@2
|
71 |
return;
|
sl@2
|
72 |
}
|
sl@2
|
73 |
|
sl@10
|
74 |
((GraphicDisplay*)aDevice)->Clear();
|
sl@2
|
75 |
}
|
sl@2
|
76 |
|
sl@2
|
77 |
|
sl@2
|
78 |
void MiniDisplayFill(MiniDisplayDevice aDevice)
|
sl@2
|
79 |
{
|
sl@2
|
80 |
if (!aDevice)
|
sl@2
|
81 |
{
|
sl@2
|
82 |
return;
|
sl@2
|
83 |
}
|
sl@4
|
84 |
|
sl@10
|
85 |
((GraphicDisplay*)aDevice)->Fill();
|
sl@2
|
86 |
}
|
sl@2
|
87 |
|
sl@2
|
88 |
|
sl@2
|
89 |
void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice)
|
sl@2
|
90 |
{
|
sl@2
|
91 |
if (!aDevice)
|
sl@2
|
92 |
{
|
sl@2
|
93 |
return;
|
sl@2
|
94 |
}
|
sl@4
|
95 |
|
sl@10
|
96 |
((GraphicDisplay*)aDevice)->SwapBuffers();
|
sl@2
|
97 |
}
|
sl@2
|
98 |
|
sl@2
|
99 |
//-------------------------------------------------------------
|
sl@2
|
100 |
int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice)
|
sl@2
|
101 |
{
|
sl@2
|
102 |
if (!aDevice)
|
sl@2
|
103 |
{
|
sl@2
|
104 |
return 0;
|
sl@2
|
105 |
}
|
sl@2
|
106 |
|
sl@10
|
107 |
return ((GraphicDisplay*)aDevice)->MaxBrightness();
|
sl@2
|
108 |
}
|
sl@2
|
109 |
|
sl@2
|
110 |
//-------------------------------------------------------------
|
sl@2
|
111 |
int MiniDisplayMinBrightness(MiniDisplayDevice aDevice)
|
sl@2
|
112 |
{
|
sl@2
|
113 |
if (!aDevice)
|
sl@2
|
114 |
{
|
sl@2
|
115 |
return 0;
|
sl@2
|
116 |
}
|
sl@2
|
117 |
|
sl@10
|
118 |
return ((GraphicDisplay*)aDevice)->MinBrightness();
|
sl@2
|
119 |
}
|
sl@2
|
120 |
|
sl@2
|
121 |
//-------------------------------------------------------------
|
sl@2
|
122 |
void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness)
|
sl@2
|
123 |
{
|
sl@2
|
124 |
if (!aDevice)
|
sl@2
|
125 |
{
|
sl@2
|
126 |
return;
|
sl@2
|
127 |
}
|
sl@2
|
128 |
|
sl@10
|
129 |
((GraphicDisplay*)aDevice)->SetBrightness(aBrightness);
|
sl@2
|
130 |
}
|
sl@2
|
131 |
|
sl@3
|
132 |
//-------------------------------------------------------------
|
sl@3
|
133 |
int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice)
|
sl@3
|
134 |
{
|
sl@3
|
135 |
if (!aDevice)
|
sl@3
|
136 |
{
|
sl@3
|
137 |
return 0;
|
sl@3
|
138 |
}
|
sl@3
|
139 |
|
sl@10
|
140 |
return ((GraphicDisplay*)aDevice)->WidthInPixels();
|
sl@3
|
141 |
}
|
sl@3
|
142 |
|
sl@3
|
143 |
//-------------------------------------------------------------
|
sl@3
|
144 |
int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice)
|
sl@3
|
145 |
{
|
sl@3
|
146 |
if (!aDevice)
|
sl@3
|
147 |
{
|
sl@3
|
148 |
return 0;
|
sl@3
|
149 |
}
|
sl@3
|
150 |
|
sl@10
|
151 |
return ((GraphicDisplay*)aDevice)->HeightInPixels();
|
sl@3
|
152 |
}
|
sl@3
|
153 |
|
sl@3
|
154 |
//-------------------------------------------------------------
|
sl@22
|
155 |
void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel)
|
sl@3
|
156 |
{
|
sl@3
|
157 |
//aValue&=0x00FFFFFF; //Filter out alpha component
|
sl@22
|
158 |
return ((GraphicDisplay*)aDevice)->SetPixel(aX,aY,aPixel);
|
sl@3
|
159 |
}
|
sl@3
|
160 |
|
sl@4
|
161 |
//-------------------------------------------------------------
|
sl@4
|
162 |
wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice)
|
sl@4
|
163 |
{
|
sl@15
|
164 |
return ((GraphicDisplay*)aDevice)->Vendor();
|
sl@4
|
165 |
}
|
sl@4
|
166 |
|
sl@4
|
167 |
//-------------------------------------------------------------
|
sl@4
|
168 |
wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice)
|
sl@4
|
169 |
{
|
sl@15
|
170 |
return ((GraphicDisplay*)aDevice)->Product();
|
sl@4
|
171 |
}
|
sl@4
|
172 |
|
sl@4
|
173 |
//-------------------------------------------------------------
|
sl@4
|
174 |
wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice)
|
sl@4
|
175 |
{
|
sl@15
|
176 |
return ((GraphicDisplay*)aDevice)->SerialNumber();
|
sl@4
|
177 |
}
|
sl@4
|
178 |
|
sl@4
|
179 |
//-------------------------------------------------------------
|
sl@11
|
180 |
void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest)
|
sl@4
|
181 |
{
|
sl@11
|
182 |
((GraphicDisplay*)aDevice)->Request(aRequest);
|
sl@4
|
183 |
}
|
sl@4
|
184 |
|
sl@4
|
185 |
//-------------------------------------------------------------
|
sl@4
|
186 |
bool MiniDisplayRequestPending(MiniDisplayDevice aDevice)
|
sl@4
|
187 |
{
|
sl@12
|
188 |
return ((GraphicDisplay*)aDevice)->RequestPending();
|
sl@4
|
189 |
}
|
sl@4
|
190 |
|
sl@4
|
191 |
//-------------------------------------------------------------
|
sl@4
|
192 |
TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice)
|
sl@4
|
193 |
{
|
sl@12
|
194 |
return ((GraphicDisplay*)aDevice)->CurrentRequest();
|
sl@4
|
195 |
}
|
sl@4
|
196 |
|
sl@4
|
197 |
//-------------------------------------------------------------
|
sl@4
|
198 |
void MiniDisplayCancelRequest(MiniDisplayDevice aDevice)
|
sl@4
|
199 |
{
|
sl@15
|
200 |
((GraphicDisplay*)aDevice)->CancelRequest();
|
sl@4
|
201 |
}
|
sl@4
|
202 |
|
sl@5
|
203 |
//-------------------------------------------------------------
|
sl@6
|
204 |
TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice)
|
sl@5
|
205 |
{
|
sl@12
|
206 |
return ((GraphicDisplay*)aDevice)->AttemptRequestCompletion();
|
sl@5
|
207 |
}
|
sl@5
|
208 |
|
sl@5
|
209 |
//-------------------------------------------------------------
|
sl@5
|
210 |
char* MiniDisplayDeviceId(MiniDisplayDevice aDevice)
|
sl@5
|
211 |
{
|
sl@12
|
212 |
return ((GraphicDisplay*)aDevice)->DeviceId();
|
sl@5
|
213 |
}
|
sl@5
|
214 |
|
sl@5
|
215 |
//-------------------------------------------------------------
|
sl@5
|
216 |
char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice)
|
sl@5
|
217 |
{
|
sl@12
|
218 |
return ((GraphicDisplay*)aDevice)->FirmwareRevision();
|
sl@6
|
219 |
}
|
sl@6
|
220 |
|
sl@6
|
221 |
//-------------------------------------------------------------
|
sl@6
|
222 |
bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice)
|
sl@6
|
223 |
{
|
sl@16
|
224 |
return ((GraphicDisplay*)aDevice)->IsPowerOn();
|
sl@16
|
225 |
}
|
sl@16
|
226 |
|
sl@16
|
227 |
//-------------------------------------------------------------
|
sl@16
|
228 |
void MiniDisplayPowerOn(MiniDisplayDevice aDevice)
|
sl@16
|
229 |
{
|
sl@16
|
230 |
((GraphicDisplay*)aDevice)->TurnPowerOn();
|
sl@16
|
231 |
}
|
sl@16
|
232 |
|
sl@16
|
233 |
//-------------------------------------------------------------
|
sl@16
|
234 |
void MiniDisplayPowerOff(MiniDisplayDevice aDevice)
|
sl@16
|
235 |
{
|
sl@16
|
236 |
((GraphicDisplay*)aDevice)->TurnPowerOff();
|
sl@16
|
237 |
}
|
sl@16
|
238 |
|
sl@16
|
239 |
//-------------------------------------------------------------
|
sl@16
|
240 |
bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice)
|
sl@16
|
241 |
{
|
sl@16
|
242 |
return ((GraphicDisplay*)aDevice)->SupportPowerOnOff();
|
sl@17
|
243 |
}
|
sl@17
|
244 |
|
sl@17
|
245 |
//-------------------------------------------------------------
|
sl@17
|
246 |
void MiniDisplayShowClock(MiniDisplayDevice aDevice)
|
sl@17
|
247 |
{
|
sl@17
|
248 |
((GraphicDisplay*)aDevice)->ShowClock();
|
sl@17
|
249 |
}
|
sl@17
|
250 |
|
sl@17
|
251 |
//-------------------------------------------------------------
|
sl@17
|
252 |
void MiniDisplayHideClock(MiniDisplayDevice aDevice)
|
sl@17
|
253 |
{
|
sl@17
|
254 |
((GraphicDisplay*)aDevice)->HideClock();
|
sl@17
|
255 |
}
|
sl@17
|
256 |
|
sl@17
|
257 |
//-------------------------------------------------------------
|
sl@17
|
258 |
bool MiniDisplaySupportClock(MiniDisplayDevice aDevice)
|
sl@17
|
259 |
{
|
sl@17
|
260 |
return ((GraphicDisplay*)aDevice)->SupportClock();
|
sl@16
|
261 |
} |