FutabaMDM166AA.h
author StephaneLenclud
Sat, 07 Feb 2015 13:50:11 +0100
changeset 32 2c844ef1ff4b
parent 31 0a2b658e0d56
child 33 fc42477ae80b
permissions -rw-r--r--
MDM166AA: Improved icon APIs.
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@32
    60
	void SetIconNetwork(int aIndex, int aStatus);
StephaneLenclud@32
    61
	void SetIconEmail(int aIndex, int aStatus);
StephaneLenclud@32
    62
	void SetIconMute(int aIndex, int aStatus);
StephaneLenclud@32
    63
	void SetIconVolumeLabel(int aIndex, int aStatus);
StephaneLenclud@32
    64
	void SetIconVolume(int aIndex, int aStatus);
StephaneLenclud@32
    65
	void SetIconPlay(int aIndex, int aStatus);
StephaneLenclud@32
    66
	void SetIconPause(int aIndex, int aStatus);
StephaneLenclud@32
    67
	void SetIconRecording(int aIndex, int aStatus);
StephaneLenclud@32
    68
StephaneLenclud@32
    69
StephaneLenclud@25
    70
private:
StephaneLenclud@25
    71
StephaneLenclud@25
    72
	enum TClockFormat
StephaneLenclud@28
    73
		{
StephaneLenclud@25
    74
		EClock12	=	0x00,
StephaneLenclud@25
    75
		EClock24	=	0x01,
StephaneLenclud@28
    76
		};
StephaneLenclud@25
    77
StephaneLenclud@25
    78
	enum TClockSize
StephaneLenclud@28
    79
		{
StephaneLenclud@25
    80
		EClockSmall		=	0x01,
StephaneLenclud@25
    81
		EClockLarge		=	0x02
StephaneLenclud@28
    82
		};
StephaneLenclud@25
    83
	
StephaneLenclud@31
    84
	enum TIconId
StephaneLenclud@31
    85
		{		
StephaneLenclud@31
    86
		EIconPlay				=	0x00,
StephaneLenclud@31
    87
		EIconPause				=	0x01,
StephaneLenclud@31
    88
		EIconRecording			=	0x02,
StephaneLenclud@31
    89
		EIconEnvelop			=	0x03,
StephaneLenclud@31
    90
		EIconAt					=	0x04,
StephaneLenclud@31
    91
		EIconMute				=	0x05,
StephaneLenclud@31
    92
		EIconNetworkMast		=   0x06,
StephaneLenclud@31
    93
		EIconNetworkSignalLow	=   0x07,
StephaneLenclud@31
    94
		EIconNetworkSignalMid	=   0x08,
StephaneLenclud@31
    95
		EIconNetworkSignalHigh	=   0x09,
StephaneLenclud@31
    96
		EIconVolumeLabel		=   0x0A,
StephaneLenclud@31
    97
		EIconVolumeLevel01		=   0x0B,
StephaneLenclud@31
    98
		EIconVolumeLevel02		=   0x0C,
StephaneLenclud@31
    99
		EIconVolumeLevel03		=   0x0D,
StephaneLenclud@31
   100
		EIconVolumeLevel04		=   0x0E,
StephaneLenclud@31
   101
		EIconVolumeLevel05		=   0x0F,
StephaneLenclud@31
   102
		EIconVolumeLevel06		=   0x10,
StephaneLenclud@31
   103
		EIconVolumeLevel07		=   0x11,
StephaneLenclud@31
   104
		EIconVolumeLevel08		=   0x12,
StephaneLenclud@31
   105
		EIconVolumeLevel09		=   0x13,
StephaneLenclud@31
   106
		EIconVolumeLevel10		=   0x14,
StephaneLenclud@31
   107
		EIconVolumeLevel11		=   0x15,
StephaneLenclud@31
   108
		EIconVolumeLevel12		=   0x16,
StephaneLenclud@31
   109
		EIconVolumeLevel13		=   0x17,
StephaneLenclud@31
   110
		EIconVolumeLevel14		=   0x18,
StephaneLenclud@31
   111
		EIconFirst				=   EIconPlay,
StephaneLenclud@31
   112
		EIconLast				=	EIconVolumeLevel14,		
StephaneLenclud@31
   113
		};
StephaneLenclud@31
   114
StephaneLenclud@31
   115
	enum TIconStatus
StephaneLenclud@31
   116
		{
StephaneLenclud@31
   117
		EIconOff		=	0x00,
StephaneLenclud@31
   118
		EIconFaded		=	0x01,
StephaneLenclud@31
   119
		EIconOn			=	0x02
StephaneLenclud@31
   120
		};
StephaneLenclud@31
   121
	
StephaneLenclud@25
   122
StephaneLenclud@25
   123
private:
StephaneLenclud@31
   124
	//Testing
StephaneLenclud@31
   125
	void SetAllIcons(TIconStatus aStatus);
StephaneLenclud@31
   126
StephaneLenclud@25
   127
	//Specific to MDM166AA
StephaneLenclud@25
   128
	//General setting command
StephaneLenclud@25
   129
	void SendCommandClear();
StephaneLenclud@25
   130
	void SendCommandReset();
StephaneLenclud@25
   131
	//
StephaneLenclud@25
   132
	//Clock commands
StephaneLenclud@28
   133
	void SendCommandSetClockData(unsigned char aHour, unsigned char aMinute);
StephaneLenclud@25
   134
	void SendCommandClockDisplay(TClockSize aClockSize, TClockFormat aClockFormat);	
StephaneLenclud@30
   135
	void AttemptClockSynchronization();
StephaneLenclud@25
   136
StephaneLenclud@27
   137
	//Graphics commands
StephaneLenclud@27
   138
	void SendCommandSetAddressCounter(unsigned char aAddressCounter);
StephaneLenclud@27
   139
	void SendCommandWriteGraphicData(int aSize, unsigned char* aPixels);
StephaneLenclud@27
   140
StephaneLenclud@31
   141
	//Icon/Symbol command
StephaneLenclud@31
   142
	void SendCommandSymbolControl(TIconId aIconId, TIconStatus aStatus);
StephaneLenclud@31
   143
StephaneLenclud@25
   144
    void RequestDeviceId();
StephaneLenclud@25
   145
    void RequestFirmwareRevision();
StephaneLenclud@25
   146
    void RequestPowerSupplyStatus();
StephaneLenclud@25
   147
	//
StephaneLenclud@28
   148
	void SetClockData();
StephaneLenclud@30
   149
	//
StephaneLenclud@25
   150
	void ResetBuffers();
StephaneLenclud@25
   151
StephaneLenclud@25
   152
private:
StephaneLenclud@25
   153
	///Off screen mode is the recommended default settings to avoid tearing.
StephaneLenclud@25
   154
	///Though turning it off can be useful for debugging
StephaneLenclud@25
   155
	bool iOffScreenMode;
StephaneLenclud@30
   156
	///We use this flag to align display clock seconds with system time
StephaneLenclud@30
   157
	bool iNeedAccurateClockData;
StephaneLenclud@28
   158
    //
StephaneLenclud@28
   159
	BitArrayLow* iFrameNext;
StephaneLenclud@25
   160
    BitArrayLow* iFrameCurrent;
StephaneLenclud@25
   161
    BitArrayLow* iFramePrevious;
StephaneLenclud@25
   162
    //
StephaneLenclud@28
   163
    BitArrayLow* iFrameAlpha; //owned
StephaneLenclud@28
   164
    BitArrayLow* iFrameBeta;  //owned
StephaneLenclud@28
   165
    BitArrayLow* iFrameGamma; //owned
StephaneLenclud@25
   166
	};
StephaneLenclud@25
   167
StephaneLenclud@25
   168
StephaneLenclud@25
   169
StephaneLenclud@25
   170
#endif