FutabaMDM166AA.h
author StephaneLenclud
Sat, 26 Sep 2015 11:45:26 +0200
changeset 39 c32f4955c166
parent 33 fc42477ae80b
permissions -rw-r--r--
More fixes to our NuGet package targets file.
StephaneLenclud@25
     1
//
StephaneLenclud@35
     2
// Copyright (C) 2014-2015 Stéphane Lenclud.
StephaneLenclud@25
     3
//
StephaneLenclud@35
     4
// This file is part of MiniDisplay.
StephaneLenclud@35
     5
//
StephaneLenclud@35
     6
// MiniDisplay is free software: you can redistribute it and/or modify
StephaneLenclud@35
     7
// it under the terms of the GNU General Public License as published by
StephaneLenclud@35
     8
// the Free Software Foundation, either version 3 of the License, or
StephaneLenclud@35
     9
// (at your option) any later version.
StephaneLenclud@35
    10
//
StephaneLenclud@35
    11
// MiniDisplay is distributed in the hope that it will be useful,
StephaneLenclud@35
    12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
StephaneLenclud@35
    13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
StephaneLenclud@35
    14
// GNU General Public License for more details.
StephaneLenclud@35
    15
//
StephaneLenclud@35
    16
// You should have received a copy of the GNU General Public License
StephaneLenclud@35
    17
// along with MiniDisplay.  If not, see <http://www.gnu.org/licenses/>.
StephaneLenclud@25
    18
//
StephaneLenclud@25
    19
StephaneLenclud@25
    20
#ifndef FUTABA_MDM166AA_H
StephaneLenclud@25
    21
#define FUTABA_MDM166AA_H
StephaneLenclud@25
    22
StephaneLenclud@25
    23
#include "FutabaVfd.h"
StephaneLenclud@25
    24
StephaneLenclud@25
    25
StephaneLenclud@25
    26
const int KMDM166AAWidthInPixels = 96;
StephaneLenclud@25
    27
const int KMDM166AAHeightInPixels = 16;
StephaneLenclud@25
    28
const int KMDM166AAPixelsPerByte = 8;
StephaneLenclud@25
    29
const int KMDM166AAFrameBufferSizeInBytes = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels/KMDM166AAPixelsPerByte; //96*16/8=192
StephaneLenclud@25
    30
const int KMDM166AAFrameBufferPixelCount = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels;
StephaneLenclud@25
    31
StephaneLenclud@25
    32
StephaneLenclud@25
    33
/**
StephaneLenclud@25
    34
MDM166AA is a graphic display module using a FUTABA 96x16dots VFD.
StephaneLenclud@25
    35
*/
StephaneLenclud@25
    36
class MDM166AA : public FutabaGraphicDisplay
StephaneLenclud@25
    37
	{
StephaneLenclud@25
    38
public:
StephaneLenclud@25
    39
    MDM166AA();
StephaneLenclud@25
    40
    ~MDM166AA();
StephaneLenclud@25
    41
StephaneLenclud@25
    42
	//From DisplayBase
StephaneLenclud@25
    43
	virtual int Open();
StephaneLenclud@25
    44
	virtual void SwapBuffers();
StephaneLenclud@25
    45
		//Brightness support
StephaneLenclud@25
    46
    virtual int MinBrightness() const {return 0;}
StephaneLenclud@25
    47
    virtual int MaxBrightness() const {return 2;}
StephaneLenclud@25
    48
	virtual void SetBrightness(int aBrightness);
StephaneLenclud@25
    49
		//Clock support
StephaneLenclud@25
    50
	virtual void ShowClock();
StephaneLenclud@25
    51
	virtual void HideClock();
StephaneLenclud@25
    52
	virtual bool SupportClock(){return true;}
StephaneLenclud@31
    53
		//Icons
StephaneLenclud@32
    54
	virtual int IconCount(TMiniDisplayIconType aIcon);
StephaneLenclud@32
    55
	virtual int IconStatusCount(TMiniDisplayIconType aIcon);
StephaneLenclud@32
    56
	virtual void SetIconStatus(TMiniDisplayIconType aIcon, int aIndex, int aStatus);
StephaneLenclud@25
    57
StephaneLenclud@25
    58
	//From GraphicDisplay
StephaneLenclud@25
    59
    virtual int WidthInPixels() const {return KMDM166AAWidthInPixels;}
StephaneLenclud@25
    60
    virtual int HeightInPixels() const {return KMDM166AAHeightInPixels;}
StephaneLenclud@25
    61
StephaneLenclud@25
    62
	virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel);
StephaneLenclud@25
    63
	virtual void SetAllPixels(unsigned char aPattern);
StephaneLenclud@25
    64
    virtual int FrameBufferSizeInBytes() const {return KMDM166AAFrameBufferSizeInBytes;}	
StephaneLenclud@25
    65
	virtual void Clear();
StephaneLenclud@25
    66
	virtual void Fill();
StephaneLenclud@25
    67
	virtual void Request(TMiniDisplayRequest aRequest);
StephaneLenclud@25
    68
		
StephaneLenclud@25
    69
	//
StephaneLenclud@25
    70
	void ToggleOffScreenMode();
StephaneLenclud@25
    71
    void SetOffScreenMode(bool aOn);
StephaneLenclud@25
    72
    bool OffScreenMode() const {return iOffScreenMode;}
StephaneLenclud@25
    73
StephaneLenclud@32
    74
		//Icon specific
StephaneLenclud@33
    75
	void SetIconNetworkSignal(int aIndex, int aStatus);
StephaneLenclud@33
    76
	void SetIconInternet(int aIndex, int aStatus);
StephaneLenclud@32
    77
	void SetIconEmail(int aIndex, int aStatus);
StephaneLenclud@32
    78
	void SetIconMute(int aIndex, int aStatus);
StephaneLenclud@32
    79
	void SetIconVolumeLabel(int aIndex, int aStatus);
StephaneLenclud@32
    80
	void SetIconVolume(int aIndex, int aStatus);
StephaneLenclud@32
    81
	void SetIconPlay(int aIndex, int aStatus);
StephaneLenclud@32
    82
	void SetIconPause(int aIndex, int aStatus);
StephaneLenclud@32
    83
	void SetIconRecording(int aIndex, int aStatus);
StephaneLenclud@32
    84
StephaneLenclud@32
    85
StephaneLenclud@25
    86
private:
StephaneLenclud@25
    87
StephaneLenclud@25
    88
	enum TClockFormat
StephaneLenclud@28
    89
		{
StephaneLenclud@25
    90
		EClock12	=	0x00,
StephaneLenclud@25
    91
		EClock24	=	0x01,
StephaneLenclud@28
    92
		};
StephaneLenclud@25
    93
StephaneLenclud@25
    94
	enum TClockSize
StephaneLenclud@28
    95
		{
StephaneLenclud@25
    96
		EClockSmall		=	0x01,
StephaneLenclud@25
    97
		EClockLarge		=	0x02
StephaneLenclud@28
    98
		};
StephaneLenclud@25
    99
	
StephaneLenclud@31
   100
	enum TIconId
StephaneLenclud@31
   101
		{		
StephaneLenclud@31
   102
		EIconPlay				=	0x00,
StephaneLenclud@31
   103
		EIconPause				=	0x01,
StephaneLenclud@31
   104
		EIconRecording			=	0x02,
StephaneLenclud@31
   105
		EIconEnvelop			=	0x03,
StephaneLenclud@31
   106
		EIconAt					=	0x04,
StephaneLenclud@31
   107
		EIconMute				=	0x05,
StephaneLenclud@31
   108
		EIconNetworkMast		=   0x06,
StephaneLenclud@31
   109
		EIconNetworkSignalLow	=   0x07,
StephaneLenclud@31
   110
		EIconNetworkSignalMid	=   0x08,
StephaneLenclud@31
   111
		EIconNetworkSignalHigh	=   0x09,
StephaneLenclud@31
   112
		EIconVolumeLabel		=   0x0A,
StephaneLenclud@31
   113
		EIconVolumeLevel01		=   0x0B,
StephaneLenclud@31
   114
		EIconVolumeLevel02		=   0x0C,
StephaneLenclud@31
   115
		EIconVolumeLevel03		=   0x0D,
StephaneLenclud@31
   116
		EIconVolumeLevel04		=   0x0E,
StephaneLenclud@31
   117
		EIconVolumeLevel05		=   0x0F,
StephaneLenclud@31
   118
		EIconVolumeLevel06		=   0x10,
StephaneLenclud@31
   119
		EIconVolumeLevel07		=   0x11,
StephaneLenclud@31
   120
		EIconVolumeLevel08		=   0x12,
StephaneLenclud@31
   121
		EIconVolumeLevel09		=   0x13,
StephaneLenclud@31
   122
		EIconVolumeLevel10		=   0x14,
StephaneLenclud@31
   123
		EIconVolumeLevel11		=   0x15,
StephaneLenclud@31
   124
		EIconVolumeLevel12		=   0x16,
StephaneLenclud@31
   125
		EIconVolumeLevel13		=   0x17,
StephaneLenclud@31
   126
		EIconVolumeLevel14		=   0x18,
StephaneLenclud@31
   127
		EIconFirst				=   EIconPlay,
StephaneLenclud@31
   128
		EIconLast				=	EIconVolumeLevel14,		
StephaneLenclud@31
   129
		};
StephaneLenclud@31
   130
StephaneLenclud@31
   131
	enum TIconStatus
StephaneLenclud@31
   132
		{
StephaneLenclud@31
   133
		EIconOff		=	0x00,
StephaneLenclud@31
   134
		EIconFaded		=	0x01,
StephaneLenclud@31
   135
		EIconOn			=	0x02
StephaneLenclud@31
   136
		};
StephaneLenclud@31
   137
	
StephaneLenclud@25
   138
StephaneLenclud@25
   139
private:
StephaneLenclud@31
   140
	//Testing
StephaneLenclud@31
   141
	void SetAllIcons(TIconStatus aStatus);
StephaneLenclud@31
   142
StephaneLenclud@25
   143
	//Specific to MDM166AA
StephaneLenclud@25
   144
	//General setting command
StephaneLenclud@25
   145
	void SendCommandClear();
StephaneLenclud@25
   146
	void SendCommandReset();
StephaneLenclud@25
   147
	//
StephaneLenclud@25
   148
	//Clock commands
StephaneLenclud@28
   149
	void SendCommandSetClockData(unsigned char aHour, unsigned char aMinute);
StephaneLenclud@25
   150
	void SendCommandClockDisplay(TClockSize aClockSize, TClockFormat aClockFormat);	
StephaneLenclud@30
   151
	void AttemptClockSynchronization();
StephaneLenclud@25
   152
StephaneLenclud@27
   153
	//Graphics commands
StephaneLenclud@27
   154
	void SendCommandSetAddressCounter(unsigned char aAddressCounter);
StephaneLenclud@27
   155
	void SendCommandWriteGraphicData(int aSize, unsigned char* aPixels);
StephaneLenclud@27
   156
StephaneLenclud@31
   157
	//Icon/Symbol command
StephaneLenclud@31
   158
	void SendCommandSymbolControl(TIconId aIconId, TIconStatus aStatus);
StephaneLenclud@31
   159
StephaneLenclud@25
   160
    void RequestDeviceId();
StephaneLenclud@25
   161
    void RequestFirmwareRevision();
StephaneLenclud@25
   162
    void RequestPowerSupplyStatus();
StephaneLenclud@25
   163
	//
StephaneLenclud@28
   164
	void SetClockData();
StephaneLenclud@30
   165
	//
StephaneLenclud@25
   166
	void ResetBuffers();
StephaneLenclud@25
   167
StephaneLenclud@25
   168
private:
StephaneLenclud@25
   169
	///Off screen mode is the recommended default settings to avoid tearing.
StephaneLenclud@25
   170
	///Though turning it off can be useful for debugging
StephaneLenclud@25
   171
	bool iOffScreenMode;
StephaneLenclud@30
   172
	///We use this flag to align display clock seconds with system time
StephaneLenclud@30
   173
	bool iNeedAccurateClockData;
StephaneLenclud@28
   174
    //
StephaneLenclud@28
   175
	BitArrayLow* iFrameNext;
StephaneLenclud@25
   176
    BitArrayLow* iFrameCurrent;
StephaneLenclud@25
   177
    BitArrayLow* iFramePrevious;
StephaneLenclud@25
   178
    //
StephaneLenclud@28
   179
    BitArrayLow* iFrameAlpha; //owned
StephaneLenclud@28
   180
    BitArrayLow* iFrameBeta;  //owned
StephaneLenclud@28
   181
    BitArrayLow* iFrameGamma; //owned
StephaneLenclud@25
   182
	};
StephaneLenclud@25
   183
StephaneLenclud@25
   184
StephaneLenclud@25
   185
StephaneLenclud@25
   186
#endif