sl@8: // sl@8: // sl@8: // sl@8: sl@8: #ifndef FUTABA_GP1212A02_H sl@8: #define FUTABA_GP1212A02_H sl@8: sl@8: #include "FutabaGP1212.h" sl@10: #include "FutabaVfd.h" sl@10: sl@10: /** StephaneLenclud@25: GP1212A02A is a graphic display module using a FUTABA 256x64dots VFD. StephaneLenclud@25: The module will support the interface of I2C, RS-232C and USB2.0 communications. StephaneLenclud@25: The module include flash ROM (4Mbyte), the customer will definable the BMP data and download StephaneLenclud@25: character. StephaneLenclud@25: It realizes displaying a Japanese font (refer to Table-24) and BMP by I2C, RS-232C or USB2.0 StephaneLenclud@25: communications. Other font tables (ex. Chinese, Korean, European and custom font) can be appended to StephaneLenclud@25: flash ROM. StephaneLenclud@25: Since a DC/DC converter is included, 5V power source is required to operate the module. sl@10: */ sl@10: class GP1212A02A : public GP1212XXXX sl@10: { sl@10: public: sl@10: sl@10: GP1212A02A(); sl@10: ~GP1212A02A(); sl@10: sl@10: //From DisplayBase sl@10: int Open(); sl@10: virtual void SwapBuffers(); sl@16: virtual void TurnPowerOn(); sl@16: virtual void TurnPowerOff(); sl@17: virtual bool SupportPowerOnOff(){return true;} sl@17: virtual void ShowClock(); sl@17: virtual void HideClock(); sl@17: virtual bool SupportClock(){return true;} sl@17: sl@16: sl@10: sl@10: //From GraphicDisplay sl@22: virtual void SetPixel(unsigned char aX, unsigned char aY, unsigned int aPixel); sl@10: virtual void SetAllPixels(unsigned char aPattern); sl@10: virtual int FrameBufferSizeInBytes() const {return KGP12xFrameBufferSizeInBytes;} sl@10: virtual void SetBrightness(int aBrightness); sl@10: virtual void Clear(); sl@10: virtual void Fill(); sl@15: virtual void Request(TMiniDisplayRequest aRequest); sl@10: sl@14: sl@15: sl@10: // sl@10: void ToggleOffScreenMode(); sl@10: void SetOffScreenMode(bool aOn); sl@10: bool OffScreenMode() const {return iOffScreenMode;} sl@10: // sl@10: void SetFrameDifferencing(bool aOn){iUseFrameDifferencing=aOn;} sl@10: bool FrameDifferencing() const {return iUseFrameDifferencing;} sl@11: // sl@10: TMiniDisplayRequest AttemptRequestCompletion(); sl@10: FutabaVfdReport& InputReport() {return iInputReport;} sl@16: bool IsPowerOn(); sl@10: char* DeviceId(); sl@10: char* FirmwareRevision(); sl@10: sl@17: private: sl@17: sl@14: enum TBmpBoxId sl@14: { sl@14: EBmpBoxIdNull=0x30, sl@14: EBmpBoxIdOne=0x31, sl@14: EBmpBoxIdTwo=0x32, sl@14: EBmpBoxIdThree=0x33 sl@14: }; sl@14: sl@14: enum TTarget sl@14: { sl@14: ETargetDisplayWindow=0x30, sl@14: ETargetDataMemory=0x31 sl@14: }; sl@14: sl@14: enum TDirection sl@14: { sl@14: EDirectionY=0x30, sl@14: EDirectionX=0x31 sl@14: }; sl@14: sl@16: enum TPowerStatus sl@16: { sl@16: EPowerOff=0x30, sl@16: EPowerOn=0x31 sl@16: }; sl@14: sl@17: enum TWeekDay sl@17: { sl@17: ESunday = 0x00, sl@17: EMonday = 0x01, sl@17: ETuesday = 0x02, sl@17: EWednesday = 0x03, sl@17: EThrusday = 0x04, sl@17: EFriday = 0x05, sl@17: ESaturday = 0x06 sl@17: }; sl@17: sl@17: enum TClockFormat sl@17: { sl@17: EClock24 = 0x00, sl@17: EClockDay24 = 0x01, sl@17: EClock12 = 0x10, sl@17: EClockDay12 = 0x11 sl@17: }; sl@17: sl@21: enum TFontSizeLogical sl@17: { sl@21: EFontTiny = 0x30, sl@21: EFontSmall = 0x31, sl@21: EFontMedium = 0x32, sl@21: EFontLarge = 0x33 sl@17: }; sl@17: sl@20: enum TFontSize sl@20: { sl@20: EFont6x8 = 0x30, sl@20: EFont8x16 = 0x31, sl@20: EFont12x24 = 0x32, sl@20: EFont16x32 = 0x33, sl@20: EFont16x16 = 0x34, sl@20: EFont24x24 = 0x35, sl@20: EFont32x32 = 0x36 sl@20: }; sl@20: sl@20: enum TFontAction sl@20: { sl@20: EFontStore = 0x30, sl@20: EFontTransfer = 0x31, sl@20: EFontDelete = 0x32 sl@20: }; sl@20: sl@17: sl@15: private: sl@15: //Specific to GP1212A02A sl@14: //General setting command sl@17: void SendCommandClear(); sl@20: void SendCommandReset(); sl@17: // sl@14: void BmpDataInput(TTarget aTarget, unsigned short aAddress, TDirection aDirection, unsigned short aSize, unsigned char* aPixels); sl@17: // sl@17: void SendCommandPower(TPowerStatus aPowerStatus); sl@17: //Clock commands sl@17: void SendCommandClockSetting(TWeekDay aWeekDay, unsigned char aHour, unsigned char aMinute); sl@21: void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize); sl@17: void SendCommandClockCancel(); sl@20: //Font commands sl@20: void SendCommandDefineCharacter(TFontSize aFontSize, unsigned short aCharacterCode, unsigned char* aPixelData); sl@20: void SendCommandFontAction(TFontAction aFontAction); sl@21: void SendCommandSelectFontSize(TFontSizeLogical aFontSoze); sl@17: sl@14: sl@14: //BMP box sl@14: void BmpBoxSetting(TBmpBoxId aBoxId, unsigned short aAddress, int aWidth, int aHeight); sl@14: void BmpBoxSelect(TBmpBoxId aBoxId); sl@14: void BmpBoxDataMemoryTransfer(unsigned short aAddress); sl@14: void BmpBoxDataInput(unsigned short aSize, unsigned char* aPixels); sl@17: sl@17: //Clock utilities sl@17: int ClockCharCount(TClockFormat aFormat); sl@21: int ClockCharWidthInPixels(TFontSizeLogical aSize); sl@21: int ClockCharHeightInPixels(TFontSizeLogical aSize); sl@21: unsigned short ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize); sl@20: //Font utilities sl@20: int CharacterSizeInBytes(TFontSize aFontSize); sl@14: sl@10: private: sl@15: void RequestDeviceId(); sl@15: void RequestFirmwareRevision(); sl@15: void RequestPowerSupplyStatus(); sl@17: // sl@17: void SetClockSetting(); sl@15: sl@15: sl@15: private: sl@17: unsigned char OffScreenY() const; sl@10: void OffScreenTranslation(unsigned char& aX, unsigned char& aY); sl@10: void ResetBuffers(); sl@10: sl@10: private: sl@10: unsigned char iDisplayPositionX; sl@10: unsigned char iDisplayPositionY; sl@10: ///Off screen mode is the recommended default settings to avoid tearing. sl@10: ///Though turning it off can be useful for debugging sl@10: bool iOffScreenMode; sl@10: ///Frame differences algo is used to reduce USB bus traffic and improve frame rate in typical use case sl@10: bool iUseFrameDifferencing; sl@10: /// sl@10: //FutabaVfdReport iReport; sl@10: /// sl@10: //unsigned char iFrameBuffer[256*64]; sl@13: BitArrayLow* iFrameNext; sl@13: BitArrayLow* iFrameCurrent; sl@13: BitArrayLow* iFramePrevious; sl@10: // sl@13: BitArrayLow* iFrameAlpha; sl@13: BitArrayLow* iFrameBeta; sl@13: BitArrayLow* iFrameGamma; sl@10: // sl@10: int iNeedFullFrameUpdate; sl@10: //unsigned char iFrameBeta[256*64]; sl@10: //unsigned char *iFrontBuffer; sl@10: //unsigned char *iBackBuffer; sl@10: FutabaVfdReport iInputReport; sl@10: // sl@10: char iDeviceId[KFutabaMaxHidReportSize]; sl@10: char iFirmwareRevision[KFutabaMaxHidReportSize]; sl@10: bool iPowerOn; sl@15: // sl@15: unsigned short iNextFrameAddress; sl@10: }; sl@10: sl@8: sl@8: sl@8: #endif