FutabaMDM166AA.h
author StephaneLenclud
Tue, 10 Feb 2015 15:38:27 +0100
changeset 34 892f755c2612
parent 32 2c844ef1ff4b
child 35 638eb0763e20
permissions -rw-r--r--
MDM166AA: Clock and Clear adjustments.
StephaneLenclud@25
     1
//
StephaneLenclud@25
     2
//
StephaneLenclud@25
     3
//
StephaneLenclud@25
     4
StephaneLenclud@25
     5
#ifndef FUTABA_MDM166AA_H
StephaneLenclud@25
     6
#define FUTABA_MDM166AA_H
StephaneLenclud@25
     7
StephaneLenclud@25
     8
#include "FutabaVfd.h"
StephaneLenclud@25
     9
StephaneLenclud@25
    10
StephaneLenclud@25
    11
const int KMDM166AAWidthInPixels = 96;
StephaneLenclud@25
    12
const int KMDM166AAHeightInPixels = 16;
StephaneLenclud@25
    13
const int KMDM166AAPixelsPerByte = 8;
StephaneLenclud@25
    14
const int KMDM166AAFrameBufferSizeInBytes = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels/KMDM166AAPixelsPerByte; //96*16/8=192
StephaneLenclud@25
    15
const int KMDM166AAFrameBufferPixelCount = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels;
StephaneLenclud@25
    16
StephaneLenclud@25
    17
StephaneLenclud@25
    18
/**
StephaneLenclud@25
    19
MDM166AA is a graphic display module using a FUTABA 96x16dots VFD.
StephaneLenclud@25
    20
*/
StephaneLenclud@25
    21
class MDM166AA : public FutabaGraphicDisplay
StephaneLenclud@25
    22
	{
StephaneLenclud@25
    23
public:
StephaneLenclud@25
    24
    MDM166AA();
StephaneLenclud@25
    25
    ~MDM166AA();
StephaneLenclud@25
    26
StephaneLenclud@25
    27
	//From DisplayBase
StephaneLenclud@25
    28
	virtual int Open();
StephaneLenclud@25
    29
	virtual void SwapBuffers();
StephaneLenclud@25
    30
		//Brightness support
StephaneLenclud@25
    31
    virtual int MinBrightness() const {return 0;}
StephaneLenclud@25
    32
    virtual int MaxBrightness() const {return 2;}
StephaneLenclud@25
    33
	virtual void SetBrightness(int aBrightness);
StephaneLenclud@25
    34
		//Clock support
StephaneLenclud@25
    35
	virtual void ShowClock();
StephaneLenclud@25
    36
	virtual void HideClock();
StephaneLenclud@25
    37
	virtual bool SupportClock(){return true;}
StephaneLenclud@31
    38
		//Icons
StephaneLenclud@32
    39
	virtual int IconCount(TMiniDisplayIconType aIcon);
StephaneLenclud@32
    40
	virtual int IconStatusCount(TMiniDisplayIconType aIcon);
StephaneLenclud@32
    41
	virtual void SetIconStatus(TMiniDisplayIconType aIcon, int aIndex, int aStatus);
StephaneLenclud@25
    42
StephaneLenclud@25
    43
	//From GraphicDisplay
StephaneLenclud@25
    44
    virtual int WidthInPixels() const {return KMDM166AAWidthInPixels;}
StephaneLenclud@25
    45
    virtual int HeightInPixels() const {return KMDM166AAHeightInPixels;}
StephaneLenclud@25
    46
StephaneLenclud@25
    47
	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
StephaneLenclud@25
    48
	virtual void SetAllPixels(unsigned char aPattern);
StephaneLenclud@25
    49
    virtual int FrameBufferSizeInBytes() const {return KMDM166AAFrameBufferSizeInBytes;}	
StephaneLenclud@25
    50
	virtual void Clear();
StephaneLenclud@25
    51
	virtual void Fill();
StephaneLenclud@25
    52
	virtual void Request(TMiniDisplayRequest aRequest);
StephaneLenclud@25
    53
		
StephaneLenclud@25
    54
	//
StephaneLenclud@25
    55
	void ToggleOffScreenMode();
StephaneLenclud@25
    56
    void SetOffScreenMode(bool aOn);
StephaneLenclud@25
    57
    bool OffScreenMode() const {return iOffScreenMode;}
StephaneLenclud@25
    58
StephaneLenclud@32
    59
		//Icon specific
StephaneLenclud@33
    60
	void SetIconNetworkSignal(int aIndex, int aStatus);
StephaneLenclud@33
    61
	void SetIconInternet(int aIndex, int aStatus);
StephaneLenclud@32
    62
	void SetIconEmail(int aIndex, int aStatus);
StephaneLenclud@32
    63
	void SetIconMute(int aIndex, int aStatus);
StephaneLenclud@32
    64
	void SetIconVolumeLabel(int aIndex, int aStatus);
StephaneLenclud@32
    65
	void SetIconVolume(int aIndex, int aStatus);
StephaneLenclud@32
    66
	void SetIconPlay(int aIndex, int aStatus);
StephaneLenclud@32
    67
	void SetIconPause(int aIndex, int aStatus);
StephaneLenclud@32
    68
	void SetIconRecording(int aIndex, int aStatus);
StephaneLenclud@32
    69
StephaneLenclud@32
    70
StephaneLenclud@25
    71
private:
StephaneLenclud@25
    72
StephaneLenclud@25
    73
	enum TClockFormat
StephaneLenclud@28
    74
		{
StephaneLenclud@25
    75
		EClock12	=	0x00,
StephaneLenclud@25
    76
		EClock24	=	0x01,
StephaneLenclud@28
    77
		};
StephaneLenclud@25
    78
StephaneLenclud@25
    79
	enum TClockSize
StephaneLenclud@28
    80
		{
StephaneLenclud@25
    81
		EClockSmall		=	0x01,
StephaneLenclud@25
    82
		EClockLarge		=	0x02
StephaneLenclud@28
    83
		};
StephaneLenclud@25
    84
	
StephaneLenclud@31
    85
	enum TIconId
StephaneLenclud@31
    86
		{		
StephaneLenclud@31
    87
		EIconPlay				=	0x00,
StephaneLenclud@31
    88
		EIconPause				=	0x01,
StephaneLenclud@31
    89
		EIconRecording			=	0x02,
StephaneLenclud@31
    90
		EIconEnvelop			=	0x03,
StephaneLenclud@31
    91
		EIconAt					=	0x04,
StephaneLenclud@31
    92
		EIconMute				=	0x05,
StephaneLenclud@31
    93
		EIconNetworkMast		=   0x06,
StephaneLenclud@31
    94
		EIconNetworkSignalLow	=   0x07,
StephaneLenclud@31
    95
		EIconNetworkSignalMid	=   0x08,
StephaneLenclud@31
    96
		EIconNetworkSignalHigh	=   0x09,
StephaneLenclud@31
    97
		EIconVolumeLabel		=   0x0A,
StephaneLenclud@31
    98
		EIconVolumeLevel01		=   0x0B,
StephaneLenclud@31
    99
		EIconVolumeLevel02		=   0x0C,
StephaneLenclud@31
   100
		EIconVolumeLevel03		=   0x0D,
StephaneLenclud@31
   101
		EIconVolumeLevel04		=   0x0E,
StephaneLenclud@31
   102
		EIconVolumeLevel05		=   0x0F,
StephaneLenclud@31
   103
		EIconVolumeLevel06		=   0x10,
StephaneLenclud@31
   104
		EIconVolumeLevel07		=   0x11,
StephaneLenclud@31
   105
		EIconVolumeLevel08		=   0x12,
StephaneLenclud@31
   106
		EIconVolumeLevel09		=   0x13,
StephaneLenclud@31
   107
		EIconVolumeLevel10		=   0x14,
StephaneLenclud@31
   108
		EIconVolumeLevel11		=   0x15,
StephaneLenclud@31
   109
		EIconVolumeLevel12		=   0x16,
StephaneLenclud@31
   110
		EIconVolumeLevel13		=   0x17,
StephaneLenclud@31
   111
		EIconVolumeLevel14		=   0x18,
StephaneLenclud@31
   112
		EIconFirst				=   EIconPlay,
StephaneLenclud@31
   113
		EIconLast				=	EIconVolumeLevel14,		
StephaneLenclud@31
   114
		};
StephaneLenclud@31
   115
StephaneLenclud@31
   116
	enum TIconStatus
StephaneLenclud@31
   117
		{
StephaneLenclud@31
   118
		EIconOff		=	0x00,
StephaneLenclud@31
   119
		EIconFaded		=	0x01,
StephaneLenclud@31
   120
		EIconOn			=	0x02
StephaneLenclud@31
   121
		};
StephaneLenclud@31
   122
	
StephaneLenclud@25
   123
StephaneLenclud@25
   124
private:
StephaneLenclud@31
   125
	//Testing
StephaneLenclud@31
   126
	void SetAllIcons(TIconStatus aStatus);
StephaneLenclud@31
   127
StephaneLenclud@25
   128
	//Specific to MDM166AA
StephaneLenclud@25
   129
	//General setting command
StephaneLenclud@25
   130
	void SendCommandClear();
StephaneLenclud@25
   131
	void SendCommandReset();
StephaneLenclud@25
   132
	//
StephaneLenclud@25
   133
	//Clock commands
StephaneLenclud@28
   134
	void SendCommandSetClockData(unsigned char aHour, unsigned char aMinute);
StephaneLenclud@25
   135
	void SendCommandClockDisplay(TClockSize aClockSize, TClockFormat aClockFormat);	
StephaneLenclud@30
   136
	void AttemptClockSynchronization();
StephaneLenclud@25
   137
StephaneLenclud@27
   138
	//Graphics commands
StephaneLenclud@27
   139
	void SendCommandSetAddressCounter(unsigned char aAddressCounter);
StephaneLenclud@27
   140
	void SendCommandWriteGraphicData(int aSize, unsigned char* aPixels);
StephaneLenclud@27
   141
StephaneLenclud@31
   142
	//Icon/Symbol command
StephaneLenclud@31
   143
	void SendCommandSymbolControl(TIconId aIconId, TIconStatus aStatus);
StephaneLenclud@31
   144
StephaneLenclud@25
   145
    void RequestDeviceId();
StephaneLenclud@25
   146
    void RequestFirmwareRevision();
StephaneLenclud@25
   147
    void RequestPowerSupplyStatus();
StephaneLenclud@25
   148
	//
StephaneLenclud@28
   149
	void SetClockData();
StephaneLenclud@30
   150
	//
StephaneLenclud@25
   151
	void ResetBuffers();
StephaneLenclud@25
   152
StephaneLenclud@25
   153
private:
StephaneLenclud@25
   154
	///Off screen mode is the recommended default settings to avoid tearing.
StephaneLenclud@25
   155
	///Though turning it off can be useful for debugging
StephaneLenclud@25
   156
	bool iOffScreenMode;
StephaneLenclud@30
   157
	///We use this flag to align display clock seconds with system time
StephaneLenclud@30
   158
	bool iNeedAccurateClockData;
StephaneLenclud@28
   159
    //
StephaneLenclud@28
   160
	BitArrayLow* iFrameNext;
StephaneLenclud@25
   161
    BitArrayLow* iFrameCurrent;
StephaneLenclud@25
   162
    BitArrayLow* iFramePrevious;
StephaneLenclud@25
   163
    //
StephaneLenclud@28
   164
    BitArrayLow* iFrameAlpha; //owned
StephaneLenclud@28
   165
    BitArrayLow* iFrameBeta;  //owned
StephaneLenclud@28
   166
    BitArrayLow* iFrameGamma; //owned
StephaneLenclud@25
   167
	};
StephaneLenclud@25
   168
StephaneLenclud@25
   169
StephaneLenclud@25
   170
StephaneLenclud@25
   171
#endif