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