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