Moving base HID classes into separate files.
19 FutabaVfdCommand::FutabaVfdCommand():/*iBuffer(NULL),*/iSize(0),iMaxSize(0)
23 FutabaVfdCommand::~FutabaVfdCommand()
32 void FutabaVfdCommand::Reset()
34 memset(iReports,0,sizeof(iReports));
43 void FutabaVfdCommand::Create(int aMaxSize)
45 iBuffer=new unsigned char[aMaxSize];
58 void FutabaVfdCommand::Delete()
74 int GP1212A01A::Open()
76 int success = HidDevice::Open(KFutabaVendorId,KFutabaProductIdGP1212A01A,NULL);
86 void GP1212A01A::SetPixel(int aX, int aY, bool aOn)
88 //Just specify a one pixel block
89 SetPixelBlock(aX,aY,0x00,0x01,aOn);
94 void GP1212A01A::SetAllPixels(bool aOn)
98 for (int i=0;i<256;i++)
100 for (int j=0;j<64;j++)
107 //16x16=256 pixels at a time goes much faster
108 //TODO: use even larger blocks
109 for (int i=0;i<256;i+=16)
111 for (int j=0;j<64;j+=16)
113 SetPixelBlock(i,j,15,32,(aOn?0xFF:0x00));
114 //FXThread::sleep(1000000000);
122 void GP1212A01A::SetBrightness(int aBrightness)
127 Set the defined pixel block to the given value.
128 @param X coordinate of our pixel block starting point.
129 @param Y coordinate of our pixel block starting point.
130 @param The height of our pixel block.
131 @param The size of our pixel data. Number of pixels divided by 8.
132 @param The value set to 8 pixels.
134 void GP1212A01A::SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char aValue)
136 //Size must be 63 or below
137 FutabaVfdReport report;
138 report[0]=0x00; //Report ID
139 report[1]=0x08+aSize; //Report length
145 report[7]=aHeight; //Y length before return. Though outside the specs, setting this to zero apparently allows us to modify a single pixel without touching any other.
146 report[8]=0x00; //Size of pixel data in bytes (MSB)
147 report[9]=aSize; //Size of pixel data in bytes (LSB)
148 memset(report.Buffer()+10, aValue, aSize);
149 //iOutputReportBuffer[10]=aValue; //Pixel data
156 void GP1212A01A::Clear()
158 FutabaVfdReport report;
159 report[0]=0x00; //Report ID
160 report[1]=0x04; //Report length