forked from majestik666/Beagle_GPIO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Beagle_GPIO_Nokia6100.hh
187 lines (154 loc) · 4.46 KB
/
Beagle_GPIO_Nokia6100.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/******************************
** Beagle Bone GPIO Library **
** **
** Francois Sugny **
** 01/07/12 **
** **
** v1.0 **
******************************/
//=======================================================
//=======================================================
#ifndef beagle_gpio_Nokia6100_hh
#define beagle_gpio_Nokia6100_hh
//=======================================================
//=======================================================
#include "Beagle_GPIO.hh"
//=======================================================
//=======================================================
class Beagle_GPIO_Nokia6100
{
public:
// Regular pins
Beagle_GPIO_Nokia6100(
Beagle_GPIO * gpio,
unsigned short _pin_CS,
unsigned short _pin_SCLK,
unsigned short _pin_SDATA,
unsigned short _pin_RESET );
// SPI
Beagle_GPIO_Nokia6100(
Beagle_GPIO * gpio,
unsigned short _pin_RESET );
~Beagle_GPIO_Nokia6100();
// Initialize Screen
void initScreen();
// Clear Screen
void clearScreen();
// Write a string to screen
void print( unsigned char _x,
unsigned char _y,
const char * _string,
unsigned char _r,
unsigned char _g,
unsigned char _b );
void printInBuffer( unsigned char _x,
unsigned char _y,
unsigned char * _buffer,
unsigned char _width,
unsigned char _height,
const char * _string,
unsigned char _r,
unsigned char _g,
unsigned char _b );
// Write a single pixel
void setPixel( unsigned char _x, unsigned char _y, unsigned char _r, unsigned char _g, unsigned char _b );
// Fill a box on screen
void fillBox( unsigned char _x1, unsigned char _y1, unsigned char _x2, unsigned char _y2, unsigned char _c, unsigned char _g, unsigned char _b );
// Write a buffer to screen
void writeBuffer( unsigned char *buffer, unsigned char _x, unsigned char _y, unsigned char _w, unsigned char _h );
private:
// Shift a byte to the screen
void shiftBits( unsigned char _c );
// Send a command to the screen
void sendCommand( unsigned char _cmd );
// Send data to the screen
void sendData( unsigned char _data );
// Set window on display
void setWindow( unsigned char _x1, unsigned char _y1, unsigned char _x2, unsigned char _y2 );
// Write a single character
void printChar( unsigned char _x,
unsigned char _y,
char _c,
unsigned char _r,
unsigned char _g,
unsigned char _b );
void printCharInBuffer( unsigned char _x,
unsigned char _y,
unsigned char * _buffer,
unsigned char _width,
unsigned char _height,
char _c,
unsigned char _r,
unsigned char _g,
unsigned char _b );
// Write a pair of pixels at a time
void writePair( unsigned char _r1,
unsigned char _g1,
unsigned char _b1,
unsigned char _r2,
unsigned char _g2,
unsigned char _b2 );
// Add a command to the SPI Buffer
void addSPICommand( unsigned char _cmd );
// Add data to the SPI Buffe
void addSPIData( unsigned char _data );
// Sends an SPI Buffer to screen
void sendSPIBuffer();
private:
unsigned char m_use_SPI;
unsigned char * m_spi_buffer;
unsigned int m_spi_buffer_index;
Beagle_GPIO * m_gpio;
unsigned short m_pin_BL;
unsigned short m_pin_CS;
unsigned short m_pin_SCLK;
unsigned short m_pin_SDATA;
unsigned short m_pin_RESET;
// Array storing the font
static const unsigned char font_5x8[];
public:
enum
{
// Epson S1D15G10 Command Set
kSWRESET = 0x01,
kCASET = 0x15,
kPWRCTR = 0x20,
kNOP = 0x25,
kRAMWR = 0x5c,
kRAMRD = 0x5d,
kPASET = 0x75,
kEPSRRD1 = 0x7c,
kEPSRRD2 = 0x7d,
kVOLCTR = 0x81,
kTMPGRD = 0x82,
kSLPOUT = 0x94,
kSLPIN = 0x95,
kDISNOR = 0xa6,
kDISINV = 0xa7,
kPTLIN = 0xa8,
kPTLOUT = 0xa9,
kASCSET = 0xaa,
kSCSTART = 0xab,
kDISOFF = 0xae,
kDISON = 0xaf,
kCOMSCN = 0xbb,
kDATCTL = 0xbc,
kDISCTL = 0xca,
kEPCOUT = 0xcc,
kRGBSET8 = 0xce,
kEPCTIN = 0xcd,
kOSCON = 0xd1,
kOSCOFF = 0xd2,
kVOLUP = 0xd6,
kVOLDOWN = 0xd7,
kRMWIN = 0xe0,
kRMWOUT = 0xee,
kEPMWR = 0xfc,
kEPMRD = 0xfd
} Commands;
};
//=======================================================
//=======================================================
#endif
//=======================================================
//=======================================================