User | Revision | Line number | New contents of line |
Midimetric |
0:601fd83c75e0
|
1
|
/* mbed DogM Graphic Display Library
|
Midimetric |
0:601fd83c75e0
|
2
|
* Copyright (c) 2011 Bernard Escaillas (www.midimetric.com)
|
Midimetric |
0:601fd83c75e0
|
3
|
*/
|
Midimetric |
0:601fd83c75e0
|
4
|
|
Midimetric |
0:601fd83c75e0
|
5
|
#ifndef DOGGY_H
|
Midimetric |
0:601fd83c75e0
|
6
|
#define DOGGY_H
|
Midimetric |
0:601fd83c75e0
|
7
|
|
Midimetric |
0:601fd83c75e0
|
8
|
#include "mbed.h"
|
Midimetric |
0:601fd83c75e0
|
9
|
#include "globaldefs.h"
|
Midimetric |
0:601fd83c75e0
|
10
|
#include "xfont.h"
|
Midimetric |
0:601fd83c75e0
|
11
|
#include "xfont_8.h"
|
Midimetric |
0:601fd83c75e0
|
12
|
#include "xfont_11.h"
|
Midimetric |
0:601fd83c75e0
|
13
|
#include "patterns.h"
|
Midimetric |
0:601fd83c75e0
|
14
|
|
Midimetric |
0:601fd83c75e0
|
15
|
/// DOGM LCD control class
|
Midimetric |
0:601fd83c75e0
|
16
|
///
|
Midimetric |
0:601fd83c75e0
|
17
|
/// Simple drawing and text rendering functions for DOGM-6 LCD
|
Midimetric |
0:601fd83c75e0
|
18
|
/// It should work also with the DOGL.
|
Midimetric |
0:601fd83c75e0
|
19
|
/// It does not handles up side down display.
|
Midimetric |
0:601fd83c75e0
|
20
|
///
|
Midimetric |
0:601fd83c75e0
|
21
|
/// DogM circuit used in the example:
|
Midimetric |
0:601fd83c75e0
|
22
|
///
|
Midimetric |
0:601fd83c75e0
|
23
|
/// 1/ LCD accesseories:
|
Midimetric |
0:601fd83c75e0
|
24
|
///
|
Midimetric |
3:f5146bf55b5d
|
25
|
/// - LCD is powered from the 3.3V of the mbed. This configuration requires 9 x 1 uF capacitors as
|
Midimetric |
2:d6e572640dcc
|
26
|
/// shown in the DogM datasheet. Personnaly i used 0.820 uF (or code 824) because i did not have 1 uFs...
|
Midimetric |
0:601fd83c75e0
|
27
|
/// - Amber backlight requires resistors. The data sheet mentions 3 x 47 Ohms resitors (one on each led).
|
Midimetric |
0:601fd83c75e0
|
28
|
/// actually, i added a 500 ohms pot and a 47 Ohms in serie to allow for backlight attenuation (and to
|
Midimetric |
0:601fd83c75e0
|
29
|
/// extend its lifetime. Also, drawing too much current from the mbed 'steels' power from the LCD and
|
Midimetric |
0:601fd83c75e0
|
30
|
/// reduces contrast...
|
Midimetric |
0:601fd83c75e0
|
31
|
///
|
Midimetric |
0:601fd83c75e0
|
32
|
/// 2/ mbed connection:
|
Midimetric |
0:601fd83c75e0
|
33
|
///
|
Midimetric |
0:601fd83c75e0
|
34
|
/// - dogm 40 (CS) --> mbed p8
|
Midimetric |
0:601fd83c75e0
|
35
|
/// - dogm 39 (Reset) --> +3.3V (always off to save one pin)
|
Midimetric |
0:601fd83c75e0
|
36
|
/// - dogm 38 (A0) --> mbed p6 (unused miso pin)
|
Midimetric |
0:601fd83c75e0
|
37
|
/// - dogm 37 (SCLK) --> mbed p7 (SPI clock)
|
Midimetric |
0:601fd83c75e0
|
38
|
/// - dogm 36 (SI) --> mbed p5 (MOSI)
|
Midimetric |
0:601fd83c75e0
|
39
|
/// - dogm 35 (VDD) --> +3.3V
|
Midimetric |
0:601fd83c75e0
|
40
|
/// - dogm 34 (VVD2) --> +3.3V
|
Midimetric |
0:601fd83c75e0
|
41
|
/// - dogm 33 (VSS) --> GND
|
Midimetric |
0:601fd83c75e0
|
42
|
/// - dogm 32 to 21, see datasheet for condensers connection
|
Midimetric |
0:601fd83c75e0
|
43
|
///
|
Midimetric |
0:601fd83c75e0
|
44
|
/// 3/ SPI cnofiguration:
|
Midimetric |
0:601fd83c75e0
|
45
|
///
|
Midimetric |
0:601fd83c75e0
|
46
|
/// The datasheet states that the DogM handles data rates up to 10MHz
|
Midimetric |
0:601fd83c75e0
|
47
|
/// This rate is probably achieved with independant current source for the backlight.
|
Midimetric |
0:601fd83c75e0
|
48
|
/// This library uses by default a 1 MHz for the one time initialization (in case mbed
|
Midimetric |
0:601fd83c75e0
|
49
|
/// is powering up also and current is not yet fully stabilized)
|
Midimetric |
0:601fd83c75e0
|
50
|
/// It uses a 5MHz rate for work screen transfer.
|
Midimetric |
0:601fd83c75e0
|
51
|
/// You can change this by modifying the #DEFINE DOGMLC_MHZ 5000000
|
Midimetric |
0:601fd83c75e0
|
52
|
/// (use the #undef / #define pair in your code to redefine this constant)
|
Midimetric |
0:601fd83c75e0
|
53
|
/// Increase the value to achieve faster transmission.
|
Midimetric |
0:601fd83c75e0
|
54
|
/// Lower the value if some messages are lost.
|
Midimetric |
0:601fd83c75e0
|
55
|
///
|
Midimetric |
0:601fd83c75e0
|
56
|
/// Example:
|
Midimetric |
0:601fd83c75e0
|
57
|
/// @code
|
Midimetric |
0:601fd83c75e0
|
58
|
/// #include "mbed.h"
|
Midimetric |
0:601fd83c75e0
|
59
|
/// #include "doggy.h"
|
Midimetric |
0:601fd83c75e0
|
60
|
///
|
Midimetric |
0:601fd83c75e0
|
61
|
/// SPI spi( p5, NC, p7 ); // MOSI, MISCO, CLK
|
Midimetric |
0:601fd83c75e0
|
62
|
/// DogMLCD dog( spi, p8, p6 ); // SPI, CS, A0
|
Midimetric |
0:601fd83c75e0
|
63
|
///
|
Midimetric |
0:601fd83c75e0
|
64
|
/// int main()
|
Midimetric |
0:601fd83c75e0
|
65
|
/// {
|
Midimetric |
0:601fd83c75e0
|
66
|
/// // select font to use:
|
Midimetric |
0:601fd83c75e0
|
67
|
/// dog.XFont = xfont_11;
|
Midimetric |
0:601fd83c75e0
|
68
|
///
|
Midimetric |
0:601fd83c75e0
|
69
|
/// // transmit currently empty work screen (to clear physical display):
|
Midimetric |
0:601fd83c75e0
|
70
|
/// dog.Flush();
|
Midimetric |
0:601fd83c75e0
|
71
|
///
|
Midimetric |
0:601fd83c75e0
|
72
|
/// // create text with symbols:
|
Midimetric |
0:601fd83c75e0
|
73
|
/// char formula[] = { 159, '(', 'x', ')', '=', '2', 227, '+', 's', 'i', 'n', '(', 224, ')', '/', 251, 'x' };
|
Midimetric |
0:601fd83c75e0
|
74
|
/// // output text from point(0,0):
|
Midimetric |
0:601fd83c75e0
|
75
|
/// dog.XString( 0, 0, formula );
|
Midimetric |
0:601fd83c75e0
|
76
|
///
|
Midimetric |
0:601fd83c75e0
|
77
|
/// // create text with variables and ouput from point (0,11):
|
Midimetric |
0:601fd83c75e0
|
78
|
/// char buf[256];
|
Midimetric |
0:601fd83c75e0
|
79
|
/// sprintf( buf, "%s=%f", "A", 15.894 );
|
Midimetric |
0:601fd83c75e0
|
80
|
/// dog.XString( 0, 11, buf );
|
Midimetric |
0:601fd83c75e0
|
81
|
///
|
Midimetric |
0:601fd83c75e0
|
82
|
/// // paint rectangles with built-in patterns:
|
Midimetric |
0:601fd83c75e0
|
83
|
/// dog.Rect( 0, 48, 15, 63, DOGMLCD_full );
|
Midimetric |
0:601fd83c75e0
|
84
|
/// dog.Rect( 16, 48, 31, 63, DOGMLCD_dark );
|
Midimetric |
0:601fd83c75e0
|
85
|
/// dog.Rect( 32, 48, 47, 63, DOGMLCD_grey );
|
Midimetric |
0:601fd83c75e0
|
86
|
/// dog.Rect( 48, 48, 63, 63, DOGMLCD_lite );
|
Midimetric |
0:601fd83c75e0
|
87
|
///
|
Midimetric |
0:601fd83c75e0
|
88
|
/// // transmit work screen to physical screen:
|
Midimetric |
0:601fd83c75e0
|
89
|
/// dog.Flush();
|
Midimetric |
0:601fd83c75e0
|
90
|
/// }
|
Midimetric |
0:601fd83c75e0
|
91
|
/// @endcode
|
Midimetric |
0:601fd83c75e0
|
92
|
class DogMLCD
|
Midimetric |
0:601fd83c75e0
|
93
|
{
|
Midimetric |
0:601fd83c75e0
|
94
|
private:
|
Midimetric |
4:545e25d4c3d8
|
95
|
char w_[1024]; // work screen
|
Midimetric |
4:545e25d4c3d8
|
96
|
char* b_; // currently used screen
|
Midimetric |
0:601fd83c75e0
|
97
|
SPI& spi_; // attached SPI instance
|
Midimetric |
0:601fd83c75e0
|
98
|
DigitalOut cs_, a0_; // control pins
|
Midimetric |
0:601fd83c75e0
|
99
|
|
Midimetric |
0:601fd83c75e0
|
100
|
public:
|
Midimetric |
0:601fd83c75e0
|
101
|
|
Midimetric |
0:601fd83c75e0
|
102
|
// implementation in doggy.cpp:
|
Midimetric |
0:601fd83c75e0
|
103
|
|
Midimetric |
3:f5146bf55b5d
|
104
|
/// Xfont assignment, assign example: XFont = xfont_8; , values { xfont_8 (default), xfont_11 }
|
Midimetric |
0:601fd83c75e0
|
105
|
const XGlyph* XFont;
|
Midimetric |
0:601fd83c75e0
|
106
|
|
Midimetric |
0:601fd83c75e0
|
107
|
/// Create DogMLCD instance and intialize display
|
Midimetric |
0:601fd83c75e0
|
108
|
///
|
Midimetric |
0:601fd83c75e0
|
109
|
/// @param spi Instance object of an initialized SPI port (see SPI library)
|
Midimetric |
0:601fd83c75e0
|
110
|
/// @param cs Digital pin output to activate slave SPI
|
Midimetric |
0:601fd83c75e0
|
111
|
/// @param a0 Digital pin output to switch DogM from command mode to data mode
|
Midimetric |
0:601fd83c75e0
|
112
|
DogMLCD( SPI& spi, PinName cs, PinName a0 );
|
Midimetric |
0:601fd83c75e0
|
113
|
|
Midimetric |
4:545e25d4c3d8
|
114
|
/// Use custom screen buffer
|
Midimetric |
4:545e25d4c3d8
|
115
|
///
|
Midimetric |
4:545e25d4c3d8
|
116
|
/// @param screen pointer to an array of 1024 chars (128 colonnes of 8 pages)
|
Midimetric |
4:545e25d4c3d8
|
117
|
void AttachScreen( char* screen );
|
Midimetric |
4:545e25d4c3d8
|
118
|
|
Midimetric |
4:545e25d4c3d8
|
119
|
/// Stop using custom screen buffer (revet to internal work screen)
|
Midimetric |
4:545e25d4c3d8
|
120
|
void DetachScreen();
|
Midimetric |
0:601fd83c75e0
|
121
|
|
Midimetric |
1:9d081c7fff45
|
122
|
/// Activate pixel
|
Midimetric |
0:601fd83c75e0
|
123
|
///
|
Midimetric |
0:601fd83c75e0
|
124
|
/// @param x horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
125
|
/// @param y vertical coordinate from 0 to 63
|
Midimetric |
0:601fd83c75e0
|
126
|
void Poke( int x, int y );
|
Midimetric |
0:601fd83c75e0
|
127
|
|
Midimetric |
1:9d081c7fff45
|
128
|
/// Clear pixel
|
Midimetric |
0:601fd83c75e0
|
129
|
///
|
Midimetric |
0:601fd83c75e0
|
130
|
/// @param x horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
131
|
/// @param y vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
132
|
void Wipe( int x, int y );
|
Midimetric |
0:601fd83c75e0
|
133
|
|
Midimetric |
0:601fd83c75e0
|
134
|
/// Invert pixel
|
Midimetric |
0:601fd83c75e0
|
135
|
///
|
Midimetric |
0:601fd83c75e0
|
136
|
/// @param x horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
137
|
/// @param y vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
138
|
void Inv( int x, int y );
|
Midimetric |
0:601fd83c75e0
|
139
|
|
Midimetric |
0:601fd83c75e0
|
140
|
/// Clear virtual screen
|
Midimetric |
2:d6e572640dcc
|
141
|
///
|
Midimetric |
2:d6e572640dcc
|
142
|
/// Note : to clear only a part of the screen, use Rect( ..., DOGMLCD_full, wipe );
|
Midimetric |
0:601fd83c75e0
|
143
|
void Clear();
|
Midimetric |
0:601fd83c75e0
|
144
|
|
Midimetric |
0:601fd83c75e0
|
145
|
/// Transmit virtual screen to physical display
|
Midimetric |
0:601fd83c75e0
|
146
|
///
|
Midimetric |
2:d6e572640dcc
|
147
|
/// note: this is the more time consuming method, it should take about 3ms under normal conditions.
|
Midimetric |
2:d6e572640dcc
|
148
|
/// For faster transmit you can limit it to the part of the screen that has effectively changed
|
Midimetric |
2:d6e572640dcc
|
149
|
/// with Flush(page) or Flush(y0,y1)
|
Midimetric |
0:601fd83c75e0
|
150
|
void Flush();
|
Midimetric |
0:601fd83c75e0
|
151
|
|
Midimetric |
2:d6e572640dcc
|
152
|
/// Transmit one virtual screen page (or part of it) to physical display
|
Midimetric |
2:d6e572640dcc
|
153
|
///
|
Midimetric |
2:d6e572640dcc
|
154
|
/// Physical screen is organized into 8 horizontal bands called pages. Each band is 8 lines high.
|
Midimetric |
2:d6e572640dcc
|
155
|
/// @param page number of the page to transmit, from 0 to 7.
|
Midimetric |
2:d6e572640dcc
|
156
|
/// @param x0 horizontal coordinate of first pixel to transmit, from 0 to 127.
|
Midimetric |
2:d6e572640dcc
|
157
|
/// @param x1 horizontal coordinate of last pixel to transmit, from 0 to 127.
|
Midimetric |
3:f5146bf55b5d
|
158
|
void Flush( unsigned char page, int x0 = 0, int x1 = 127 );
|
Midimetric |
2:d6e572640dcc
|
159
|
|
Midimetric |
2:d6e572640dcc
|
160
|
/// Transmit several pages of the virtual screen to physical display
|
Midimetric |
2:d6e572640dcc
|
161
|
///
|
Midimetric |
2:d6e572640dcc
|
162
|
/// Physical screen is organized into 8 horizontal bands called pages. Each band is 8 lines high.
|
Midimetric |
2:d6e572640dcc
|
163
|
/// Call time is about 150 us + 400 us per page at 5MHz spi frequency
|
Midimetric |
2:d6e572640dcc
|
164
|
/// @param page0 number of the first page to transmit, from 0 to 7.
|
Midimetric |
3:f5146bf55b5d
|
165
|
/// @param page1 number of the last page to transmit, from 1 to 7 (0 means ignore argument).
|
Midimetric |
3:f5146bf55b5d
|
166
|
void Page( unsigned char page0, unsigned char page1 = 0 );
|
Midimetric |
2:d6e572640dcc
|
167
|
|
Midimetric |
4:545e25d4c3d8
|
168
|
/// Paste a custom screen over the internal work screen using raster op
|
Midimetric |
4:545e25d4c3d8
|
169
|
///
|
Midimetric |
4:545e25d4c3d8
|
170
|
/// @param screen pointer to a custom screen made of 1024 chars
|
Midimetric |
4:545e25d4c3d8
|
171
|
/// @param op raster operation, can be { poke(default), wipe, inv }
|
Midimetric |
4:545e25d4c3d8
|
172
|
void Paste( char* screen, doggy_op op = poke );
|
Midimetric |
4:545e25d4c3d8
|
173
|
|
Midimetric |
0:601fd83c75e0
|
174
|
// implementation in draw2D.cpp:
|
Midimetric |
0:601fd83c75e0
|
175
|
|
Midimetric |
0:601fd83c75e0
|
176
|
/// Draw an horizontal line
|
Midimetric |
0:601fd83c75e0
|
177
|
///
|
Midimetric |
0:601fd83c75e0
|
178
|
/// @param x0 left coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
179
|
/// @param y vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
180
|
/// @param x1 right coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
181
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
0:601fd83c75e0
|
182
|
void LineH( int x0, int y, int x1, doggy_op op = poke );
|
Midimetric |
0:601fd83c75e0
|
183
|
|
Midimetric |
0:601fd83c75e0
|
184
|
/// Draw a vertical line
|
Midimetric |
0:601fd83c75e0
|
185
|
///
|
Midimetric |
0:601fd83c75e0
|
186
|
/// @param x horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
187
|
/// @param y0 top coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
188
|
/// @param y1 bottom coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
189
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
0:601fd83c75e0
|
190
|
void LineV( int x, int y0, int y1, doggy_op op = poke );
|
Midimetric |
5:1c78c0b4f513
|
191
|
|
Midimetric |
5:1c78c0b4f513
|
192
|
/// Draw an diagonal line
|
Midimetric |
5:1c78c0b4f513
|
193
|
///
|
Midimetric |
5:1c78c0b4f513
|
194
|
/// @param x0 start horizontal coordinate from 0 to 127 included
|
Midimetric |
5:1c78c0b4f513
|
195
|
/// @param y0 start vertical coordinate from 0 to 63 included
|
Midimetric |
5:1c78c0b4f513
|
196
|
/// @param x1 end horizontal coordinate from 0 to 127 included
|
Midimetric |
5:1c78c0b4f513
|
197
|
/// @param y1 end vertical coordinate from 0 to 63 included
|
Midimetric |
5:1c78c0b4f513
|
198
|
void Line( int x0, int y0, int x1, int y1, doggy_op = poke );
|
Midimetric |
5:1c78c0b4f513
|
199
|
|
Midimetric |
0:601fd83c75e0
|
200
|
/// Draw an empty rectangle by combining 2 LineH and 2 LineV calls
|
Midimetric |
0:601fd83c75e0
|
201
|
///
|
Midimetric |
0:601fd83c75e0
|
202
|
/// @param x0 top left corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
203
|
/// @param y0 top left corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
204
|
/// @param x1 bottom right corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
205
|
/// @param y1 bottom right corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
206
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
1:9d081c7fff45
|
207
|
void Frame( int x0, int y0, int x1, int y1, doggy_op op = poke );
|
Midimetric |
0:601fd83c75e0
|
208
|
|
Midimetric |
0:601fd83c75e0
|
209
|
/// Draw a filled rectangle by applying bitmap patterns
|
Midimetric |
0:601fd83c75e0
|
210
|
///
|
Midimetric |
1:9d081c7fff45
|
211
|
/// Check patterns.h for built-in patterns names.
|
Midimetric |
1:9d081c7fff45
|
212
|
/// Use your own pattern by passing (const unsigned char[]){ col 1, col 2...,col 8 }
|
Midimetric |
1:9d081c7fff45
|
213
|
///
|
Midimetric |
0:601fd83c75e0
|
214
|
/// @param x0 top left corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
215
|
/// @param y0 top left corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
216
|
/// @param x1 bottom right corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
217
|
/// @param y1 bottom right corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
218
|
/// @param pattern a 8x8 bitmap pattern defined by an array of 8 chars
|
Midimetric |
2:d6e572640dcc
|
219
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
2:d6e572640dcc
|
220
|
void Rect( int x0, int y0, int x1, int y0, const unsigned char* pattern = DOGMLCD_full, doggy_op op = poke );
|
Midimetric |
0:601fd83c75e0
|
221
|
|
Midimetric |
0:601fd83c75e0
|
222
|
// Implementation in xchar.cpp:
|
Midimetric |
0:601fd83c75e0
|
223
|
|
Midimetric |
0:601fd83c75e0
|
224
|
/// Returns the XGlyph structure describing a single character bitmap
|
Midimetric |
0:601fd83c75e0
|
225
|
///
|
Midimetric |
1:9d081c7fff45
|
226
|
/// If code is not found in the font, returns the character of code 0 (an empty square)
|
Midimetric |
0:601fd83c75e0
|
227
|
///
|
Midimetric |
0:601fd83c75e0
|
228
|
/// @param code character code 0, 32 ~ 255 (xfont actually implements the extended US ascii character set)
|
Midimetric |
0:601fd83c75e0
|
229
|
/// @return an XGlyph structure { code, width, height, ...crening..., ...bitmap chars... }
|
Midimetric |
0:601fd83c75e0
|
230
|
XGlyph GetGlyph( int code );
|
Midimetric |
0:601fd83c75e0
|
231
|
|
Midimetric |
0:601fd83c75e0
|
232
|
/// Draw a XFont style character at position (x,y)
|
Midimetric |
0:601fd83c75e0
|
233
|
///
|
Midimetric |
0:601fd83c75e0
|
234
|
/// @param x top left corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
235
|
/// @param y top left corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
236
|
/// @param code US extended ascii code
|
Midimetric |
0:601fd83c75e0
|
237
|
/// @param op bottom right corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
238
|
void XChar( int x, int y, int code, doggy_op op = poke );
|
Midimetric |
0:601fd83c75e0
|
239
|
|
Midimetric |
0:601fd83c75e0
|
240
|
/// Draw a XFont style character at position (x,y)
|
Midimetric |
0:601fd83c75e0
|
241
|
///
|
Midimetric |
0:601fd83c75e0
|
242
|
/// @param x top left corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
243
|
/// @param y top left corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
244
|
/// @param f Xglyph structure of the character
|
Midimetric |
0:601fd83c75e0
|
245
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
0:601fd83c75e0
|
246
|
void XChar( int x, int y, XGlyph f, doggy_op op = poke );
|
Midimetric |
0:601fd83c75e0
|
247
|
|
Midimetric |
0:601fd83c75e0
|
248
|
/// Draw a XFont style sequence of characters starting at position (x,y)
|
Midimetric |
0:601fd83c75e0
|
249
|
///
|
Midimetric |
0:601fd83c75e0
|
250
|
/// Proportional font : Xfonts are proportionnal : i.e. not all characters have the same width.
|
Midimetric |
0:601fd83c75e0
|
251
|
///
|
Midimetric |
0:601fd83c75e0
|
252
|
/// Crening (of Kerning): in most cases, there is a character spacing of one pixel beetween chars.
|
Midimetric |
0:601fd83c75e0
|
253
|
/// But some character combinations allow space saving. For instance, "T.", T followed by dot does not need
|
Midimetric |
0:601fd83c75e0
|
254
|
/// the extra pixel to ensure characters are not touching each other. Same for "aV" or "L'" or "=1" .
|
Midimetric |
0:601fd83c75e0
|
255
|
///
|
Midimetric |
1:9d081c7fff45
|
256
|
/// New line: string can contain the new line '\\n' or (13)
|
Midimetric |
0:601fd83c75e0
|
257
|
///
|
Midimetric |
5:1c78c0b4f513
|
258
|
/// Wrapping: if the ouput reaches the right side of the screen, it will wrap to next line at position x.
|
Midimetric |
0:601fd83c75e0
|
259
|
/// wrapping is not space dependant, it happens anywhere in the string (inside words)
|
Midimetric |
0:601fd83c75e0
|
260
|
/// if wrapped line happens to begins with a space, the space is skipped
|
Midimetric |
0:601fd83c75e0
|
261
|
///
|
Midimetric |
0:601fd83c75e0
|
262
|
/// @param x top left corner, horizontal coordinate from 0 to 127 included
|
Midimetric |
0:601fd83c75e0
|
263
|
/// @param y top left corner, vertical coordinate from 0 to 63 included
|
Midimetric |
0:601fd83c75e0
|
264
|
/// @param f Xglyph structure of the character
|
Midimetric |
0:601fd83c75e0
|
265
|
/// @param op bit math operation (raster), values { poke (default), wipe, inv }
|
Midimetric |
1:9d081c7fff45
|
266
|
///
|
Midimetric |
1:9d081c7fff45
|
267
|
/// @return the last y coordinate used to output chars (may be different than initial argument if string was wrapped)
|
Midimetric |
1:9d081c7fff45
|
268
|
int XString( int x, int y, const char* s, doggy_op op = poke );
|
Midimetric |
5:1c78c0b4f513
|
269
|
int XString( int x, int y, int i, doggy_op = poke );
|
Midimetric |
5:1c78c0b4f513
|
270
|
int XString( int x, int y, float f, doggy_op = poke );
|
Midimetric |
0:601fd83c75e0
|
271
|
};
|
Midimetric |
0:601fd83c75e0
|
272
|
|
Midimetric |
0:601fd83c75e0
|
273
|
/// Type definition for RasterOp
|
Midimetric |
0:601fd83c75e0
|
274
|
///
|
Midimetric |
0:601fd83c75e0
|
275
|
/// is a pointer to a metthod of DogMLCD taking two int arguments
|
Midimetric |
0:601fd83c75e0
|
276
|
typedef void (DogMLCD::*RasterOp)(int,int);
|
Midimetric |
0:601fd83c75e0
|
277
|
#endif |