A library with drivers for different peripherals on the LPC4088 QuickStart Board or related add-on boards.
Dependencies: FATFileSystem
Fork of EALib by
Adafruit_GFX.h@0:0fdadbc3d852, 2013-09-26 (annotated)
- Committer:
- embeddedartists
- Date:
- Thu Sep 26 06:37:02 2013 +0000
- Revision:
- 0:0fdadbc3d852
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:0fdadbc3d852 | 1 | #ifndef _ADAFRUIT_GFX_H |
embeddedartists | 0:0fdadbc3d852 | 2 | |
embeddedartists | 0:0fdadbc3d852 | 3 | |
embeddedartists | 0:0fdadbc3d852 | 4 | #define swap(a, b) { int16_t t = a; a = b; b = t; } |
embeddedartists | 0:0fdadbc3d852 | 5 | |
embeddedartists | 0:0fdadbc3d852 | 6 | class Adafruit_GFX { |
embeddedartists | 0:0fdadbc3d852 | 7 | |
embeddedartists | 0:0fdadbc3d852 | 8 | public: |
embeddedartists | 0:0fdadbc3d852 | 9 | |
embeddedartists | 0:0fdadbc3d852 | 10 | Adafruit_GFX(int16_t w, int16_t h); // Constructor |
embeddedartists | 0:0fdadbc3d852 | 11 | |
embeddedartists | 0:0fdadbc3d852 | 12 | // This MUST be defined by the subclass: |
embeddedartists | 0:0fdadbc3d852 | 13 | virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; |
embeddedartists | 0:0fdadbc3d852 | 14 | |
embeddedartists | 0:0fdadbc3d852 | 15 | // These MAY be overridden by the subclass to provide device-specific |
embeddedartists | 0:0fdadbc3d852 | 16 | // optimized code. Otherwise 'generic' versions are used. |
embeddedartists | 0:0fdadbc3d852 | 17 | virtual void |
embeddedartists | 0:0fdadbc3d852 | 18 | drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 19 | drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 20 | drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 21 | drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 22 | fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 23 | fillScreen(uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 24 | invertDisplay(bool i); |
embeddedartists | 0:0fdadbc3d852 | 25 | |
embeddedartists | 0:0fdadbc3d852 | 26 | // These exist only with Adafruit_GFX (no subclass overrides) |
embeddedartists | 0:0fdadbc3d852 | 27 | void |
embeddedartists | 0:0fdadbc3d852 | 28 | drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 29 | drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, |
embeddedartists | 0:0fdadbc3d852 | 30 | uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 31 | fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 32 | fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, |
embeddedartists | 0:0fdadbc3d852 | 33 | int16_t delta, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 34 | drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, |
embeddedartists | 0:0fdadbc3d852 | 35 | int16_t x2, int16_t y2, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 36 | fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, |
embeddedartists | 0:0fdadbc3d852 | 37 | int16_t x2, int16_t y2, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 38 | drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, |
embeddedartists | 0:0fdadbc3d852 | 39 | int16_t radius, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 40 | fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, |
embeddedartists | 0:0fdadbc3d852 | 41 | int16_t radius, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 42 | drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, |
embeddedartists | 0:0fdadbc3d852 | 43 | int16_t w, int16_t h, uint16_t color), |
embeddedartists | 0:0fdadbc3d852 | 44 | drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, |
embeddedartists | 0:0fdadbc3d852 | 45 | uint16_t bg, uint8_t size), |
embeddedartists | 0:0fdadbc3d852 | 46 | setCursor(int16_t x, int16_t y), |
embeddedartists | 0:0fdadbc3d852 | 47 | setTextColor(uint16_t c), |
embeddedartists | 0:0fdadbc3d852 | 48 | setTextColor(uint16_t c, uint16_t bg), |
embeddedartists | 0:0fdadbc3d852 | 49 | setTextSize(uint8_t s), |
embeddedartists | 0:0fdadbc3d852 | 50 | setTextWrap(bool w), |
embeddedartists | 0:0fdadbc3d852 | 51 | setRotation(uint8_t r); |
embeddedartists | 0:0fdadbc3d852 | 52 | |
embeddedartists | 0:0fdadbc3d852 | 53 | |
embeddedartists | 0:0fdadbc3d852 | 54 | virtual size_t write(uint8_t); |
embeddedartists | 0:0fdadbc3d852 | 55 | |
embeddedartists | 0:0fdadbc3d852 | 56 | int16_t |
embeddedartists | 0:0fdadbc3d852 | 57 | height(void), |
embeddedartists | 0:0fdadbc3d852 | 58 | width(void); |
embeddedartists | 0:0fdadbc3d852 | 59 | |
embeddedartists | 0:0fdadbc3d852 | 60 | uint8_t getRotation(void); |
embeddedartists | 0:0fdadbc3d852 | 61 | |
embeddedartists | 0:0fdadbc3d852 | 62 | protected: |
embeddedartists | 0:0fdadbc3d852 | 63 | const int16_t |
embeddedartists | 0:0fdadbc3d852 | 64 | WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes |
embeddedartists | 0:0fdadbc3d852 | 65 | int16_t |
embeddedartists | 0:0fdadbc3d852 | 66 | _width, _height, // Display w/h as modified by current rotation |
embeddedartists | 0:0fdadbc3d852 | 67 | cursor_x, cursor_y; |
embeddedartists | 0:0fdadbc3d852 | 68 | uint16_t |
embeddedartists | 0:0fdadbc3d852 | 69 | textcolor, textbgcolor; |
embeddedartists | 0:0fdadbc3d852 | 70 | uint8_t |
embeddedartists | 0:0fdadbc3d852 | 71 | textsize, |
embeddedartists | 0:0fdadbc3d852 | 72 | rotation; |
embeddedartists | 0:0fdadbc3d852 | 73 | bool |
embeddedartists | 0:0fdadbc3d852 | 74 | wrap; // If set, 'wrap' text at right edge of display |
embeddedartists | 0:0fdadbc3d852 | 75 | }; |
embeddedartists | 0:0fdadbc3d852 | 76 | |
embeddedartists | 0:0fdadbc3d852 | 77 | #endif // _ADAFRUIT_GFX_H |
embeddedartists | 0:0fdadbc3d852 | 78 | |
embeddedartists | 0:0fdadbc3d852 | 79 |