sl@2: sl@2: #include "MiniDisplay.h" sl@8: #include "FutabaGP1212A01.h" sl@10: #include "FutabaGP1212A02.h" sl@2: sl@2: sl@2: sl@2: //Open & Close functions sl@8: MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType) sl@2: { sl@10: GraphicDisplay* device=NULL; sl@10: sl@10: switch (aType) sl@10: { sl@10: case EMiniDisplayAutoDetect: sl@10: //TODO sl@10: device=new GP1212A01A(); sl@10: break; sl@10: sl@10: case EMiniDisplayFutabaGP1212A01: sl@10: device=new GP1212A01A(); sl@10: break; sl@10: sl@10: case EMiniDisplayFutabaGP1212A02: sl@10: device=new GP1212A02A(); sl@10: break; sl@10: }; sl@10: sl@2: int success = device->Open(); sl@2: if (!success) sl@2: { sl@2: delete device; sl@10: device=NULL; sl@2: } sl@2: sl@2: return device; sl@2: } sl@2: sl@10: // sl@10: sl@2: void MiniDisplayClose(MiniDisplayDevice aDevice) sl@4: { sl@10: delete ((GraphicDisplay*)aDevice); sl@2: } sl@2: sl@2: sl@2: void MiniDisplayClear(MiniDisplayDevice aDevice) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return; sl@2: } sl@2: sl@10: ((GraphicDisplay*)aDevice)->Clear(); sl@2: } sl@2: sl@2: sl@2: void MiniDisplayFill(MiniDisplayDevice aDevice) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return; sl@2: } sl@4: sl@10: ((GraphicDisplay*)aDevice)->Fill(); sl@2: } sl@2: sl@2: sl@2: void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return; sl@2: } sl@4: sl@10: ((GraphicDisplay*)aDevice)->SwapBuffers(); sl@2: } sl@2: sl@2: //------------------------------------------------------------- sl@2: int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return 0; sl@2: } sl@2: sl@10: return ((GraphicDisplay*)aDevice)->MaxBrightness(); sl@2: } sl@2: sl@2: //------------------------------------------------------------- sl@2: int MiniDisplayMinBrightness(MiniDisplayDevice aDevice) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return 0; sl@2: } sl@2: sl@10: return ((GraphicDisplay*)aDevice)->MinBrightness(); sl@2: } sl@2: sl@2: //------------------------------------------------------------- sl@2: void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness) sl@2: { sl@2: if (!aDevice) sl@2: { sl@2: return; sl@2: } sl@2: sl@10: ((GraphicDisplay*)aDevice)->SetBrightness(aBrightness); sl@2: } sl@2: sl@3: //------------------------------------------------------------- sl@3: int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice) sl@3: { sl@3: if (!aDevice) sl@3: { sl@3: return 0; sl@3: } sl@3: sl@10: return ((GraphicDisplay*)aDevice)->WidthInPixels(); sl@3: } sl@3: sl@3: //------------------------------------------------------------- sl@3: int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice) sl@3: { sl@3: if (!aDevice) sl@3: { sl@3: return 0; sl@3: } sl@3: sl@10: return ((GraphicDisplay*)aDevice)->HeightInPixels(); sl@3: } sl@3: sl@3: //------------------------------------------------------------- sl@3: void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, int aValue) sl@3: { sl@3: //aValue&=0x00FFFFFF; //Filter out alpha component sl@10: return ((GraphicDisplay*)aDevice)->SetPixel(aX,aY,aValue); sl@3: } sl@3: sl@4: //------------------------------------------------------------- sl@4: wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice) sl@4: { sl@4: return ((GP1212A01A*)aDevice)->Vendor(); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@4: wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice) sl@4: { sl@4: return ((GP1212A01A*)aDevice)->Product(); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@4: wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice) sl@4: { sl@4: return ((GP1212A01A*)aDevice)->SerialNumber(); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@11: void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest) sl@4: { sl@11: ((GraphicDisplay*)aDevice)->Request(aRequest); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@4: bool MiniDisplayRequestPending(MiniDisplayDevice aDevice) sl@4: { sl@12: return ((GraphicDisplay*)aDevice)->RequestPending(); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@4: TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice) sl@4: { sl@12: return ((GraphicDisplay*)aDevice)->CurrentRequest(); sl@4: } sl@4: sl@4: //------------------------------------------------------------- sl@4: void MiniDisplayCancelRequest(MiniDisplayDevice aDevice) sl@4: { sl@4: ((GP1212A01A*)aDevice)->CancelRequest(); sl@4: } sl@4: sl@5: //------------------------------------------------------------- sl@6: TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice) sl@5: { sl@12: return ((GraphicDisplay*)aDevice)->AttemptRequestCompletion(); sl@5: } sl@5: sl@5: //------------------------------------------------------------- sl@5: char* MiniDisplayDeviceId(MiniDisplayDevice aDevice) sl@5: { sl@12: return ((GraphicDisplay*)aDevice)->DeviceId(); sl@5: } sl@5: sl@5: //------------------------------------------------------------- sl@5: char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice) sl@5: { sl@12: return ((GraphicDisplay*)aDevice)->FirmwareRevision(); sl@6: } sl@6: sl@6: //------------------------------------------------------------- sl@6: bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice) sl@6: { sl@12: return ((GraphicDisplay*)aDevice)->PowerOn(); sl@5: }