graphlcd-base/glcddrivers/gu126x64D-K610A4.h
author root@rika
Thu, 23 Apr 2009 20:55:41 +0200
changeset 33 7a0c4b0354ba
parent 4 df6a40031aa5
permissions -rw-r--r--
updated documentation
     1 /*
     2  * GraphLCD driver library
     3  *
     4  * gu126x64D-K610A4.h -  8-bit driver module for Noritake GU126x64D-K610A4 VFD
     5  *                       displays. The VFD is operating in its 8 bit-mode
     6  *                       connected to a single PC parallel port.
     7  *
     8  * based on:
     9  *   gu256x64-372 driver module for graphlcd
    10  *     (c) 2004 Andreas 'randy' Weinberger (randy AT smue.org)
    11  *   gu256x64-3900 driver module for graphlcd
    12  *     (c) 2004 Ralf Mueller (ralf AT bj-ig.de)
    13  *   gu140x32f driver module for graphlcd
    14  *     (c) 2003 Andreas Brachold <vdr04 AT deltab.de>
    15  *   ks0108 driver module for graphlcd
    16  *     (c) 2004 Andreas 'randy' Weinberger (randy AT smue.org)
    17  *
    18  * This file is released under the GNU General Public License. Refer
    19  * to the COPYING file distributed with this package.
    20  *
    21  * (c) 2007 Alexander Rieger (Alexander.Rieger AT inka.de)
    22  */
    23 
    24 #ifndef _GLCDDRIVERS_GU126X64D_K610A4_H_
    25 #define _GLCDDRIVERS_GU126X64D_K610A4_H_
    26 
    27 #include "driver.h"
    28 
    29 //===============================================================================
    30 //     namespace GLCD
    31 //===============================================================================
    32 namespace GLCD
    33 {
    34 
    35 class cDriverConfig;
    36 class cParallelPort;
    37 
    38 //===============================================================================
    39 //     class cDriverGU126X64D_K610A4
    40 //===============================================================================
    41 class cDriverGU126X64D_K610A4 : public cDriver
    42 {
    43 public:
    44     //---------------------------------------------------------------------------
    45     //     constructor/destructor
    46     //---------------------------------------------------------------------------
    47     cDriverGU126X64D_K610A4(cDriverConfig * config);
    48     virtual ~cDriverGU126X64D_K610A4();
    49 
    50     //---------------------------------------------------------------------------
    51     //     from cDriver
    52     //---------------------------------------------------------------------------
    53     virtual int Init();
    54     virtual int DeInit();
    55 
    56     virtual void Clear();
    57     virtual void Set8Pixels(int x, int y, unsigned char data);
    58     virtual void Refresh(bool refreshAll = false);
    59     virtual void SetBrightness(unsigned int percent);
    60 
    61     //---------------------------------------------------------------------------
    62     //     display-specific enums/methods/etc.
    63     //---------------------------------------------------------------------------
    64     enum FontType
    65     {
    66         FONT_PROP_SML
    67     ,   FONT_FIX_MED
    68     ,   FONT_FIX_BIG
    69     };
    70 
    71     void setPixel        (int x, int y);
    72 
    73     int  cmdReset        ();
    74     int  cmdPower        (bool fOn);
    75     int  cmdLock         (bool fLock);
    76     int  cmdSetCursorPos (unsigned char x, unsigned char y);
    77     int  cmdGraphicWrite (unsigned char count);
    78     int  cmdGraphicData  (unsigned char data);
    79     int  cmdSetBrightness(unsigned int  percent);
    80     int  cmdSetFont      (FontType);
    81     int  cmdWriteText    (const char *theText);
    82     int  cmdDrawRect     (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2);
    83     int  cmdSetMacro     (unsigned char theMacroNum, unsigned char theCountBytes);
    84     int  cmdSetPixel     (bool fSet = true);
    85     int  cmdClrPixel     ();
    86 
    87     void claimPort();
    88     void releasePort();
    89 
    90 private:
    91     //---------------------------------------------------------------------------
    92     //     helper methods
    93     //---------------------------------------------------------------------------
    94     void clearVFDMem();
    95     int  checkSetup();
    96     int  initParallelPort();
    97     void initDisplay();
    98 
    99     bool waitForStatus(unsigned char theMask, unsigned char theValue, int theMaxWait);
   100     void writeParallel(unsigned char data);
   101     int  write(unsigned char data);
   102 
   103     void ensureNotInGraphics();
   104     bool isLogEnabled(int theLevel) const;
   105 
   106     //---------------------------------------------------------------------------
   107     //     attributes
   108     //---------------------------------------------------------------------------
   109     cParallelPort  *port;
   110 
   111     cDriverConfig  *config;
   112     cDriverConfig  *oldConfig;
   113 
   114     int             myNumRows;
   115     unsigned char **myDrawMem;
   116     unsigned char **myVFDMem;
   117 
   118     bool            myUseSleepInit;
   119     long            myPortDelayNS;
   120     long            myDelay125NS;
   121     int             myRefreshCounter;
   122     int             myClaimCounter;
   123     int             myDataPendingCounter;
   124     unsigned int    myLogFlags;
   125 
   126 }; // class cDriverGU126X64D_K610A4
   127 
   128 } // namespace GLCD
   129 
   130 #endif