author | sl |
Fri, 29 Aug 2014 22:32:13 +0200 | |
changeset 13 | 70907579a3b6 |
parent 11 | 2d749a2bea34 |
child 15 | 105f2c0d3cf1 |
permissions | -rw-r--r-- |
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 |
|
sl@2 | 7 |
|
sl@2 | 8 |
//Open & Close functions |
sl@8 | 9 |
MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType) |
sl@2 | 10 |
{ |
sl@10 | 11 |
GraphicDisplay* device=NULL; |
sl@10 | 12 |
|
sl@10 | 13 |
switch (aType) |
sl@10 | 14 |
{ |
sl@10 | 15 |
case EMiniDisplayAutoDetect: |
sl@10 | 16 |
//TODO |
sl@10 | 17 |
device=new GP1212A01A(); |
sl@10 | 18 |
break; |
sl@10 | 19 |
|
sl@10 | 20 |
case EMiniDisplayFutabaGP1212A01: |
sl@10 | 21 |
device=new GP1212A01A(); |
sl@10 | 22 |
break; |
sl@10 | 23 |
|
sl@10 | 24 |
case EMiniDisplayFutabaGP1212A02: |
sl@10 | 25 |
device=new GP1212A02A(); |
sl@10 | 26 |
break; |
sl@10 | 27 |
}; |
sl@10 | 28 |
|
sl@2 | 29 |
int success = device->Open(); |
sl@2 | 30 |
if (!success) |
sl@2 | 31 |
{ |
sl@2 | 32 |
delete device; |
sl@10 | 33 |
device=NULL; |
sl@2 | 34 |
} |
sl@2 | 35 |
|
sl@2 | 36 |
return device; |
sl@2 | 37 |
} |
sl@2 | 38 |
|
sl@10 | 39 |
// |
sl@10 | 40 |
|
sl@2 | 41 |
void MiniDisplayClose(MiniDisplayDevice aDevice) |
sl@4 | 42 |
{ |
sl@10 | 43 |
delete ((GraphicDisplay*)aDevice); |
sl@2 | 44 |
} |
sl@2 | 45 |
|
sl@2 | 46 |
|
sl@2 | 47 |
void MiniDisplayClear(MiniDisplayDevice aDevice) |
sl@2 | 48 |
{ |
sl@2 | 49 |
if (!aDevice) |
sl@2 | 50 |
{ |
sl@2 | 51 |
return; |
sl@2 | 52 |
} |
sl@2 | 53 |
|
sl@10 | 54 |
((GraphicDisplay*)aDevice)->Clear(); |
sl@2 | 55 |
} |
sl@2 | 56 |
|
sl@2 | 57 |
|
sl@2 | 58 |
void MiniDisplayFill(MiniDisplayDevice aDevice) |
sl@2 | 59 |
{ |
sl@2 | 60 |
if (!aDevice) |
sl@2 | 61 |
{ |
sl@2 | 62 |
return; |
sl@2 | 63 |
} |
sl@4 | 64 |
|
sl@10 | 65 |
((GraphicDisplay*)aDevice)->Fill(); |
sl@2 | 66 |
} |
sl@2 | 67 |
|
sl@2 | 68 |
|
sl@2 | 69 |
void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice) |
sl@2 | 70 |
{ |
sl@2 | 71 |
if (!aDevice) |
sl@2 | 72 |
{ |
sl@2 | 73 |
return; |
sl@2 | 74 |
} |
sl@4 | 75 |
|
sl@10 | 76 |
((GraphicDisplay*)aDevice)->SwapBuffers(); |
sl@2 | 77 |
} |
sl@2 | 78 |
|
sl@2 | 79 |
//------------------------------------------------------------- |
sl@2 | 80 |
int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice) |
sl@2 | 81 |
{ |
sl@2 | 82 |
if (!aDevice) |
sl@2 | 83 |
{ |
sl@2 | 84 |
return 0; |
sl@2 | 85 |
} |
sl@2 | 86 |
|
sl@10 | 87 |
return ((GraphicDisplay*)aDevice)->MaxBrightness(); |
sl@2 | 88 |
} |
sl@2 | 89 |
|
sl@2 | 90 |
//------------------------------------------------------------- |
sl@2 | 91 |
int MiniDisplayMinBrightness(MiniDisplayDevice aDevice) |
sl@2 | 92 |
{ |
sl@2 | 93 |
if (!aDevice) |
sl@2 | 94 |
{ |
sl@2 | 95 |
return 0; |
sl@2 | 96 |
} |
sl@2 | 97 |
|
sl@10 | 98 |
return ((GraphicDisplay*)aDevice)->MinBrightness(); |
sl@2 | 99 |
} |
sl@2 | 100 |
|
sl@2 | 101 |
//------------------------------------------------------------- |
sl@2 | 102 |
void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness) |
sl@2 | 103 |
{ |
sl@2 | 104 |
if (!aDevice) |
sl@2 | 105 |
{ |
sl@2 | 106 |
return; |
sl@2 | 107 |
} |
sl@2 | 108 |
|
sl@10 | 109 |
((GraphicDisplay*)aDevice)->SetBrightness(aBrightness); |
sl@2 | 110 |
} |
sl@2 | 111 |
|
sl@3 | 112 |
//------------------------------------------------------------- |
sl@3 | 113 |
int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice) |
sl@3 | 114 |
{ |
sl@3 | 115 |
if (!aDevice) |
sl@3 | 116 |
{ |
sl@3 | 117 |
return 0; |
sl@3 | 118 |
} |
sl@3 | 119 |
|
sl@10 | 120 |
return ((GraphicDisplay*)aDevice)->WidthInPixels(); |
sl@3 | 121 |
} |
sl@3 | 122 |
|
sl@3 | 123 |
//------------------------------------------------------------- |
sl@3 | 124 |
int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice) |
sl@3 | 125 |
{ |
sl@3 | 126 |
if (!aDevice) |
sl@3 | 127 |
{ |
sl@3 | 128 |
return 0; |
sl@3 | 129 |
} |
sl@3 | 130 |
|
sl@10 | 131 |
return ((GraphicDisplay*)aDevice)->HeightInPixels(); |
sl@3 | 132 |
} |
sl@3 | 133 |
|
sl@3 | 134 |
//------------------------------------------------------------- |
sl@3 | 135 |
void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, int aValue) |
sl@3 | 136 |
{ |
sl@3 | 137 |
//aValue&=0x00FFFFFF; //Filter out alpha component |
sl@10 | 138 |
return ((GraphicDisplay*)aDevice)->SetPixel(aX,aY,aValue); |
sl@3 | 139 |
} |
sl@3 | 140 |
|
sl@4 | 141 |
//------------------------------------------------------------- |
sl@4 | 142 |
wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice) |
sl@4 | 143 |
{ |
sl@4 | 144 |
return ((GP1212A01A*)aDevice)->Vendor(); |
sl@4 | 145 |
} |
sl@4 | 146 |
|
sl@4 | 147 |
//------------------------------------------------------------- |
sl@4 | 148 |
wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice) |
sl@4 | 149 |
{ |
sl@4 | 150 |
return ((GP1212A01A*)aDevice)->Product(); |
sl@4 | 151 |
} |
sl@4 | 152 |
|
sl@4 | 153 |
//------------------------------------------------------------- |
sl@4 | 154 |
wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice) |
sl@4 | 155 |
{ |
sl@4 | 156 |
return ((GP1212A01A*)aDevice)->SerialNumber(); |
sl@4 | 157 |
} |
sl@4 | 158 |
|
sl@4 | 159 |
//------------------------------------------------------------- |
sl@11 | 160 |
void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest) |
sl@4 | 161 |
{ |
sl@11 | 162 |
((GraphicDisplay*)aDevice)->Request(aRequest); |
sl@4 | 163 |
} |
sl@4 | 164 |
|
sl@4 | 165 |
//------------------------------------------------------------- |
sl@4 | 166 |
bool MiniDisplayRequestPending(MiniDisplayDevice aDevice) |
sl@4 | 167 |
{ |
sl@12 | 168 |
return ((GraphicDisplay*)aDevice)->RequestPending(); |
sl@4 | 169 |
} |
sl@4 | 170 |
|
sl@4 | 171 |
//------------------------------------------------------------- |
sl@4 | 172 |
TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice) |
sl@4 | 173 |
{ |
sl@12 | 174 |
return ((GraphicDisplay*)aDevice)->CurrentRequest(); |
sl@4 | 175 |
} |
sl@4 | 176 |
|
sl@4 | 177 |
//------------------------------------------------------------- |
sl@4 | 178 |
void MiniDisplayCancelRequest(MiniDisplayDevice aDevice) |
sl@4 | 179 |
{ |
sl@4 | 180 |
((GP1212A01A*)aDevice)->CancelRequest(); |
sl@4 | 181 |
} |
sl@4 | 182 |
|
sl@5 | 183 |
//------------------------------------------------------------- |
sl@6 | 184 |
TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice) |
sl@5 | 185 |
{ |
sl@12 | 186 |
return ((GraphicDisplay*)aDevice)->AttemptRequestCompletion(); |
sl@5 | 187 |
} |
sl@5 | 188 |
|
sl@5 | 189 |
//------------------------------------------------------------- |
sl@5 | 190 |
char* MiniDisplayDeviceId(MiniDisplayDevice aDevice) |
sl@5 | 191 |
{ |
sl@12 | 192 |
return ((GraphicDisplay*)aDevice)->DeviceId(); |
sl@5 | 193 |
} |
sl@5 | 194 |
|
sl@5 | 195 |
//------------------------------------------------------------- |
sl@5 | 196 |
char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice) |
sl@5 | 197 |
{ |
sl@12 | 198 |
return ((GraphicDisplay*)aDevice)->FirmwareRevision(); |
sl@6 | 199 |
} |
sl@6 | 200 |
|
sl@6 | 201 |
//------------------------------------------------------------- |
sl@6 | 202 |
bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice) |
sl@6 | 203 |
{ |
sl@12 | 204 |
return ((GraphicDisplay*)aDevice)->PowerOn(); |
sl@5 | 205 |
} |