Creating a project for TT_Mxx
LCD/LCD_HX8347/GraphicsDisplay.h@0:7f36c2de1de6, 2019-03-22 (annotated)
- Committer:
- ThunderSoft
- Date:
- Fri Mar 22 03:47:24 2019 +0000
- Revision:
- 0:7f36c2de1de6
Add LCD HX8937 code for TT_Mxx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ThunderSoft | 0:7f36c2de1de6 | 1 | /* mbed GraphicsDisplay Display Library Base Class |
ThunderSoft | 0:7f36c2de1de6 | 2 | * Copyright (c) 2007-2009 sford |
ThunderSoft | 0:7f36c2de1de6 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
ThunderSoft | 0:7f36c2de1de6 | 4 | * |
ThunderSoft | 0:7f36c2de1de6 | 5 | * A library for providing a common base class for Graphics displays |
ThunderSoft | 0:7f36c2de1de6 | 6 | * To port a new display, derive from this class and implement |
ThunderSoft | 0:7f36c2de1de6 | 7 | * the constructor (setup the display), pixel (put a pixel |
ThunderSoft | 0:7f36c2de1de6 | 8 | * at a location), width and height functions. Everything else |
ThunderSoft | 0:7f36c2de1de6 | 9 | * (locate, printf, putc, cls, window, putp, fill, blit, blitbit) |
ThunderSoft | 0:7f36c2de1de6 | 10 | * will come for free. You can also provide a specialised implementation |
ThunderSoft | 0:7f36c2de1de6 | 11 | * of window and putp to speed up the results |
ThunderSoft | 0:7f36c2de1de6 | 12 | */ |
ThunderSoft | 0:7f36c2de1de6 | 13 | |
ThunderSoft | 0:7f36c2de1de6 | 14 | #ifndef MBED_GRAPHICSDISPLAY_H |
ThunderSoft | 0:7f36c2de1de6 | 15 | #define MBED_GRAPHICSDISPLAY_H |
ThunderSoft | 0:7f36c2de1de6 | 16 | |
ThunderSoft | 0:7f36c2de1de6 | 17 | #include "TextDisplay.h" |
ThunderSoft | 0:7f36c2de1de6 | 18 | |
ThunderSoft | 0:7f36c2de1de6 | 19 | |
ThunderSoft | 0:7f36c2de1de6 | 20 | #define RED 0xf800 |
ThunderSoft | 0:7f36c2de1de6 | 21 | #define GREEN 0x07e0 |
ThunderSoft | 0:7f36c2de1de6 | 22 | #define BLUE 0x001f |
ThunderSoft | 0:7f36c2de1de6 | 23 | #define BLACK 0x0000 |
ThunderSoft | 0:7f36c2de1de6 | 24 | #define YELLOW 0xffe0 |
ThunderSoft | 0:7f36c2de1de6 | 25 | #define WHITE 0xffff |
ThunderSoft | 0:7f36c2de1de6 | 26 | |
ThunderSoft | 0:7f36c2de1de6 | 27 | #define FONT_CHAR_WIDTH 8 |
ThunderSoft | 0:7f36c2de1de6 | 28 | #define FONT_CHAR_HEIGHT 16 |
ThunderSoft | 0:7f36c2de1de6 | 29 | |
ThunderSoft | 0:7f36c2de1de6 | 30 | class GraphicsDisplay : public TextDisplay { |
ThunderSoft | 0:7f36c2de1de6 | 31 | |
ThunderSoft | 0:7f36c2de1de6 | 32 | public: |
ThunderSoft | 0:7f36c2de1de6 | 33 | |
ThunderSoft | 0:7f36c2de1de6 | 34 | GraphicsDisplay(const char* name); |
ThunderSoft | 0:7f36c2de1de6 | 35 | |
ThunderSoft | 0:7f36c2de1de6 | 36 | virtual void pixel(int x, int y, int colour) = 0; |
ThunderSoft | 0:7f36c2de1de6 | 37 | virtual int width() = 0; |
ThunderSoft | 0:7f36c2de1de6 | 38 | virtual int height() = 0; |
ThunderSoft | 0:7f36c2de1de6 | 39 | |
ThunderSoft | 0:7f36c2de1de6 | 40 | virtual void window(unsigned int x,unsigned int y,unsigned int w,unsigned int h); |
ThunderSoft | 0:7f36c2de1de6 | 41 | virtual void putp(int colour); |
ThunderSoft | 0:7f36c2de1de6 | 42 | |
ThunderSoft | 0:7f36c2de1de6 | 43 | virtual void cls(); |
ThunderSoft | 0:7f36c2de1de6 | 44 | virtual void fill(int x, int y, int w, int h, int colour); |
ThunderSoft | 0:7f36c2de1de6 | 45 | virtual void blit(int x, int y, int w, int h, const int *colour); |
ThunderSoft | 0:7f36c2de1de6 | 46 | virtual void blitbit(int x, int y, int w, int h, const char* colour); |
ThunderSoft | 0:7f36c2de1de6 | 47 | |
ThunderSoft | 0:7f36c2de1de6 | 48 | virtual void character_(int x, int y, char value,int colour = WHITE); |
ThunderSoft | 0:7f36c2de1de6 | 49 | |
ThunderSoft | 0:7f36c2de1de6 | 50 | virtual void character(int column, int row, int value); |
ThunderSoft | 0:7f36c2de1de6 | 51 | virtual int columns(); |
ThunderSoft | 0:7f36c2de1de6 | 52 | virtual int rows(); |
ThunderSoft | 0:7f36c2de1de6 | 53 | |
ThunderSoft | 0:7f36c2de1de6 | 54 | virtual void sendData(uint16_t data) = 0; |
ThunderSoft | 0:7f36c2de1de6 | 55 | virtual void setAddress(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) = 0; |
ThunderSoft | 0:7f36c2de1de6 | 56 | |
ThunderSoft | 0:7f36c2de1de6 | 57 | virtual void lcd_display_char(uint16_t hwXpos, //specify x position. |
ThunderSoft | 0:7f36c2de1de6 | 58 | uint16_t hwYpos, //specify y position. |
ThunderSoft | 0:7f36c2de1de6 | 59 | uint8_t chChr, //a char is display. |
ThunderSoft | 0:7f36c2de1de6 | 60 | uint8_t chSize, //specify the size of the char |
ThunderSoft | 0:7f36c2de1de6 | 61 | uint16_t hwColor); |
ThunderSoft | 0:7f36c2de1de6 | 62 | protected: |
ThunderSoft | 0:7f36c2de1de6 | 63 | |
ThunderSoft | 0:7f36c2de1de6 | 64 | // pixel location |
ThunderSoft | 0:7f36c2de1de6 | 65 | short _x; |
ThunderSoft | 0:7f36c2de1de6 | 66 | short _y; |
ThunderSoft | 0:7f36c2de1de6 | 67 | |
ThunderSoft | 0:7f36c2de1de6 | 68 | // window location |
ThunderSoft | 0:7f36c2de1de6 | 69 | short _x1; |
ThunderSoft | 0:7f36c2de1de6 | 70 | short _x2; |
ThunderSoft | 0:7f36c2de1de6 | 71 | short _y1; |
ThunderSoft | 0:7f36c2de1de6 | 72 | short _y2; |
ThunderSoft | 0:7f36c2de1de6 | 73 | |
ThunderSoft | 0:7f36c2de1de6 | 74 | }; |
ThunderSoft | 0:7f36c2de1de6 | 75 | |
ThunderSoft | 0:7f36c2de1de6 | 76 | #endif |
ThunderSoft | 0:7f36c2de1de6 | 77 |