Implementing Futaba GP1212A01A brightness support.
Test application now using Futaba class to send some of our commands.
1.1 --- a/inc/MainWindow.h Thu May 22 09:12:31 2014 +0200
1.2 +++ b/inc/MainWindow.h Thu May 22 09:31:23 2014 +0200
1.3 @@ -116,7 +116,7 @@
1.4 FXButton *iButtonSelectFont;
1.5
1.6 unsigned char* iOutputReportBuffer;
1.7 - unsigned char iDimming; //Current VFD dimming
1.8 + unsigned char iBrightness; //Current VFD dimming
1.9 FXFontDesc iCurrentFontDesc;
1.10 FXFont* iCurrentFont;
1.11 FXTGAImage* iFontImage;
2.1 --- a/src/FutabaVfd.cpp Thu May 22 09:12:31 2014 +0200
2.2 +++ b/src/FutabaVfd.cpp Thu May 22 09:31:23 2014 +0200
2.3 @@ -120,7 +120,25 @@
2.4 /**
2.5 */
2.6 void GP1212A01A::SetBrightness(int aBrightness)
2.7 - {
2.8 + {
2.9 + if (aBrightness<MinBrightness()||aBrightness>MaxBrightness())
2.10 + {
2.11 + //Brightness out of range.
2.12 + //Just ignore that request.
2.13 + return;
2.14 + }
2.15 +
2.16 + FutabaVfdReport report;
2.17 + report[0]=0x00; //Report ID
2.18 + report[1]=0x06; //Report size
2.19 + report[2]=0x1B; //Command ID
2.20 + report[3]=0x5C; //Command ID
2.21 + report[4]=0x3F; //Command ID
2.22 + report[5]=0x4C; //Command ID
2.23 + report[6]=0x44; //Command ID
2.24 + report[7]=0x30+aBrightness; //Brightness level
2.25 + Write(report);
2.26 +
2.27 }
2.28
2.29 /**
3.1 --- a/src/test.cpp Thu May 22 09:12:31 2014 +0200
3.2 +++ b/src/test.cpp Thu May 22 09:31:23 2014 +0200
3.3 @@ -55,7 +55,7 @@
3.4 iCurrentFont(NULL),
3.5 iFontImage(NULL)
3.6 {
3.7 - iDimming=0x35;
3.8 + iBrightness=iVfd01.MaxBrightness();
3.9 devices = NULL;
3.10 connected_device = NULL;
3.11
3.12 @@ -538,6 +538,7 @@
3.13 long
3.14 MainWindow::onFutabaClearDisplay(FXObject *sender, FXSelector sel, void *ptr)
3.15 {
3.16 + /*
3.17 memset(iOutputReportBuffer, 0x0, KFutabaMaxHidReportSize);
3.18 iOutputReportBuffer[0]=0x00; //Report ID
3.19 iOutputReportBuffer[1]=0x04; //Report length
3.20 @@ -546,6 +547,8 @@
3.21 iOutputReportBuffer[4]=0x32; //
3.22 iOutputReportBuffer[5]=0x4A; //
3.23 int res = hid_write(connected_device, iOutputReportBuffer, KFutabaMaxHidReportSize);
3.24 + */
3.25 + iVfd01.Clear();
3.26
3.27 return 1;
3.28 }
3.29 @@ -553,6 +556,7 @@
3.30 long
3.31 MainWindow::onFutabaDimming(FXObject *sender, FXSelector sel, void *ptr)
3.32 {
3.33 + /*
3.34 memset(iOutputReportBuffer, 0x0, KFutabaMaxHidReportSize);
3.35 iOutputReportBuffer[0]=0x00; //Report ID
3.36 iOutputReportBuffer[1]=0x06; //Report length
3.37 @@ -564,6 +568,10 @@
3.38 iDimming = (iDimming==0x35?0x30:++iDimming);
3.39 iOutputReportBuffer[7]=iDimming;
3.40 int res = hid_write(connected_device, iOutputReportBuffer, KFutabaMaxHidReportSize);
3.41 + */
3.42 +
3.43 + iBrightness = (iBrightness==iVfd01.MaxBrightness()?iVfd01.MinBrightness():++iBrightness);
3.44 + iVfd01.SetBrightness(iBrightness);
3.45
3.46 return 1;
3.47 }
3.48 @@ -666,7 +674,8 @@
3.49 int y=0;
3.50 iTextFieldX->getText().scan("%d",&x);
3.51 iTextFieldY->getText().scan("%d",&y);
3.52 - SetPixel(x,y,0x01);
3.53 + //SetPixel(x,y,0x01);
3.54 + iVfd01.SetPixel(x,y,true);
3.55 return 1;
3.56 }
3.57
3.58 @@ -678,12 +687,15 @@
3.59 int y=0;
3.60 iTextFieldX->getText().scan("%d",&x);
3.61 iTextFieldY->getText().scan("%d",&y);
3.62 - SetPixel(x,y,0x00);
3.63 + //SetPixel(x,y,0x00);
3.64 + iVfd01.SetPixel(x,y,false);
3.65 return 1;
3.66 }
3.67
3.68 long MainWindow::onFutabaSetAllPixels(FXObject *sender, FXSelector sel, void *ptr)
3.69 {
3.70 + iVfd01.SetAllPixels(true);
3.71 +
3.72 //One pixel at a time
3.73 /*
3.74 for (int i=0;i<256;i++)
3.75 @@ -695,6 +707,7 @@
3.76 }
3.77 */
3.78 //16x16=256 pixels at a time goes much faster
3.79 + /*
3.80 for (int i=0;i<256;i+=16)
3.81 {
3.82 for (int j=0;j<64;j+=16)
3.83 @@ -703,6 +716,7 @@
3.84 //FXThread::sleep(1000000000);
3.85 }
3.86 }
3.87 + */
3.88
3.89 return 1;
3.90 }