Library to control a QVGA TFT connected to SPI. You can use printf to print text The lib can handle different fonts, draw lines, circles, rect and bmp

Committer:
dreschpe
Date:
Sat Jul 30 22:15:35 2011 +0000
Revision:
5:2db1b8070d94
Parent:
4:e1e45f8a7664
Child:
6:fc33e4a5713e
0.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 0:cccc5726bdf3 1 /* mbed library for 240*320 pixel display TFT based on HX8347D LCD Controller
dreschpe 0:cccc5726bdf3 2 * Copyright (c) 2011 Peter Drescher - DC2PD
dreschpe 0:cccc5726bdf3 3 *
dreschpe 0:cccc5726bdf3 4 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dreschpe 0:cccc5726bdf3 5 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dreschpe 0:cccc5726bdf3 6 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dreschpe 0:cccc5726bdf3 7 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dreschpe 0:cccc5726bdf3 8 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dreschpe 0:cccc5726bdf3 9 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
dreschpe 0:cccc5726bdf3 10 * THE SOFTWARE.
dreschpe 0:cccc5726bdf3 11 */
dreschpe 0:cccc5726bdf3 12
dreschpe 0:cccc5726bdf3 13 #ifndef MBED_SPI_TFT_H
dreschpe 0:cccc5726bdf3 14 #define MBED_SPI_TFT_H
dreschpe 0:cccc5726bdf3 15
dreschpe 3:5be1edd3a543 16
dreschpe 3:5be1edd3a543 17 #include "mbed.h"
dreschpe 3:5be1edd3a543 18 #include "GraphicsDisplay.h"
dreschpe 3:5be1edd3a543 19
dreschpe 3:5be1edd3a543 20 #define RGB(r,g,b) (((r&0xF8)<<8)|((g&0xFC)<<3)|((b&0xF8)>>3)) //5 red | 6 green | 5 blue
dreschpe 3:5be1edd3a543 21
dreschpe 3:5be1edd3a543 22 #define SPI_START (0x70) /* Start byte for SPI transfer */
dreschpe 3:5be1edd3a543 23 #define SPI_RD (0x01) /* WR bit 1 within start */
dreschpe 3:5be1edd3a543 24 #define SPI_WR (0x00) /* WR bit 0 within start */
dreschpe 3:5be1edd3a543 25 #define SPI_DATA (0x02) /* RS bit 1 within start byte */
dreschpe 3:5be1edd3a543 26 #define SPI_INDEX (0x00) /* RS bit 0 within start byte */
dreschpe 3:5be1edd3a543 27
dreschpe 3:5be1edd3a543 28
dreschpe 3:5be1edd3a543 29 /* some RGB color definitions */
dreschpe 3:5be1edd3a543 30 #define Black 0x0000 /* 0, 0, 0 */
dreschpe 3:5be1edd3a543 31 #define Navy 0x000F /* 0, 0, 128 */
dreschpe 3:5be1edd3a543 32 #define DarkGreen 0x03E0 /* 0, 128, 0 */
dreschpe 3:5be1edd3a543 33 #define DarkCyan 0x03EF /* 0, 128, 128 */
dreschpe 3:5be1edd3a543 34 #define Maroon 0x7800 /* 128, 0, 0 */
dreschpe 3:5be1edd3a543 35 #define Purple 0x780F /* 128, 0, 128 */
dreschpe 3:5be1edd3a543 36 #define Olive 0x7BE0 /* 128, 128, 0 */
dreschpe 3:5be1edd3a543 37 #define LightGrey 0xC618 /* 192, 192, 192 */
dreschpe 3:5be1edd3a543 38 #define DarkGrey 0x7BEF /* 128, 128, 128 */
dreschpe 3:5be1edd3a543 39 #define Blue 0x001F /* 0, 0, 255 */
dreschpe 3:5be1edd3a543 40 #define Green 0x07E0 /* 0, 255, 0 */
dreschpe 3:5be1edd3a543 41 #define Cyan 0x07FF /* 0, 255, 255 */
dreschpe 3:5be1edd3a543 42 #define Red 0xF800 /* 255, 0, 0 */
dreschpe 3:5be1edd3a543 43 #define Magenta 0xF81F /* 255, 0, 255 */
dreschpe 3:5be1edd3a543 44 #define Yellow 0xFFE0 /* 255, 255, 0 */
dreschpe 3:5be1edd3a543 45 #define White 0xFFFF /* 255, 255, 255 */
dreschpe 3:5be1edd3a543 46
dreschpe 1:aa3356b16080 47 /** Display control class, based on GraphicsDisplay and TextDisplay
dreschpe 1:aa3356b16080 48 *
dreschpe 1:aa3356b16080 49 * Example:
dreschpe 1:aa3356b16080 50 * @code
dreschpe 1:aa3356b16080 51 * #include "stdio.h"
dreschpe 1:aa3356b16080 52 * #include "mbed.h"
dreschpe 1:aa3356b16080 53 * #include "SPI_TFT.h"
dreschpe 1:aa3356b16080 54 * #include "string"
dreschpe 1:aa3356b16080 55 * #include "Arial12x12.h"
dreschpe 1:aa3356b16080 56 * #include "Arial24x23.h"
dreschpe 1:aa3356b16080 57 *
dreschpe 1:aa3356b16080 58 *
dreschpe 1:aa3356b16080 59 *
dreschpe 1:aa3356b16080 60 * // the TFT is connected to SPI pin 5-7
dreschpe 1:aa3356b16080 61 * SPI_TFT TFT(p5, p6, p7, p8, p15,"TFT"); // mosi, miso, sclk, cs, reset
dreschpe 1:aa3356b16080 62 *
dreschpe 1:aa3356b16080 63 * int main() {
dreschpe 1:aa3356b16080 64 * TFT.claim(stdout); // send stdout to the TFT display
dreschpe 1:aa3356b16080 65 * //TFT.claim(stderr); // send stderr to the TFT display
dreschpe 1:aa3356b16080 66 *
dreschpe 1:aa3356b16080 67 * TFT.background(Black); // set background to black
dreschpe 1:aa3356b16080 68 * TFT.foreground(White); // set chars to white
dreschpe 1:aa3356b16080 69 * TFT.cls(); // clear the screen
dreschpe 1:aa3356b16080 70 * TFT.set_font((unsigned char*) Arial12x12); // select the font
dreschpe 1:aa3356b16080 71 *
dreschpe 1:aa3356b16080 72 * TFT.set_orientation(0);
dreschpe 1:aa3356b16080 73 * TFT.locate(0,0);
dreschpe 1:aa3356b16080 74 * printf(" Hello Mbed 0");
dreschpe 1:aa3356b16080 75 * TFT.set_font((unsigned char*) Arial24x23); // select font 2
dreschpe 1:aa3356b16080 76 * TFT.locate(2,5);
dreschpe 1:aa3356b16080 77 * TFT.printf("Bigger Font");
dreschpe 1:aa3356b16080 78 * }
dreschpe 1:aa3356b16080 79 * @endcode
dreschpe 1:aa3356b16080 80 */
dreschpe 3:5be1edd3a543 81 class SPI_TFT : public GraphicsDisplay {
dreschpe 3:5be1edd3a543 82 public:
dreschpe 1:aa3356b16080 83
dreschpe 2:0cc880f230ad 84 /** Create a SPI_TFT object connected to SPI and two pins
dreschpe 2:0cc880f230ad 85 *
dreschpe 2:0cc880f230ad 86 * @param mosi,miso,sclk SPI
dreschpe 2:0cc880f230ad 87 * @param cs pin connected to CS of display
dreschpe 2:0cc880f230ad 88 * @param reset pin connected to RESET of display
dreschpe 2:0cc880f230ad 89 *
dreschpe 2:0cc880f230ad 90 */
dreschpe 2:0cc880f230ad 91 SPI_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT");
dreschpe 1:aa3356b16080 92
dreschpe 2:0cc880f230ad 93 /** Get the width of the screen in pixel
dreschpe 2:0cc880f230ad 94 *
dreschpe 2:0cc880f230ad 95 * @param
dreschpe 2:0cc880f230ad 96 * @returns width of screen in pixel
dreschpe 2:0cc880f230ad 97 *
dreschpe 2:0cc880f230ad 98 */
dreschpe 2:0cc880f230ad 99 virtual int width();
dreschpe 1:aa3356b16080 100
dreschpe 2:0cc880f230ad 101 /** Get the height of the screen in pixel
dreschpe 2:0cc880f230ad 102 *
dreschpe 2:0cc880f230ad 103 * @returns height of screen in pixel
dreschpe 2:0cc880f230ad 104 *
dreschpe 2:0cc880f230ad 105 */
dreschpe 2:0cc880f230ad 106 virtual int height();
dreschpe 1:aa3356b16080 107
dreschpe 2:0cc880f230ad 108 /** Draw a pixel at x,y with color
dreschpe 2:0cc880f230ad 109 *
dreschpe 2:0cc880f230ad 110 * @param x horizontal position
dreschpe 2:0cc880f230ad 111 * @param y vertical position
dreschpe 2:0cc880f230ad 112 * @param color 16 bit pixel color
dreschpe 2:0cc880f230ad 113 */
dreschpe 2:0cc880f230ad 114 virtual void pixel(int x, int y, int colour);
dreschpe 1:aa3356b16080 115
dreschpe 2:0cc880f230ad 116 /** draw a circle
dreschpe 2:0cc880f230ad 117 *
dreschpe 2:0cc880f230ad 118 * @param x0,y0 center
dreschpe 2:0cc880f230ad 119 * @param r radius
dreschpe 2:0cc880f230ad 120 * @param color 16 bit color *
dreschpe 2:0cc880f230ad 121 *
dreschpe 2:0cc880f230ad 122 */
dreschpe 2:0cc880f230ad 123 void circle(int x, int y, int r, int colour);
dreschpe 4:e1e45f8a7664 124
dreschpe 4:e1e45f8a7664 125 /** draw a filled circle
dreschpe 4:e1e45f8a7664 126 *
dreschpe 4:e1e45f8a7664 127 * @param x0,y0 center
dreschpe 4:e1e45f8a7664 128 * @param r radius
dreschpe 4:e1e45f8a7664 129 * @param color 16 bit color *
dreschpe 4:e1e45f8a7664 130 *
dreschpe 4:e1e45f8a7664 131 * use circle with different radius,
dreschpe 4:e1e45f8a7664 132 * can miss some pixel
dreschpe 4:e1e45f8a7664 133 */
dreschpe 4:e1e45f8a7664 134 void fillcircle(int x, int y, int r, int colour);
dreschpe 4:e1e45f8a7664 135
dreschpe 4:e1e45f8a7664 136
dreschpe 1:aa3356b16080 137
dreschpe 2:0cc880f230ad 138 /** draw a 1 pixel line
dreschpe 2:0cc880f230ad 139 *
dreschpe 2:0cc880f230ad 140 * @param x0,y0 start point
dreschpe 2:0cc880f230ad 141 * @param x1,y1 stop point
dreschpe 2:0cc880f230ad 142 * @param color 16 bit color
dreschpe 2:0cc880f230ad 143 *
dreschpe 2:0cc880f230ad 144 */
dreschpe 2:0cc880f230ad 145 void line(int x0, int y0, int x1, int y1, int colour);
dreschpe 1:aa3356b16080 146
dreschpe 2:0cc880f230ad 147 /** draw a rect
dreschpe 2:0cc880f230ad 148 *
dreschpe 2:0cc880f230ad 149 * @param x0,y0 top left corner
dreschpe 2:0cc880f230ad 150 * @param x1,y1 down right corner
dreschpe 2:0cc880f230ad 151 * @param color 16 bit color
dreschpe 2:0cc880f230ad 152 * *
dreschpe 2:0cc880f230ad 153 */
dreschpe 2:0cc880f230ad 154 void rect(int x0, int y0, int x1, int y1, int colour);
dreschpe 1:aa3356b16080 155
dreschpe 2:0cc880f230ad 156 /** draw a filled rect
dreschpe 2:0cc880f230ad 157 *
dreschpe 2:0cc880f230ad 158 * @param x0,y0 top left corner
dreschpe 2:0cc880f230ad 159 * @param x1,y1 down right corner
dreschpe 2:0cc880f230ad 160 * @param color 16 bit color
dreschpe 2:0cc880f230ad 161 *
dreschpe 2:0cc880f230ad 162 */
dreschpe 2:0cc880f230ad 163 void fillrect(int x0, int y0, int x1, int y1, int colour);
dreschpe 1:aa3356b16080 164
dreschpe 2:0cc880f230ad 165 /** setup cursor position
dreschpe 2:0cc880f230ad 166 *
dreschpe 2:0cc880f230ad 167 * @param column 0 to max
dreschpe 2:0cc880f230ad 168 * @param row 0 to max
dreschpe 2:0cc880f230ad 169 * max depend on font size
dreschpe 2:0cc880f230ad 170 */
dreschpe 2:0cc880f230ad 171 void locate(int column, int row);
dreschpe 1:aa3356b16080 172
dreschpe 2:0cc880f230ad 173 /** Fill the screen with _backgroun color
dreschpe 2:0cc880f230ad 174 *
dreschpe 2:0cc880f230ad 175 */
dreschpe 2:0cc880f230ad 176 virtual void cls (void);
dreschpe 1:aa3356b16080 177
dreschpe 2:0cc880f230ad 178 /** calculate the max number of char in a line
dreschpe 2:0cc880f230ad 179 *
dreschpe 2:0cc880f230ad 180 * @returns max columns
dreschpe 2:0cc880f230ad 181 * depends on actual font size
dreschpe 2:0cc880f230ad 182 *
dreschpe 2:0cc880f230ad 183 */
dreschpe 2:0cc880f230ad 184 int columns(void);
dreschpe 1:aa3356b16080 185
dreschpe 2:0cc880f230ad 186 /** calculate the max number of columns
dreschpe 2:0cc880f230ad 187 *
dreschpe 2:0cc880f230ad 188 * @returns max column
dreschpe 2:0cc880f230ad 189 * depends on actual font size
dreschpe 2:0cc880f230ad 190 *
dreschpe 2:0cc880f230ad 191 */
dreschpe 2:0cc880f230ad 192 int rows(void);
dreschpe 1:aa3356b16080 193
dreschpe 2:0cc880f230ad 194 /** put a char on the screen
dreschpe 2:0cc880f230ad 195 *
dreschpe 2:0cc880f230ad 196 * @param value char to print
dreschpe 2:0cc880f230ad 197 * @returns printed char
dreschpe 2:0cc880f230ad 198 *
dreschpe 2:0cc880f230ad 199 */
dreschpe 2:0cc880f230ad 200 int _putc(int value);
dreschpe 1:aa3356b16080 201
dreschpe 2:0cc880f230ad 202 /** draw a character on given position out of the active font to the TFT
dreschpe 2:0cc880f230ad 203 *
dreschpe 2:0cc880f230ad 204 * @param col column
dreschpe 2:0cc880f230ad 205 * @param row row
dreschpe 2:0cc880f230ad 206 * @param c char to print
dreschpe 2:0cc880f230ad 207 *
dreschpe 2:0cc880f230ad 208 */
dreschpe 2:0cc880f230ad 209 virtual void character(int col, int row, int c);
dreschpe 1:aa3356b16080 210
dreschpe 2:0cc880f230ad 211 /** paint a bitmap on the TFT
dreschpe 2:0cc880f230ad 212 *
dreschpe 2:0cc880f230ad 213 * @param x,y : upper left corner
dreschpe 2:0cc880f230ad 214 * @param w width of bitmap
dreschpe 2:0cc880f230ad 215 * @param h high of bitmap
dreschpe 2:0cc880f230ad 216 * @param *bitmap pointer to the bitmap data
dreschpe 2:0cc880f230ad 217 *
dreschpe 2:0cc880f230ad 218 * bitmap format: 16 bit R5 G6 B5
dreschpe 2:0cc880f230ad 219 *
dreschpe 2:0cc880f230ad 220 * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5
dreschpe 2:0cc880f230ad 221 * use winhex to load this file and mark data stating at offset 0x46 to end
dreschpe 2:0cc880f230ad 222 * use edit -> copy block -> C Source to export C array
dreschpe 2:0cc880f230ad 223 * paste this array into your program
dreschpe 2:0cc880f230ad 224 *
dreschpe 2:0cc880f230ad 225 */
dreschpe 2:0cc880f230ad 226 void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap);
dreschpe 1:aa3356b16080 227
dreschpe 5:2db1b8070d94 228
dreschpe 5:2db1b8070d94 229 /** paint a 16 bit BMP from local filesytem on the TFT (slow)
dreschpe 5:2db1b8070d94 230 *
dreschpe 5:2db1b8070d94 231 * @param x,y : upper left corner
dreschpe 5:2db1b8070d94 232 * @param *Name_BMP name of the BMP file
dreschpe 5:2db1b8070d94 233 * @returns 1 if bmp file was found and painted
dreschpe 5:2db1b8070d94 234 * @returns -1 if bmp file was found not found
dreschpe 5:2db1b8070d94 235 * @returns -2 if bmp file is not 16bit
dreschpe 5:2db1b8070d94 236 * @returns -3 if bmp file is to big for screen
dreschpe 5:2db1b8070d94 237 * @returns -4 if buffer malloc go wrong
dreschpe 5:2db1b8070d94 238 *
dreschpe 5:2db1b8070d94 239 * bitmap format: 16 bit R5 G6 B5
dreschpe 5:2db1b8070d94 240 *
dreschpe 5:2db1b8070d94 241 * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5
dreschpe 5:2db1b8070d94 242 * copy to internal file system
dreschpe 5:2db1b8070d94 243 *
dreschpe 5:2db1b8070d94 244 */
dreschpe 5:2db1b8070d94 245
dreschpe 5:2db1b8070d94 246 int BMP_16(unsigned int x, unsigned int y, const char *Name_BMP);
dreschpe 5:2db1b8070d94 247
dreschpe 5:2db1b8070d94 248
dreschpe 5:2db1b8070d94 249
dreschpe 2:0cc880f230ad 250 /** select the font to use
dreschpe 2:0cc880f230ad 251 *
dreschpe 2:0cc880f230ad 252 * @param f pointer to font array
dreschpe 2:0cc880f230ad 253 *
dreschpe 2:0cc880f230ad 254 * font array can created with GLCD Font Creator from http://www.mikroe.com
dreschpe 2:0cc880f230ad 255 * you have to add 4 parameter at the beginning of the font array to use:
dreschpe 2:0cc880f230ad 256 * - the number of byte / char
dreschpe 2:0cc880f230ad 257 * - the vertial size in pixel
dreschpe 2:0cc880f230ad 258 * - the horizontal size in pixel
dreschpe 2:0cc880f230ad 259 * - the number of byte per vertical line
dreschpe 2:0cc880f230ad 260 * you also have to change the array to char[]
dreschpe 2:0cc880f230ad 261 *
dreschpe 5:2db1b8070d94 262 */
dreschpe 2:0cc880f230ad 263 void set_font(unsigned char* f);
dreschpe 1:aa3356b16080 264
dreschpe 2:0cc880f230ad 265 /** Set the orientation of the screen
dreschpe 2:0cc880f230ad 266 * x,y: 0,0 is always top left
dreschpe 2:0cc880f230ad 267 *
dreschpe 4:e1e45f8a7664 268 * @param o direction to use the screen (0-3) 90&#65533; Steps
dreschpe 2:0cc880f230ad 269 *
dreschpe 2:0cc880f230ad 270 */
dreschpe 2:0cc880f230ad 271 void set_orientation(unsigned int o);
dreschpe 0:cccc5726bdf3 272
dreschpe 2:0cc880f230ad 273 SPI _spi;
dreschpe 2:0cc880f230ad 274 DigitalOut _cs;
dreschpe 2:0cc880f230ad 275 DigitalOut _reset;
dreschpe 2:0cc880f230ad 276 unsigned char* font;
dreschpe 2:0cc880f230ad 277
dreschpe 0:cccc5726bdf3 278 protected:
dreschpe 1:aa3356b16080 279
dreschpe 2:0cc880f230ad 280 /** draw a horizontal line
dreschpe 2:0cc880f230ad 281 *
dreschpe 2:0cc880f230ad 282 * @param x0 horizontal start
dreschpe 2:0cc880f230ad 283 * @param x1 horizontal stop
dreschpe 2:0cc880f230ad 284 * @param y vertical position
dreschpe 2:0cc880f230ad 285 * @param color 16 bit color
dreschpe 2:0cc880f230ad 286 *
dreschpe 2:0cc880f230ad 287 */
dreschpe 2:0cc880f230ad 288 void hline(int x0, int x1, int y, int colour);
dreschpe 1:aa3356b16080 289
dreschpe 2:0cc880f230ad 290 /** draw a vertical line
dreschpe 2:0cc880f230ad 291 *
dreschpe 2:0cc880f230ad 292 * @param x horizontal position
dreschpe 2:0cc880f230ad 293 * @param y0 vertical start
dreschpe 2:0cc880f230ad 294 * @param y1 vertical stop
dreschpe 2:0cc880f230ad 295 * @param color 16 bit color
dreschpe 2:0cc880f230ad 296 */
dreschpe 2:0cc880f230ad 297 void vline(int y0, int y1, int x, int colour);
dreschpe 1:aa3356b16080 298
dreschpe 2:0cc880f230ad 299 /** Set draw window region
dreschpe 2:0cc880f230ad 300 *
dreschpe 2:0cc880f230ad 301 * @param x horizontal position
dreschpe 2:0cc880f230ad 302 * @param y vertical position
dreschpe 2:0cc880f230ad 303 * @param w window width in pixel
dreschpe 2:0cc880f230ad 304 * @param h window height in pixels
dreschpe 2:0cc880f230ad 305 */
dreschpe 2:0cc880f230ad 306 void window (unsigned int x, unsigned int y, unsigned int w, unsigned int h);
dreschpe 1:aa3356b16080 307
dreschpe 1:aa3356b16080 308 /** Set draw window region to whole screen
dreschpe 2:0cc880f230ad 309 *
dreschpe 2:0cc880f230ad 310 */
dreschpe 2:0cc880f230ad 311 void WindowMax (void);
dreschpe 1:aa3356b16080 312
dreschpe 2:0cc880f230ad 313 /** Init the HX8347D controller
dreschpe 2:0cc880f230ad 314 *
dreschpe 2:0cc880f230ad 315 */
dreschpe 2:0cc880f230ad 316 void tft_reset();
dreschpe 1:aa3356b16080 317
dreschpe 2:0cc880f230ad 318 /** Write data to the LCD controller
dreschpe 2:0cc880f230ad 319 *
dreschpe 2:0cc880f230ad 320 * @param dat data written to LCD controller
dreschpe 2:0cc880f230ad 321 *
dreschpe 2:0cc880f230ad 322 */
dreschpe 2:0cc880f230ad 323 void wr_dat(int value);
dreschpe 1:aa3356b16080 324
dreschpe 2:0cc880f230ad 325 /** Write a command the LCD controller
dreschpe 2:0cc880f230ad 326 *
dreschpe 2:0cc880f230ad 327 * @param cmd: command to be written
dreschpe 2:0cc880f230ad 328 *
dreschpe 2:0cc880f230ad 329 */
dreschpe 2:0cc880f230ad 330 void wr_cmd(int value);
dreschpe 1:aa3356b16080 331
dreschpe 2:0cc880f230ad 332 /** Start data sequence to the LCD controller
dreschpe 2:0cc880f230ad 333 *
dreschpe 2:0cc880f230ad 334 */
dreschpe 2:0cc880f230ad 335 void wr_dat_start();
dreschpe 1:aa3356b16080 336
dreschpe 2:0cc880f230ad 337 /** Stop of data writing to the LCD controller
dreschpe 2:0cc880f230ad 338 *
dreschpe 2:0cc880f230ad 339 */
dreschpe 2:0cc880f230ad 340 void wr_dat_stop();
dreschpe 1:aa3356b16080 341
dreschpe 2:0cc880f230ad 342 /** write data to the LCD controller
dreschpe 2:0cc880f230ad 343 *
dreschpe 2:0cc880f230ad 344 * @param data to be written
dreschpe 2:0cc880f230ad 345 * *
dreschpe 2:0cc880f230ad 346 */
dreschpe 2:0cc880f230ad 347 void wr_dat_only(unsigned short dat);
dreschpe 1:aa3356b16080 348
dreschpe 2:0cc880f230ad 349 /** Read data from the LCD controller
dreschpe 2:0cc880f230ad 350 *
dreschpe 2:0cc880f230ad 351 * @returns data from LCD controller
dreschpe 2:0cc880f230ad 352 *
dreschpe 2:0cc880f230ad 353 */
dreschpe 2:0cc880f230ad 354 unsigned short rd_dat(void);
dreschpe 1:aa3356b16080 355
dreschpe 2:0cc880f230ad 356 /** Write a value to the to a LCD register
dreschpe 2:0cc880f230ad 357 *
dreschpe 2:0cc880f230ad 358 * @param reg register to be written
dreschpe 2:0cc880f230ad 359 * @param val data to be written
dreschpe 2:0cc880f230ad 360 */
dreschpe 2:0cc880f230ad 361 void wr_reg (unsigned char reg, unsigned short val);
dreschpe 1:aa3356b16080 362
dreschpe 2:0cc880f230ad 363 /** Read a LCD register
dreschpe 2:0cc880f230ad 364 *
dreschpe 2:0cc880f230ad 365 * @param reg register to be read
dreschpe 2:0cc880f230ad 366 * @returns value of the register
dreschpe 2:0cc880f230ad 367 */
dreschpe 2:0cc880f230ad 368 unsigned short rd_reg (unsigned char reg);
dreschpe 0:cccc5726bdf3 369
dreschpe 2:0cc880f230ad 370 unsigned int orientation;
dreschpe 2:0cc880f230ad 371 unsigned int char_x;
dreschpe 5:2db1b8070d94 372
dreschpe 0:cccc5726bdf3 373
dreschpe 0:cccc5726bdf3 374 };
dreschpe 0:cccc5726bdf3 375
dreschpe 0:cccc5726bdf3 376 #endif