summaryrefslogtreecommitdiff
path: root/glcddrivers/usbserlcd.h
blob: abd6f8dedbd13c4bbadbba80e27cc38f84abb674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * GraphLCD driver library
 *
 * t6963c.h  -  T6963C driver class
 *
 * low level routines based on lcdproc 0.5 driver, (c) 2001 Manuel Stahl
 *
 * This file is released under the GNU General Public License. Refer
 * to the COPYING file distributed with this package.
 *
 * (c) 2003-2004 Andreas Regel <andreas.regel AT powarman.de>
 * (c) 2011      Wolfgang Astleitner <mrwastl AT users.sourceforge.net>
 */

#ifndef _GLCDDRIVERS_USBSERLED_H_
#define _GLCDDRIVERS_USBSERLED_H_

#include "driver.h"

namespace GLCD
{

class cDriverConfig;
class cSerialPort;

// Possible serial package types
enum glcd_pkgtype: char {
  PKGTYPE_DATA,
  PKGTYPE_BRIGHTNESS
};

class cDriverUSBserLCD : public cDriver
{
private:
    cSerialPort * port;
    unsigned char ** newLCD; // wanted state
    unsigned char ** oldLCD; // current state
    int refreshCounter;
    int displayMode;

    int FS;
    char brightness;

    int CheckSetup();

public:
    cDriverUSBserLCD(cDriverConfig * config);
    virtual ~cDriverUSBserLCD();

    virtual int Init();
    virtual int DeInit();

    virtual void Clear();
    virtual void SetPixel(int x, int y, uint32_t data);
    virtual void Refresh(bool refreshAll = false);
    virtual void SetBrightness(unsigned int percent);
};


class cDriverUSBserLCDBuffer {
private:
    std::string buffer;

public:
    cDriverUSBserLCDBuffer(int aExpectedBytes);
    int GetLength() const;
    void Append(std::string aBytes, uint16_t aAddress);
    std::string GetString() const;
};

} // end of namespace

#endif