FutabaGP1212A02.h
author sl
Sun, 31 Aug 2014 17:42:10 +0200
changeset 15 105f2c0d3cf1
parent 14 86faea78ddf0
child 16 42ba42be810d
permissions -rw-r--r--
GP1212A02: Implementing DataMemory frame cycle experiment, no frame rate improvement.
Adding support for firmware revision query.
sl@8
     1
//
sl@8
     2
//
sl@8
     3
//
sl@8
     4
sl@8
     5
#ifndef FUTABA_GP1212A02_H
sl@8
     6
#define FUTABA_GP1212A02_H
sl@8
     7
sl@8
     8
#include "FutabaGP1212.h"
sl@8
     9
sl@10
    10
#include "FutabaGP1212.h"
sl@10
    11
#include "FutabaVfd.h"
sl@10
    12
sl@10
    13
/**
sl@10
    14
GP1212A01A is a graphic display module using a FUTABA 256x64dots VFD.
sl@10
    15
The module do not include character ROM, the customer will compile the character
sl@13
    16
by themselves (from main system). 
sl@10
    17
*/
sl@10
    18
class GP1212A02A : public GP1212XXXX
sl@10
    19
	{
sl@10
    20
public:
sl@10
    21
sl@10
    22
    GP1212A02A();
sl@10
    23
    ~GP1212A02A();
sl@10
    24
sl@10
    25
	//From DisplayBase
sl@10
    26
	int Open();
sl@10
    27
	virtual void SwapBuffers();
sl@10
    28
sl@10
    29
	//From GraphicDisplay
sl@10
    30
	virtual void SetPixel(unsigned char aX, unsigned char aY, bool aOn);
sl@10
    31
	virtual void SetAllPixels(unsigned char aPattern);
sl@10
    32
    virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;}
sl@10
    33
	virtual void SetBrightness(int aBrightness);
sl@10
    34
	virtual void Clear();
sl@10
    35
	virtual void Fill();
sl@15
    36
	virtual void Request(TMiniDisplayRequest aRequest);
sl@10
    37
sl@14
    38
	
sl@15
    39
		
sl@10
    40
	//
sl@10
    41
	void ToggleOffScreenMode();
sl@10
    42
    void SetOffScreenMode(bool aOn);
sl@10
    43
    bool OffScreenMode() const {return iOffScreenMode;}
sl@10
    44
    //
sl@10
    45
    void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;}
sl@10
    46
    bool FrameDifferencing() const {return iUseFrameDifferencing;}
sl@11
    47
    //    
sl@10
    48
    TMiniDisplayRequest AttemptRequestCompletion();
sl@10
    49
    FutabaVfdReport& InputReport() {return iInputReport;}
sl@10
    50
    bool PowerOn();
sl@10
    51
	char* DeviceId();
sl@10
    52
	char* FirmwareRevision();
sl@10
    53
sl@14
    54
	enum TBmpBoxId
sl@14
    55
	{
sl@14
    56
		EBmpBoxIdNull=0x30,
sl@14
    57
		EBmpBoxIdOne=0x31,
sl@14
    58
		EBmpBoxIdTwo=0x32,
sl@14
    59
		EBmpBoxIdThree=0x33
sl@14
    60
	};
sl@14
    61
sl@14
    62
	enum TTarget
sl@14
    63
	{
sl@14
    64
		ETargetDisplayWindow=0x30,
sl@14
    65
		ETargetDataMemory=0x31
sl@14
    66
	};
sl@14
    67
sl@14
    68
	enum TDirection
sl@14
    69
	{
sl@14
    70
		EDirectionY=0x30,
sl@14
    71
		EDirectionX=0x31
sl@14
    72
	};
sl@14
    73
sl@14
    74
sl@15
    75
private:
sl@15
    76
	//Specific to GP1212A02A
sl@14
    77
	//General setting command
sl@14
    78
	void BmpDataInput(TTarget aTarget, unsigned short aAddress, TDirection aDirection, unsigned short aSize, unsigned char* aPixels);
sl@14
    79
sl@14
    80
	//BMP box
sl@14
    81
	void BmpBoxSetting(TBmpBoxId aBoxId, unsigned short aAddress, int aWidth, int aHeight);
sl@14
    82
	void BmpBoxSelect(TBmpBoxId aBoxId);
sl@14
    83
	void BmpBoxDataMemoryTransfer(unsigned short aAddress);
sl@14
    84
	void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels);
sl@14
    85
sl@10
    86
private:
sl@15
    87
    void RequestDeviceId();
sl@15
    88
    void RequestFirmwareRevision();
sl@15
    89
    void RequestPowerSupplyStatus();
sl@15
    90
sl@15
    91
sl@15
    92
private:
sl@10
    93
	unsigned char OffScreenY() const;
sl@10
    94
	void SendClearCommand();
sl@10
    95
	void OffScreenTranslation(unsigned char& aX, unsigned char& aY);
sl@10
    96
	void ResetBuffers();
sl@10
    97
sl@10
    98
private:
sl@10
    99
	unsigned char iDisplayPositionX;
sl@10
   100
	unsigned char iDisplayPositionY;
sl@10
   101
	///Off screen mode is the recommended default settings to avoid tearing.
sl@10
   102
	///Though turning it off can be useful for debugging
sl@10
   103
	bool iOffScreenMode;
sl@10
   104
    ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case
sl@10
   105
    bool iUseFrameDifferencing;
sl@10
   106
	///
sl@10
   107
	//FutabaVfdReport iReport;
sl@10
   108
	///
sl@10
   109
	//unsigned char iFrameBuffer[256*64];
sl@13
   110
    BitArrayLow* iFrameNext;
sl@13
   111
    BitArrayLow* iFrameCurrent;
sl@13
   112
    BitArrayLow* iFramePrevious;
sl@10
   113
    //
sl@13
   114
    BitArrayLow* iFrameAlpha;
sl@13
   115
    BitArrayLow* iFrameBeta;
sl@13
   116
    BitArrayLow* iFrameGamma;
sl@10
   117
    //
sl@10
   118
    int iNeedFullFrameUpdate;
sl@10
   119
	//unsigned char iFrameBeta[256*64];
sl@10
   120
	//unsigned char *iFrontBuffer;
sl@10
   121
	//unsigned char *iBackBuffer;
sl@10
   122
    FutabaVfdReport iInputReport;
sl@10
   123
	//
sl@10
   124
	char iDeviceId[KFutabaMaxHidReportSize];
sl@10
   125
	char iFirmwareRevision[KFutabaMaxHidReportSize];
sl@10
   126
    bool iPowerOn;
sl@15
   127
	//
sl@15
   128
	unsigned short iNextFrameAddress;
sl@10
   129
	};
sl@10
   130
sl@8
   131
sl@8
   132
sl@8
   133
#endif