FutabaGP1212A01.h
author StephaneLenclud
Mon, 09 Feb 2015 20:04:47 +0100
changeset 33 fc42477ae80b
parent 13 70907579a3b6
child 35 638eb0763e20
permissions -rw-r--r--
MDM166AA: Now defining the networks mast as Internet connection icon.
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@9
    25
	//From DisplayBase
sl@8
    26
	int Open();
sl@8
    27
	//From FutabaGraphicVfd
sl@22
    28
	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
sl@8
    29
	virtual void SetAllPixels(unsigned char aPattern);
sl@8
    30
    virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
sl@13
    31
    //virtual void BitBlit(const BitArray& aBitmap, int aSrcWidth, int aSrcHeight, int aTargetX, int aTargetY) const;
sl@8
    32
	//From FutabaVfd
sl@8
    33
	virtual void SetBrightness(int aBrightness);
sl@8
    34
	virtual void Clear();
sl@10
    35
	virtual void Fill();
sl@8
    36
sl@8
    37
	//Specific to GP1212A01A
sl@8
    38
	void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char aValue);
sl@8
    39
    void SetPixelBlock(unsigned char aX, unsigned char aY, int aHeight, int aSize, unsigned char* aPixels);
sl@8
    40
    //Define display position within our display RAM
sl@8
    41
	void SetDisplayPosition(unsigned char aX, unsigned char aY);
sl@8
    42
    unsigned char DisplayPositionX() const {return iDisplayPositionX;}
sl@8
    43
    unsigned char DisplayPositionY() const {return iDisplayPositionY;}
sl@8
    44
    //
sl@8
    45
	void SwapBuffers();
sl@8
    46
    //
sl@11
    47
	virtual void Request(TMiniDisplayRequest aRequest);
sl@8
    48
	//
sl@8
    49
	void ToggleOffScreenMode();
sl@8
    50
    void SetOffScreenMode(bool aOn);
sl@8
    51
    bool OffScreenMode() const {return iOffScreenMode;}
sl@8
    52
    //
sl@8
    53
    void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
sl@8
    54
    bool FrameDifferencing() const {return iUseFrameDifferencing;}
sl@8
    55
    //
sl@8
    56
    TMiniDisplayRequest AttemptRequestCompletion();
sl@8
    57
    FutabaVfdReport& InputReport() {return iInputReport;}
sl@8
    58
sl@8
    59
private:
sl@11
    60
	void RequestDeviceId();
sl@11
    61
    void RequestFirmwareRevision();
sl@11
    62
    void RequestPowerSupplyStatus();
sl@11
    63
sl@11
    64
sl@11
    65
private:
sl@8
    66
	enum DW
sl@8
    67
		{
sl@8
    68
        DW1=0xC0,
sl@8
    69
        DW2=0xD0
sl@8
    70
		};
sl@8
    71
sl@8
    72
	void SetDisplayPosition(DW aDw,unsigned char aX, unsigned char aY);
sl@8
    73
	unsigned char OffScreenY() const;
sl@8
    74
	void SendClearCommand();
sl@8
    75
	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
sl@8
    76
	void ResetBuffers();
sl@8
    77
    void SendModifiedPixelBlocks();
sl@8
    78
sl@8
    79
private:
sl@8
    80
	unsigned char iDisplayPositionX;
sl@8
    81
	unsigned char iDisplayPositionY;
sl@8
    82
	///Off screen mode is the recommended default settings to avoid tearing.
sl@8
    83
	///Though turning it off can be useful for debugging
sl@8
    84
	bool iOffScreenMode;
sl@8
    85
    ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
sl@8
    86
    bool iUseFrameDifferencing;
sl@8
    87
	///
sl@8
    88
	//FutabaVfdReport iReport;
sl@8
    89
	///
sl@8
    90
	//unsigned char iFrameBuffer[256*64];
sl@13
    91
    BitArrayHigh* iFrameNext;
sl@13
    92
    BitArrayHigh* iFrameCurrent;
sl@13
    93
    BitArrayHigh* iFramePrevious;
sl@8
    94
    //
sl@13
    95
    BitArrayHigh* iFrameAlpha;
sl@13
    96
    BitArrayHigh* iFrameBeta;
sl@13
    97
    BitArrayHigh* iFrameGamma;
sl@8
    98
    //
sl@8
    99
    int iNeedFullFrameUpdate;
sl@8
   100
	//unsigned char iFrameBeta[256*64];
sl@8
   101
	//unsigned char *iFrontBuffer;
sl@8
   102
	//unsigned char *iBackBuffer;
sl@8
   103
    FutabaVfdReport iInputReport;
sl@8
   104
	};
sl@8
   105
sl@8
   106
sl@8
   107
#endif