Adding support for setting GP1212A01A display position.
authorsl
Thu, 22 May 2014 14:57:11 +0200
changeset 217d89d719583e
parent 20 23cacc1d17a3
child 22 efa6ff02287c
Adding support for setting GP1212A01A display position.
inc/FutabaVfd.h
inc/MainWindow.h
src/FutabaVfd.cpp
src/test.cpp
     1.1 --- a/inc/FutabaVfd.h	Thu May 22 13:46:37 2014 +0200
     1.2 +++ b/inc/FutabaVfd.h	Thu May 22 14:57:11 2014 +0200
     1.3 @@ -110,6 +110,12 @@
     1.4  class GP1212A01A : public GP1212XXXX
     1.5  	{
     1.6  public:
     1.7 +    enum DW
     1.8 +    {
     1.9 +        DW1=12,
    1.10 +        DW2=13
    1.11 +    };
    1.12 +
    1.13  	int Open();
    1.14  	//From FutabaGraphicVfd
    1.15  	virtual int WidthInPixels(){return 256;};
    1.16 @@ -124,6 +130,8 @@
    1.17  	void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char aValue);
    1.18      void SetPixelBlock(int aX, int aY, int aHeight, int aSize, unsigned char* aPixels);
    1.19      //
    1.20 +    void SetDisplayPosition(DW aDw,int aX, int aY);
    1.21 +    //
    1.22      void RequestId();
    1.23      void RequestFirmwareRevision();
    1.24      void RequestPowerSupplyStatus();
     2.1 --- a/inc/MainWindow.h	Thu May 22 13:46:37 2014 +0200
     2.2 +++ b/inc/MainWindow.h	Thu May 22 14:57:11 2014 +0200
     2.3 @@ -40,6 +40,7 @@
     2.4          ID_FUTABA_SET_PIXEL,
     2.5          ID_FUTABA_RESET_PIXEL,
     2.6          ID_FUTABA_SET_ALL_PIXELS,
     2.7 +        ID_FUTABA_SET_DISPLAY_POSITION,
     2.8          ID_SELECT_FONT,
     2.9          ID_LAST
    2.10      };
    2.11 @@ -71,6 +72,7 @@
    2.12      long onFutabaSetAllPixels(FXObject *sender, FXSelector sel, void *ptr);
    2.13      long onFutabaSetPixel(FXObject *sender, FXSelector sel, void *ptr);
    2.14      long onFutabaResetPixel(FXObject *sender, FXSelector sel, void *ptr);
    2.15 +    long onFutabaSetDisplayPosition(FXObject *sender, FXSelector sel, void *ptr);
    2.16      //
    2.17      long onSelectFont(FXObject *sender, FXSelector sel, void *ptr);
    2.18      //
    2.19 @@ -112,6 +114,7 @@
    2.20      FXButton *iButtonSetPixel;
    2.21      FXButton *iButtonResetPixel;
    2.22      FXButton *iButtonSetAllPixels;
    2.23 +    FXButton *iButtonSetDisplayPosition;
    2.24      //Font
    2.25      FXButton *iButtonSelectFont;
    2.26  
     3.1 --- a/src/FutabaVfd.cpp	Thu May 22 13:46:37 2014 +0200
     3.2 +++ b/src/FutabaVfd.cpp	Thu May 22 14:57:11 2014 +0200
     3.3 @@ -213,7 +213,8 @@
     3.4  */
     3.5  void GP1212A01A::Clear()
     3.6  	{
     3.7 -    //Send Clear display command
     3.8 +    //1BH,5BH,32H,4AH
     3.9 +    //Send Clear Display Command
    3.10  	FutabaVfdReport report;
    3.11  	report[0]=0x00; //Report ID
    3.12  	report[1]=0x04; //Report length
    3.13 @@ -225,6 +226,24 @@
    3.14  	}
    3.15  
    3.16  /**
    3.17 +Change our display position within our buffer.
    3.18 +*/
    3.19 +void GP1212A01A::SetDisplayPosition(DW aDw,int aX, int aY)
    3.20 +    {
    3.21 +    //1BH,5BH,Dw,Px,Py
    3.22 +    //Send Display Position Settings Command
    3.23 +    FutabaVfdReport report;
    3.24 +    report[0]=0x00; //Report ID
    3.25 +    report[1]=0x05; //Report length
    3.26 +    report[2]=0x1B; //Command ID
    3.27 +    report[3]=0x5B; //Command ID
    3.28 +    report[4]=aDw;  //Specify our DW
    3.29 +    report[5]=aX;   //X coordinate of our DW top-left corner
    3.30 +    report[5]=aY;   //Y coordinate of our DW top-left corner
    3.31 +    Write(report);
    3.32 +    }
    3.33 +
    3.34 +/**
    3.35  */
    3.36  void GP1212A01A::RequestId()
    3.37      {
     4.1 --- a/src/test.cpp	Thu May 22 13:46:37 2014 +0200
     4.2 +++ b/src/test.cpp	Thu May 22 14:57:11 2014 +0200
     4.3 @@ -120,6 +120,7 @@
     4.4  	iButtonResetPixel = new FXButton(matrix, "Reset Pixel", NULL, this, ID_FUTABA_RESET_PIXEL, BUTTON_NORMAL|LAYOUT_FILL_X);
     4.5      //
     4.6      iButtonSetAllPixels = new FXButton(matrix, "Set All Pixels", NULL, this, ID_FUTABA_SET_ALL_PIXELS, BUTTON_NORMAL|LAYOUT_FILL_X);
     4.7 +    iButtonSetDisplayPosition = new FXButton(matrix, "Set Display Position", NULL, this, ID_FUTABA_SET_ALL_PIXELS, BUTTON_NORMAL|LAYOUT_FILL_X);
     4.8      //
     4.9  
    4.10  	// Output Group Box
    4.11 @@ -287,6 +288,7 @@
    4.12              iButtonSetPixel->enable();
    4.13              iButtonResetPixel->enable();
    4.14              iButtonSetAllPixels->enable();
    4.15 +            iButtonSetDisplayPosition->enable();
    4.16              }
    4.17          }
    4.18      else
    4.19 @@ -312,6 +314,7 @@
    4.20          iButtonSetPixel->disable();
    4.21          iButtonResetPixel->disable();
    4.22          iButtonSetAllPixels->disable();
    4.23 +        iButtonSetDisplayPosition->disable();
    4.24          //
    4.25          }
    4.26  
    4.27 @@ -721,6 +724,23 @@
    4.28      return 1;
    4.29  	}
    4.30  
    4.31 +
    4.32 +/**
    4.33 +
    4.34 +*/
    4.35 +long MainWindow::onFutabaSetDisplayPosition(FXObject *sender, FXSelector sel, void *ptr)
    4.36 +    {
    4.37 +    int x=0;
    4.38 +    int y=0;
    4.39 +    iTextFieldX->getText().scan("%d",&x);
    4.40 +    iTextFieldY->getText().scan("%d",&y);
    4.41 +    //Set both positions for now until we understand how to use that stuff
    4.42 +    iVfd01.SetDisplayPosition(GP1212A01A::DW1,x,y);
    4.43 +    iVfd01.SetDisplayPosition(GP1212A01A::DW2,x,y);
    4.44 +    return 1;
    4.45 +    }
    4.46 +
    4.47 +
    4.48  long
    4.49  MainWindow::onFutabaReadId(FXObject *sender, FXSelector sel, void *ptr)
    4.50  {