This library can be used to control a low-cost Adafruit 358 TFT display. It has basic functionality but is a starting point for others trying to control this type of display using the FRDM-K64F.
GraphicsDisplay.h@1:cd3c7c2e2746, 2014-08-07 (annotated)
- Committer:
- bmazzeo
- Date:
- Thu Aug 07 03:17:21 2014 +0000
- Revision:
- 1:cd3c7c2e2746
- Parent:
- 0:7cb96171f886
A few updates to clean up the code before publishing.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bmazzeo | 0:7cb96171f886 | 1 | /* mbed GraphicsDisplay Display Library Base Class |
bmazzeo | 0:7cb96171f886 | 2 | * Copyright (c) 2007-2009 sford |
bmazzeo | 0:7cb96171f886 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
bmazzeo | 0:7cb96171f886 | 4 | * |
bmazzeo | 0:7cb96171f886 | 5 | * A library for providing a common base class for Graphics displays |
bmazzeo | 0:7cb96171f886 | 6 | * To port a new display, derive from this class and implement |
bmazzeo | 0:7cb96171f886 | 7 | * the constructor (setup the display), pixel (put a pixel |
bmazzeo | 0:7cb96171f886 | 8 | * at a location), width and height functions. Everything else |
bmazzeo | 0:7cb96171f886 | 9 | * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) |
bmazzeo | 0:7cb96171f886 | 10 | * will come for free. You can also provide a specialised implementation |
bmazzeo | 0:7cb96171f886 | 11 | * of window and putp to speed up the results |
bmazzeo | 0:7cb96171f886 | 12 | */ |
bmazzeo | 0:7cb96171f886 | 13 | |
bmazzeo | 0:7cb96171f886 | 14 | #ifndef MBED_GRAPHICSDISPLAY_H |
bmazzeo | 0:7cb96171f886 | 15 | #define MBED_GRAPHICSDISPLAY_H |
bmazzeo | 0:7cb96171f886 | 16 | |
bmazzeo | 0:7cb96171f886 | 17 | #include "TextDisplay.h" |
bmazzeo | 0:7cb96171f886 | 18 | |
bmazzeo | 0:7cb96171f886 | 19 | class GraphicsDisplay : public TextDisplay { |
bmazzeo | 0:7cb96171f886 | 20 | |
bmazzeo | 0:7cb96171f886 | 21 | public: |
bmazzeo | 0:7cb96171f886 | 22 | |
bmazzeo | 0:7cb96171f886 | 23 | GraphicsDisplay(const char* name); |
bmazzeo | 0:7cb96171f886 | 24 | |
bmazzeo | 0:7cb96171f886 | 25 | virtual void pixel(int x, int y, int colour) = 0; |
bmazzeo | 0:7cb96171f886 | 26 | virtual int width() = 0; |
bmazzeo | 0:7cb96171f886 | 27 | virtual int height() = 0; |
bmazzeo | 0:7cb96171f886 | 28 | |
bmazzeo | 0:7cb96171f886 | 29 | virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h); |
bmazzeo | 0:7cb96171f886 | 30 | virtual void putp(int colour); |
bmazzeo | 0:7cb96171f886 | 31 | |
bmazzeo | 0:7cb96171f886 | 32 | virtual void cls(); |
bmazzeo | 0:7cb96171f886 | 33 | virtual void fill(int x, int y, int w, int h, int colour); |
bmazzeo | 0:7cb96171f886 | 34 | virtual void blit(int x, int y, int w, int h, const int *colour); |
bmazzeo | 0:7cb96171f886 | 35 | virtual void blitbit(int x, int y, int w, int h, const char* colour); |
bmazzeo | 0:7cb96171f886 | 36 | |
bmazzeo | 0:7cb96171f886 | 37 | virtual void character(int column, int row, int value); |
bmazzeo | 0:7cb96171f886 | 38 | virtual int columns(); |
bmazzeo | 0:7cb96171f886 | 39 | virtual int rows(); |
bmazzeo | 0:7cb96171f886 | 40 | |
bmazzeo | 0:7cb96171f886 | 41 | protected: |
bmazzeo | 0:7cb96171f886 | 42 | |
bmazzeo | 0:7cb96171f886 | 43 | // pixel location |
bmazzeo | 0:7cb96171f886 | 44 | short _x; |
bmazzeo | 0:7cb96171f886 | 45 | short _y; |
bmazzeo | 0:7cb96171f886 | 46 | |
bmazzeo | 0:7cb96171f886 | 47 | // window location |
bmazzeo | 0:7cb96171f886 | 48 | short _x1; |
bmazzeo | 0:7cb96171f886 | 49 | short _x2; |
bmazzeo | 0:7cb96171f886 | 50 | short _y1; |
bmazzeo | 0:7cb96171f886 | 51 | short _y2; |
bmazzeo | 0:7cb96171f886 | 52 | |
bmazzeo | 0:7cb96171f886 | 53 | }; |
bmazzeo | 0:7cb96171f886 | 54 | |
bmazzeo | 0:7cb96171f886 | 55 | #endif |