![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Final
Dependencies: IRremote HCSR04 TB6612FNG
oled/Adafruit_GFX.h@97:59d348745d96, 2019-06-16 (annotated)
- Committer:
- eunmango
- Date:
- Sun Jun 16 04:51:51 2019 +0000
- Revision:
- 97:59d348745d96
s
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
eunmango | 97:59d348745d96 | 1 | #ifndef _ADAFRUIT_GFX_H |
eunmango | 97:59d348745d96 | 2 | #define _ADAFRUIT_GFX_H |
eunmango | 97:59d348745d96 | 3 | |
eunmango | 97:59d348745d96 | 4 | #include <stdlib.h> |
eunmango | 97:59d348745d96 | 5 | |
eunmango | 97:59d348745d96 | 6 | #include "gfxfont.h" |
eunmango | 97:59d348745d96 | 7 | |
eunmango | 97:59d348745d96 | 8 | class Adafruit_GFX { |
eunmango | 97:59d348745d96 | 9 | |
eunmango | 97:59d348745d96 | 10 | public: |
eunmango | 97:59d348745d96 | 11 | |
eunmango | 97:59d348745d96 | 12 | Adafruit_GFX(int16_t w, int16_t h); // Constructor |
eunmango | 97:59d348745d96 | 13 | |
eunmango | 97:59d348745d96 | 14 | // This MUST be defined by the subclass: |
eunmango | 97:59d348745d96 | 15 | virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; |
eunmango | 97:59d348745d96 | 16 | |
eunmango | 97:59d348745d96 | 17 | // These MAY be overridden by the subclass to provide device-specific |
eunmango | 97:59d348745d96 | 18 | // optimized code. Otherwise 'generic' versions are used. |
eunmango | 97:59d348745d96 | 19 | virtual void |
eunmango | 97:59d348745d96 | 20 | drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color), |
eunmango | 97:59d348745d96 | 21 | drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), |
eunmango | 97:59d348745d96 | 22 | drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), |
eunmango | 97:59d348745d96 | 23 | drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), |
eunmango | 97:59d348745d96 | 24 | fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), |
eunmango | 97:59d348745d96 | 25 | fillScreen(uint16_t color), |
eunmango | 97:59d348745d96 | 26 | invertDisplay(bool i); |
eunmango | 97:59d348745d96 | 27 | |
eunmango | 97:59d348745d96 | 28 | // These exist only with Adafruit_GFX (no subclass overrides) |
eunmango | 97:59d348745d96 | 29 | void |
eunmango | 97:59d348745d96 | 30 | drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), |
eunmango | 97:59d348745d96 | 31 | drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, |
eunmango | 97:59d348745d96 | 32 | uint16_t color), |
eunmango | 97:59d348745d96 | 33 | fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), |
eunmango | 97:59d348745d96 | 34 | fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, |
eunmango | 97:59d348745d96 | 35 | int16_t delta, uint16_t color), |
eunmango | 97:59d348745d96 | 36 | drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, |
eunmango | 97:59d348745d96 | 37 | int16_t x2, int16_t y2, uint16_t color), |
eunmango | 97:59d348745d96 | 38 | fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, |
eunmango | 97:59d348745d96 | 39 | int16_t x2, int16_t y2, uint16_t color), |
eunmango | 97:59d348745d96 | 40 | drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, |
eunmango | 97:59d348745d96 | 41 | int16_t radius, uint16_t color), |
eunmango | 97:59d348745d96 | 42 | fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, |
eunmango | 97:59d348745d96 | 43 | int16_t radius, uint16_t color), |
eunmango | 97:59d348745d96 | 44 | |
eunmango | 97:59d348745d96 | 45 | drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color), |
eunmango | 97:59d348745d96 | 46 | drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg), |
eunmango | 97:59d348745d96 | 47 | |
eunmango | 97:59d348745d96 | 48 | drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, |
eunmango | 97:59d348745d96 | 49 | int16_t w, int16_t h, uint16_t color), |
eunmango | 97:59d348745d96 | 50 | drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, |
eunmango | 97:59d348745d96 | 51 | uint16_t bg, uint8_t size), |
eunmango | 97:59d348745d96 | 52 | setCursor(int16_t x, int16_t y), |
eunmango | 97:59d348745d96 | 53 | setTextColor(uint16_t c), |
eunmango | 97:59d348745d96 | 54 | setTextColor(uint16_t c, uint16_t bg), |
eunmango | 97:59d348745d96 | 55 | setTextSize(uint8_t s), |
eunmango | 97:59d348745d96 | 56 | setTextWrap(bool w), |
eunmango | 97:59d348745d96 | 57 | setRotation(uint8_t r), |
eunmango | 97:59d348745d96 | 58 | cp437(bool x=true), |
eunmango | 97:59d348745d96 | 59 | setFont(const GFXfont *f = NULL), |
eunmango | 97:59d348745d96 | 60 | getTextBounds(char *string, int16_t x, int16_t y, |
eunmango | 97:59d348745d96 | 61 | int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h), |
eunmango | 97:59d348745d96 | 62 | getTextBounds(const char *s, int16_t x, int16_t y, |
eunmango | 97:59d348745d96 | 63 | int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h), |
eunmango | 97:59d348745d96 | 64 | print(const char* str), |
eunmango | 97:59d348745d96 | 65 | println(const char* str); |
eunmango | 97:59d348745d96 | 66 | |
eunmango | 97:59d348745d96 | 67 | virtual size_t write(uint8_t); |
eunmango | 97:59d348745d96 | 68 | |
eunmango | 97:59d348745d96 | 69 | int16_t height(void) const; |
eunmango | 97:59d348745d96 | 70 | int16_t width(void) const; |
eunmango | 97:59d348745d96 | 71 | |
eunmango | 97:59d348745d96 | 72 | uint8_t getRotation(void) const; |
eunmango | 97:59d348745d96 | 73 | |
eunmango | 97:59d348745d96 | 74 | // get current cursor position (get rotation safe maximum values, using: width() for x, height() for y) |
eunmango | 97:59d348745d96 | 75 | int16_t getCursorX(void) const; |
eunmango | 97:59d348745d96 | 76 | int16_t getCursorY(void) const; |
eunmango | 97:59d348745d96 | 77 | |
eunmango | 97:59d348745d96 | 78 | protected: |
eunmango | 97:59d348745d96 | 79 | const int16_t |
eunmango | 97:59d348745d96 | 80 | WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes |
eunmango | 97:59d348745d96 | 81 | int16_t |
eunmango | 97:59d348745d96 | 82 | _width, _height, // Display w/h as modified by current rotation |
eunmango | 97:59d348745d96 | 83 | cursor_x, cursor_y; |
eunmango | 97:59d348745d96 | 84 | uint16_t |
eunmango | 97:59d348745d96 | 85 | textcolor, textbgcolor; |
eunmango | 97:59d348745d96 | 86 | uint8_t |
eunmango | 97:59d348745d96 | 87 | textsize, |
eunmango | 97:59d348745d96 | 88 | rotation; |
eunmango | 97:59d348745d96 | 89 | bool |
eunmango | 97:59d348745d96 | 90 | wrap, // If set, 'wrap' text at right edge of display |
eunmango | 97:59d348745d96 | 91 | _cp437; // If set, use correct CP437 charset (default is off) |
eunmango | 97:59d348745d96 | 92 | GFXfont |
eunmango | 97:59d348745d96 | 93 | *gfxFont; |
eunmango | 97:59d348745d96 | 94 | }; |
eunmango | 97:59d348745d96 | 95 | |
eunmango | 97:59d348745d96 | 96 | #endif // _ADAFRUIT_GFX_H |