forked from majestik666/Beagle_GPIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeagle_GPIO_KS0108.hh
123 lines (94 loc) · 2.91 KB
/
Beagle_GPIO_KS0108.hh
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/******************************
** Beagle Bone GPIO Library **
** **
** Francois Sugny **
** 01/07/12 **
** **
** v1.0 **
******************************/
//=======================================================
//=======================================================
#ifndef beagle_gpio_KS0108_hh
#define beagle_gpio_KS0108_hh
//=======================================================
//=======================================================
#include "Beagle_GPIO.hh"
//=======================================================
//=======================================================
class Beagle_GPIO_KS0108
{
public:
Beagle_GPIO_KS0108(
Beagle_GPIO * gpio,
unsigned short _pin_RS,
unsigned short _pin_RW,
unsigned short _pin_E,
unsigned short _pin_DB0,
unsigned short _pin_DB1,
unsigned short _pin_DB2,
unsigned short _pin_DB3,
unsigned short _pin_DB4,
unsigned short _pin_DB5,
unsigned short _pin_DB6,
unsigned short _pin_DB7,
unsigned short _pin_CS1,
unsigned short _pin_CS2 );
~Beagle_GPIO_KS0108();
// Initialize Screen
void initScreen();
// Clear Screen
void clearScreen();
// Write a string to screen
void write( const char * _string );
// Move to a specific position on screen
void goToPosition( unsigned char _x, unsigned char _y );
// Write a single pixel
void setPixel( unsigned char _x, unsigned char _y, unsigned char _c );
private:
// Write some data
void writeData( unsigned char _c );
// Read some data
unsigned char readData();
// Write a character
void writeChar( unsigned char _c );
// Write a command
void writeCommand( unsigned char _c, unsigned char _d );
// Enable Controller
void enableController( unsigned char _controller );
// Disable Controller
void disableController( unsigned char _controller );
// Set Data Port as Output
void setDataPortAsOutput();
// Set Data Port as Input
void setDataPortAsInput();
// Read Data Port
unsigned char readDataPort();
// Write Data Port
void writeDataPort( unsigned char _c );
// Read screen status
unsigned char readStatus( unsigned char _controller );
private:
Beagle_GPIO * m_gpio;
unsigned short m_pin_RS;
unsigned short m_pin_RW;
unsigned short m_pin_E;
unsigned short m_pin_DB0;
unsigned short m_pin_DB1;
unsigned short m_pin_DB2;
unsigned short m_pin_DB3;
unsigned short m_pin_DB4;
unsigned short m_pin_DB5;
unsigned short m_pin_DB6;
unsigned short m_pin_DB7;
unsigned short m_pin_CS1;
unsigned short m_pin_CS2;
unsigned short m_pin_CS3;
unsigned short m_pin_RST;
unsigned char m_screenX;
unsigned char m_screenY;
};
//=======================================================
//=======================================================
#endif
//=======================================================
//=======================================================