graphlcd-base/glcddrivers/picctl.h
author root@rika
Thu, 23 Apr 2009 19:10:12 +0200
changeset 30 7fd00015f62f
parent 8 5fa05abec614
permissions -rw-r--r--
several changes..
     1 /*
     2  * GraphLCD driver library
     3  *
     4  * picctl.c  -  PIC controlled LCD driver class
     5  *
     6  * This file is released under the GNU General Public License. Refer
     7  * to the COPYING file distributed with this package.
     8  *
     9  * Codebase by Andreas Regel <andreas.regel AT powarman.de>
    10  * (c) 2007 Carsten Presser
    11  */
    12 
    13 #ifndef _GLCDDRIVERS_PICCTL_H_
    14 #define _GLCDDRIVERS_PICCTL_H_
    15 
    16 #include "driver.h"
    17 
    18 namespace GLCD
    19 {
    20 
    21 class cDriverConfig;
    22 class cSerialPort;
    23 
    24 class cDriverPICCtl : public cDriver
    25 {
    26 private:
    27     cSerialPort * port;
    28     unsigned char ** newLCD; // wanted state
    29     unsigned char ** oldLCD; // current state
    30     cDriverConfig * config;
    31     cDriverConfig * oldConfig;
    32 
    33     int WaitForAck(void);
    34     void CmdDispClearScreen(void);
    35     void CmdSetMode(uint8_t mode);
    36     void CmdDispSetManaged(void);
    37     void CmdDispSetUnManaged(void);
    38     void CmdDispSetBrightness(uint8_t percent);
    39     void CmdDispSetColData(uint8_t yoffset, uint8_t xoffset, uint8_t length, uint8_t * data);
    40     int  CheckSetup();
    41     void DecodeCmd(uint8_t * cmd, uint8_t len);
    42     void InputHandler();
    43 
    44     uint8_t buf[255];
    45     uint8_t buf_pos;
    46     uint8_t buf_cmd_start;
    47     bool    buf_flag_escape;
    48     int     keys[255];
    49     uint8_t keys_pos;
    50     uint8_t keys_pos_;
    51     
    52     int  refreshCounter;
    53     bool ack_flag;
    54 
    55 
    56 public:
    57     virtual int Init();
    58     virtual int DeInit();
    59 
    60     virtual void Clear();
    61     virtual void Set8Pixels(int x, int y, unsigned char data);
    62     virtual void Refresh(bool refreshAll = false);
    63     virtual void SetBrightness(unsigned int percent);
    64     virtual int  GetKey();
    65     virtual bool HasKeys();
    66 
    67     cDriverPICCtl(cDriverConfig * config);	// Konstruktor
    68     virtual ~cDriverPICCtl();			// Destruktor
    69 };
    70 
    71 } // end of namespace
    72 
    73 #endif