Still working on our architecture to support GP1212A02
authorsl
Thu, 21 Aug 2014 21:53:35 +0200
changeset 96b08e3e81cf3
parent 8 5a9dbbc40c6b
child 10 1c3a4964a5bd
Still working on our architecture to support GP1212A02
Display.h
FutabaGP1212.h
FutabaGP1212A01.h
FutabaVfd.cpp
FutabaVfd.h
     1.1 --- a/Display.h	Thu Aug 21 21:30:38 2014 +0200
     1.2 +++ b/Display.h	Thu Aug 21 21:53:35 2014 +0200
     1.3 @@ -5,14 +5,15 @@
     1.4  #ifndef DISPLAY_H
     1.5  #define DISPLAY_H
     1.6  
     1.7 -#include "HidDevice.h"
     1.8 -
     1.9  /**
    1.10  Define an interface to some basic display functionality
    1.11  */
    1.12 -class DisplayBase : public HidDevice
    1.13 +class DisplayBase
    1.14  	{
    1.15  public:
    1.16 +	virtual int Open()=0;
    1.17 +	virtual void Close()=0;
    1.18 +	//
    1.19  	virtual int MinBrightness() const=0;
    1.20  	virtual int MaxBrightness() const=0;
    1.21  	virtual void SetBrightness(int aBrightness)=0;
     2.1 --- a/FutabaGP1212.h	Thu Aug 21 21:30:38 2014 +0200
     2.2 +++ b/FutabaGP1212.h	Thu Aug 21 21:53:35 2014 +0200
     2.3 @@ -5,18 +5,27 @@
     2.4  #ifndef FUTABA_GP1212_H
     2.5  #define FUTABA_GP1212_H
     2.6  
     2.7 -#include "Display.h"
     2.8 +#include "FutabaVfd.h"
     2.9 +
    2.10 +const int KGP12xWidthInPixels = 256;
    2.11 +const int KGP12xHeightInPixels = 64;
    2.12 +const int KGP12xPixelsPerByte = 8;
    2.13 +const int KGP12xFrameBufferSizeInBytes = KGP12xWidthInPixels*KGP12xHeightInPixels/KGP12xPixelsPerByte; //256*64/8=2048
    2.14 +const int KGP12xFrameBufferPixelCount = KGP12xWidthInPixels*KGP12xHeightInPixels;
    2.15  
    2.16  
    2.17  /**
    2.18  Common functionality between GP1212A01A and GP1212A02A
    2.19  */
    2.20 -class GP1212XXXX : public GraphicDisplay
    2.21 +class GP1212XXXX : public FutabaGraphicDisplay
    2.22  	{
    2.23  public:
    2.24  	//From FutabaVfd
    2.25      virtual int MinBrightness() const {return 0;}
    2.26      virtual int MaxBrightness() const {return 5;}
    2.27 +    virtual int WidthInPixels() const {return KGP12xWidthInPixels;}
    2.28 +    virtual int HeightInPixels() const {return KGP12xHeightInPixels;}
    2.29 +
    2.30  	};
    2.31  
    2.32  
     3.1 --- a/FutabaGP1212A01.h	Thu Aug 21 21:30:38 2014 +0200
     3.2 +++ b/FutabaGP1212A01.h	Thu Aug 21 21:53:35 2014 +0200
     3.3 @@ -22,11 +22,9 @@
     3.4      GP1212A01A();
     3.5      ~GP1212A01A();
     3.6  
     3.7 -	//
     3.8 +	//From DisplayBase
     3.9  	int Open();
    3.10  	//From FutabaGraphicVfd
    3.11 -    virtual int WidthInPixels() const {return KGP12xWidthInPixels;}
    3.12 -    virtual int HeightInPixels() const {return KGP12xHeightInPixels;}
    3.13  	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
    3.14  	virtual void SetAllPixels(unsigned char aPattern);
    3.15      virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
     4.1 --- a/FutabaVfd.cpp	Thu Aug 21 21:30:38 2014 +0200
     4.2 +++ b/FutabaVfd.cpp	Thu Aug 21 21:53:35 2014 +0200
     4.3 @@ -65,7 +65,14 @@
     4.4  */
     4.5  
     4.6  
     4.7 +//
     4.8 +// class FutabaDisplay
     4.9 +//
    4.10  
    4.11 +void FutabaGraphicDisplay::Close()
    4.12 +	{
    4.13 +	HidDevice::Close();
    4.14 +	}
    4.15  
    4.16  
    4.17  
     5.1 --- a/FutabaVfd.h	Thu Aug 21 21:30:38 2014 +0200
     5.2 +++ b/FutabaVfd.h	Thu Aug 21 21:53:35 2014 +0200
     5.3 @@ -9,6 +9,7 @@
     5.4  #include "HidDevice.h"
     5.5  #include "BitArray.h"
     5.6  #include "MiniDisplay.h"
     5.7 +#include "Display.h"
     5.8  
     5.9  #ifndef MIN
    5.10  #define MIN(a,b) (((a)<(b))?(a):(b))
    5.11 @@ -31,11 +32,6 @@
    5.12  const unsigned short KFutabaVendorId = 0x1008;
    5.13  const unsigned short KFutabaProductIdGP1212A01A = 0x100C;
    5.14  const unsigned short KFutabaProductIdGP1212A02A = 0x1013; //Or is it 0x1015
    5.15 -const int KGP12xWidthInPixels = 256;
    5.16 -const int KGP12xHeightInPixels = 64;
    5.17 -const int KGP12xPixelsPerByte = 8;
    5.18 -const int KGP12xFrameBufferSizeInBytes = KGP12xWidthInPixels*KGP12xHeightInPixels/KGP12xPixelsPerByte; //256*64/8=2048
    5.19 -const int KGP12xFrameBufferPixelCount = KGP12xWidthInPixels*KGP12xHeightInPixels;
    5.20  
    5.21  //typedef struct hid_device_info HidDeviceInfo;
    5.22  
    5.23 @@ -73,5 +69,15 @@
    5.24      int iMaxSize;
    5.25      };
    5.26  
    5.27 +/**
    5.28 +*/
    5.29 +class FutabaGraphicDisplay : public GraphicDisplay, public HidDevice
    5.30 +	{
    5.31 +public:
    5.32 +	//From DisplayBase
    5.33 +	virtual void Close();
    5.34 +
    5.35 +	};
    5.36 +
    5.37  
    5.38  #endif