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