FutabaGP1212A01.h
author sl
Thu, 21 Aug 2014 21:30:38 +0200
changeset 8 5a9dbbc40c6b
child 9 6b08e3e81cf3
permissions -rw-r--r--
Ground work to support multiple type of display, notably GP1212A02
sl@8
     1
//
sl@8
     2
//
sl@8
     3
//
sl@8
     4
sl@8
     5
#ifndef FUTABA_GP1212A01_H
sl@8
     6
#define FUTABA_GP1212A01_H
sl@8
     7
sl@8
     8
#include "FutabaGP1212.h"
sl@8
     9
#include "FutabaVfd.h"
sl@8
    10
sl@8
    11
/**
sl@8
    12
GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
sl@8
    13
The module do not include character ROM, the customer will compile the character
sl@8
    14
by themselves (from main system).
sl@8
    15
*/
sl@8
    16
class GP1212A01A : public GP1212XXXX
sl@8
    17
	{
sl@8
    18
public:
sl@8
    19
sl@8
    20
sl@8
    21
public:
sl@8
    22
    GP1212A01A();
sl@8
    23
    ~GP1212A01A();
sl@8
    24
sl@8
    25
	//
sl@8
    26
	int Open();
sl@8
    27
	//From FutabaGraphicVfd
sl@8
    28
    virtual int WidthInPixels() const {return KGP12xWidthInPixels;}
sl@8
    29
    virtual int HeightInPixels() const {return KGP12xHeightInPixels;}
sl@8
    30
	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
sl@8
    31
	virtual void SetAllPixels(unsigned char aPattern);
sl@8
    32
    virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
sl@8
    33
    virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
sl@8
    34
	//From FutabaVfd
sl@8
    35
	virtual void SetBrightness(int aBrightness);
sl@8
    36
	virtual void Clear();
sl@8
    37
sl@8
    38
	//Specific to GP1212A01A
sl@8
    39
	void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
sl@8
    40
    void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
sl@8
    41
    //Define display position within our display RAM
sl@8
    42
	void SetDisplayPosition(unsigned char aX, unsigned char aY);
sl@8
    43
    unsigned char DisplayPositionX() const {return iDisplayPositionX;}
sl@8
    44
    unsigned char DisplayPositionY() const {return iDisplayPositionY;}
sl@8
    45
    //
sl@8
    46
	void SwapBuffers();
sl@8
    47
    //
sl@8
    48
    void RequestDeviceId();
sl@8
    49
    void RequestFirmwareRevision();
sl@8
    50
    void RequestPowerSupplyStatus();
sl@8
    51
	//
sl@8
    52
	void ToggleOffScreenMode();
sl@8
    53
    void SetOffScreenMode(bool aOn);
sl@8
    54
    bool OffScreenMode() const {return iOffScreenMode;}
sl@8
    55
    //
sl@8
    56
    void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
sl@8
    57
    bool FrameDifferencing() const {return iUseFrameDifferencing;}
sl@8
    58
    //
sl@8
    59
    bool RequestPending(){return iRequest!=EMiniDisplayRequestNone;}
sl@8
    60
    TMiniDisplayRequest CurrentRequest(){return iRequest;}
sl@8
    61
    void CancelRequest(){iRequest=EMiniDisplayRequestNone;}
sl@8
    62
    TMiniDisplayRequest AttemptRequestCompletion();
sl@8
    63
    FutabaVfdReport& InputReport() {return iInputReport;}
sl@8
    64
    bool PowerOn();
sl@8
    65
	char* DeviceId();
sl@8
    66
	char* FirmwareRevision();
sl@8
    67
sl@8
    68
private:
sl@8
    69
	enum DW
sl@8
    70
		{
sl@8
    71
        DW1=0xC0,
sl@8
    72
        DW2=0xD0
sl@8
    73
		};
sl@8
    74
sl@8
    75
	void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
sl@8
    76
	unsigned char OffScreenY() const;
sl@8
    77
	void SendClearCommand();
sl@8
    78
	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
sl@8
    79
	void ResetBuffers();
sl@8
    80
    void SendModifiedPixelBlocks();
sl@8
    81
sl@8
    82
private:
sl@8
    83
	unsigned char iDisplayPositionX;
sl@8
    84
	unsigned char iDisplayPositionY;
sl@8
    85
	///Off screen mode is the recommended default settings to avoid tearing.
sl@8
    86
	///Though turning it off can be useful for debugging
sl@8
    87
	bool iOffScreenMode;
sl@8
    88
    ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
sl@8
    89
    bool iUseFrameDifferencing;
sl@8
    90
	///
sl@8
    91
	//FutabaVfdReport iReport;
sl@8
    92
	///
sl@8
    93
	//unsigned char iFrameBuffer[256*64];
sl@8
    94
    BitArray* iFrameNext;
sl@8
    95
    BitArray* iFrameCurrent;
sl@8
    96
    BitArray* iFramePrevious;
sl@8
    97
    //
sl@8
    98
    BitArray* iFrameAlpha;
sl@8
    99
    BitArray* iFrameBeta;
sl@8
   100
    BitArray* iFrameGamma;
sl@8
   101
    //
sl@8
   102
    int iNeedFullFrameUpdate;
sl@8
   103
	//unsigned char iFrameBeta[256*64];
sl@8
   104
	//unsigned char *iFrontBuffer;
sl@8
   105
	//unsigned char *iBackBuffer;
sl@8
   106
    TMiniDisplayRequest iRequest;
sl@8
   107
    FutabaVfdReport iInputReport;
sl@8
   108
	//
sl@8
   109
	char iDeviceId[KFutabaMaxHidReportSize];
sl@8
   110
	char iFirmwareRevision[KFutabaMaxHidReportSize];
sl@8
   111
    bool iPowerOn;
sl@8
   112
	};
sl@8
   113
sl@8
   114
sl@8
   115
#endif