Adapted from Peter Dresche's original for Waveshare 2.8inch TFT Touch Shield Board and Mbed 6. RGB order reversed by changing reg 16 commands, spi write code adjusted as there is no reset pin but there is data command pin. Wait commands changed for new thread_sleep style, Stream class explicitly included. 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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GraphicsDisplay.h Source File

GraphicsDisplay.h

00001 /* mbed GraphicsDisplay Display Library Base Class
00002  * Copyright (c) 2007-2009 sford
00003  * Released under the MIT License: http://mbed.org/license/mit
00004  *
00005  * A library for providing a common base class for Graphics displays
00006  * To port a new display, derive from this class and implement
00007  * the constructor (setup the display), pixel (put a pixel
00008  * at a location), width and height functions. Everything else
00009  * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) 
00010  * will come for free. You can also provide a specialised implementation
00011  * of window and putp to speed up the results
00012  */
00013 
00014 #ifndef MBED_GRAPHICSDISPLAY_H
00015 #define MBED_GRAPHICSDISPLAY_H
00016 
00017 #include "TextDisplay.h"
00018 
00019 class GraphicsDisplay : public TextDisplay {
00020 
00021 public:         
00022           
00023     GraphicsDisplay(const char* name);
00024      
00025     virtual void pixel(int x, int y, int colour) = 0;
00026     virtual int width() = 0;
00027     virtual int height() = 0;
00028         
00029     virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h);
00030     virtual void putp(int colour);
00031     
00032     virtual void cls();
00033     virtual void fill(int x, int y, int w, int h, int colour);
00034     virtual void blit(int x, int y, int w, int h, const int *colour);    
00035     virtual void blitbit(int x, int y, int w, int h, const char* colour);
00036     
00037     virtual void character(int column, int row, int value);
00038     virtual int columns();
00039     virtual int rows();
00040     
00041 protected:
00042 
00043     // pixel location
00044     short _x;
00045     short _y;
00046     
00047     // window location
00048     short _x1;
00049     short _x2;
00050     short _y1;
00051     short _y2;
00052 
00053 };
00054 
00055 #endif