Versión de Firmware con funciones de RAM incorporadas.

Dependencies:   mbed

Fork of VmRecorderV1dot1 by virtualmech

Committer:
JuanManuelAmador
Date:
Tue Jul 14 08:34:11 2015 +0000
Revision:
2:e818c80e6d5c
Parent:
0:3d456b8ce449
Funciones de memoria RAM introducidas.

Who changed what in which revision?

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