StephaneLenclud@25: // StephaneLenclud@35: // Copyright (C) 2014-2015 Stéphane Lenclud. StephaneLenclud@25: // StephaneLenclud@35: // This file is part of MiniDisplay. StephaneLenclud@35: // StephaneLenclud@35: // MiniDisplay is free software: you can redistribute it and/or modify StephaneLenclud@35: // it under the terms of the GNU General Public License as published by StephaneLenclud@35: // the Free Software Foundation, either version 3 of the License, or StephaneLenclud@35: // (at your option) any later version. StephaneLenclud@35: // StephaneLenclud@35: // MiniDisplay is distributed in the hope that it will be useful, StephaneLenclud@35: // but WITHOUT ANY WARRANTY; without even the implied warranty of StephaneLenclud@35: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the StephaneLenclud@35: // GNU General Public License for more details. StephaneLenclud@35: // StephaneLenclud@35: // You should have received a copy of the GNU General Public License StephaneLenclud@35: // along with MiniDisplay. If not, see . StephaneLenclud@25: // StephaneLenclud@25: StephaneLenclud@25: #ifndef FUTABA_MDM166AA_H StephaneLenclud@25: #define FUTABA_MDM166AA_H StephaneLenclud@25: StephaneLenclud@25: #include "FutabaVfd.h" StephaneLenclud@25: StephaneLenclud@25: StephaneLenclud@25: const int KMDM166AAWidthInPixels = 96; StephaneLenclud@25: const int KMDM166AAHeightInPixels = 16; StephaneLenclud@25: const int KMDM166AAPixelsPerByte = 8; StephaneLenclud@25: const int KMDM166AAFrameBufferSizeInBytes = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels/KMDM166AAPixelsPerByte; //96*16/8=192 StephaneLenclud@25: const int KMDM166AAFrameBufferPixelCount = KMDM166AAWidthInPixels*KMDM166AAHeightInPixels; StephaneLenclud@25: StephaneLenclud@25: StephaneLenclud@25: /** StephaneLenclud@25: MDM166AA is a graphic display module using a FUTABA 96x16dots VFD. StephaneLenclud@25: */ StephaneLenclud@25: class MDM166AA : public FutabaGraphicDisplay StephaneLenclud@25: { StephaneLenclud@25: public: StephaneLenclud@25: MDM166AA(); StephaneLenclud@25: ~MDM166AA(); StephaneLenclud@25: StephaneLenclud@25: //From DisplayBase StephaneLenclud@25: virtual int Open(); StephaneLenclud@25: virtual void SwapBuffers(); StephaneLenclud@25: //Brightness support StephaneLenclud@25: virtual int MinBrightness() const {return 0;} StephaneLenclud@25: virtual int MaxBrightness() const {return 2;} StephaneLenclud@25: virtual void SetBrightness(int aBrightness); StephaneLenclud@25: //Clock support StephaneLenclud@25: virtual void ShowClock(); StephaneLenclud@25: virtual void HideClock(); StephaneLenclud@25: virtual bool SupportClock(){return true;} StephaneLenclud@31: //Icons StephaneLenclud@32: virtual int IconCount(TMiniDisplayIconType aIcon); StephaneLenclud@32: virtual int IconStatusCount(TMiniDisplayIconType aIcon); StephaneLenclud@32: virtual void SetIconStatus(TMiniDisplayIconType aIcon, int aIndex, int aStatus); StephaneLenclud@25: StephaneLenclud@25: //From GraphicDisplay StephaneLenclud@25: virtual int WidthInPixels() const {return KMDM166AAWidthInPixels;} StephaneLenclud@25: virtual int HeightInPixels() const {return KMDM166AAHeightInPixels;} StephaneLenclud@25: StephaneLenclud@25: virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel); StephaneLenclud@25: virtual void SetAllPixels(unsigned char aPattern); StephaneLenclud@25: virtual int FrameBufferSizeInBytes() const {return KMDM166AAFrameBufferSizeInBytes;} StephaneLenclud@25: virtual void Clear(); StephaneLenclud@25: virtual void Fill(); StephaneLenclud@25: virtual void Request(TMiniDisplayRequest aRequest); StephaneLenclud@25: StephaneLenclud@25: // StephaneLenclud@25: void ToggleOffScreenMode(); StephaneLenclud@25: void SetOffScreenMode(bool aOn); StephaneLenclud@25: bool OffScreenMode() const {return iOffScreenMode;} StephaneLenclud@25: StephaneLenclud@32: //Icon specific StephaneLenclud@33: void SetIconNetworkSignal(int aIndex, int aStatus); StephaneLenclud@33: void SetIconInternet(int aIndex, int aStatus); StephaneLenclud@32: void SetIconEmail(int aIndex, int aStatus); StephaneLenclud@32: void SetIconMute(int aIndex, int aStatus); StephaneLenclud@32: void SetIconVolumeLabel(int aIndex, int aStatus); StephaneLenclud@32: void SetIconVolume(int aIndex, int aStatus); StephaneLenclud@32: void SetIconPlay(int aIndex, int aStatus); StephaneLenclud@32: void SetIconPause(int aIndex, int aStatus); StephaneLenclud@32: void SetIconRecording(int aIndex, int aStatus); StephaneLenclud@32: StephaneLenclud@32: StephaneLenclud@25: private: StephaneLenclud@25: StephaneLenclud@25: enum TClockFormat StephaneLenclud@28: { StephaneLenclud@25: EClock12 = 0x00, StephaneLenclud@25: EClock24 = 0x01, StephaneLenclud@28: }; StephaneLenclud@25: StephaneLenclud@25: enum TClockSize StephaneLenclud@28: { StephaneLenclud@25: EClockSmall = 0x01, StephaneLenclud@25: EClockLarge = 0x02 StephaneLenclud@28: }; StephaneLenclud@25: StephaneLenclud@31: enum TIconId StephaneLenclud@31: { StephaneLenclud@31: EIconPlay = 0x00, StephaneLenclud@31: EIconPause = 0x01, StephaneLenclud@31: EIconRecording = 0x02, StephaneLenclud@31: EIconEnvelop = 0x03, StephaneLenclud@31: EIconAt = 0x04, StephaneLenclud@31: EIconMute = 0x05, StephaneLenclud@31: EIconNetworkMast = 0x06, StephaneLenclud@31: EIconNetworkSignalLow = 0x07, StephaneLenclud@31: EIconNetworkSignalMid = 0x08, StephaneLenclud@31: EIconNetworkSignalHigh = 0x09, StephaneLenclud@31: EIconVolumeLabel = 0x0A, StephaneLenclud@31: EIconVolumeLevel01 = 0x0B, StephaneLenclud@31: EIconVolumeLevel02 = 0x0C, StephaneLenclud@31: EIconVolumeLevel03 = 0x0D, StephaneLenclud@31: EIconVolumeLevel04 = 0x0E, StephaneLenclud@31: EIconVolumeLevel05 = 0x0F, StephaneLenclud@31: EIconVolumeLevel06 = 0x10, StephaneLenclud@31: EIconVolumeLevel07 = 0x11, StephaneLenclud@31: EIconVolumeLevel08 = 0x12, StephaneLenclud@31: EIconVolumeLevel09 = 0x13, StephaneLenclud@31: EIconVolumeLevel10 = 0x14, StephaneLenclud@31: EIconVolumeLevel11 = 0x15, StephaneLenclud@31: EIconVolumeLevel12 = 0x16, StephaneLenclud@31: EIconVolumeLevel13 = 0x17, StephaneLenclud@31: EIconVolumeLevel14 = 0x18, StephaneLenclud@31: EIconFirst = EIconPlay, StephaneLenclud@31: EIconLast = EIconVolumeLevel14, StephaneLenclud@31: }; StephaneLenclud@31: StephaneLenclud@31: enum TIconStatus StephaneLenclud@31: { StephaneLenclud@31: EIconOff = 0x00, StephaneLenclud@31: EIconFaded = 0x01, StephaneLenclud@31: EIconOn = 0x02 StephaneLenclud@31: }; StephaneLenclud@31: StephaneLenclud@25: StephaneLenclud@25: private: StephaneLenclud@31: //Testing StephaneLenclud@31: void SetAllIcons(TIconStatus aStatus); StephaneLenclud@31: StephaneLenclud@25: //Specific to MDM166AA StephaneLenclud@25: //General setting command StephaneLenclud@25: void SendCommandClear(); StephaneLenclud@25: void SendCommandReset(); StephaneLenclud@25: // StephaneLenclud@25: //Clock commands StephaneLenclud@28: void SendCommandSetClockData(unsigned char aHour, unsigned char aMinute); StephaneLenclud@25: void SendCommandClockDisplay(TClockSize aClockSize, TClockFormat aClockFormat); StephaneLenclud@30: void AttemptClockSynchronization(); StephaneLenclud@25: StephaneLenclud@27: //Graphics commands StephaneLenclud@27: void SendCommandSetAddressCounter(unsigned char aAddressCounter); StephaneLenclud@27: void SendCommandWriteGraphicData(int aSize, unsigned char* aPixels); StephaneLenclud@27: StephaneLenclud@31: //Icon/Symbol command StephaneLenclud@31: void SendCommandSymbolControl(TIconId aIconId, TIconStatus aStatus); StephaneLenclud@31: StephaneLenclud@25: void RequestDeviceId(); StephaneLenclud@25: void RequestFirmwareRevision(); StephaneLenclud@25: void RequestPowerSupplyStatus(); StephaneLenclud@25: // StephaneLenclud@28: void SetClockData(); StephaneLenclud@30: // StephaneLenclud@25: void ResetBuffers(); StephaneLenclud@25: StephaneLenclud@25: private: StephaneLenclud@25: ///Off screen mode is the recommended default settings to avoid tearing. StephaneLenclud@25: ///Though turning it off can be useful for debugging StephaneLenclud@25: bool iOffScreenMode; StephaneLenclud@30: ///We use this flag to align display clock seconds with system time StephaneLenclud@30: bool iNeedAccurateClockData; StephaneLenclud@28: // StephaneLenclud@28: BitArrayLow* iFrameNext; StephaneLenclud@25: BitArrayLow* iFrameCurrent; StephaneLenclud@25: BitArrayLow* iFramePrevious; StephaneLenclud@25: // StephaneLenclud@28: BitArrayLow* iFrameAlpha; //owned StephaneLenclud@28: BitArrayLow* iFrameBeta; //owned StephaneLenclud@28: BitArrayLow* iFrameGamma; //owned StephaneLenclud@25: }; StephaneLenclud@25: StephaneLenclud@25: StephaneLenclud@25: StephaneLenclud@25: #endif