![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Please run it on your NUCLEO-L152
ADA_GFX_kbv/ADA_GFX_kbv.h
- Committer:
- davidprentice
- Date:
- 2019-09-18
- Revision:
- 0:b608c7f02f80
File content as of revision 0:b608c7f02f80:
#ifndef _ADAFRUIT_GFX_H #define _ADAFRUIT_GFX_H //#define USE_VFONTS #include "Arduino.h" #define boolean bool #ifndef HEX #define HEX 1 #endif #define swap(a, b) { int16_t t = a; a = b; b = t; } class Adafruit_GFX { //: public Stream { // requires an interface public: Adafruit_GFX(int16_t w, int16_t h); // Constructor // This MUST be defined by the subclass: virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; // These MAY be overridden by the subclass to provide device-specific // optimized code. Otherwise 'generic' versions are used. virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color), drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), fillScreen(uint16_t color), invertDisplay(boolean i); // These exist only with Adafruit_GFX (no subclass overrides) void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color), fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color), drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color), fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color), drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color), fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color), drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color), drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size), setCursor(int16_t x, int16_t y), setTextColor(uint16_t c), setTextColor(uint16_t c, uint16_t bg), setTextSize(uint8_t s), setTextWrap(boolean w), setRotation(uint8_t r); #if defined(ARDUINO) && ARDUINO < 100 virtual void write(uint8_t); #else virtual size_t write(uint8_t); #endif int printf(const char* format, ...); void print(const char *s) { printf("%s", s); } void print(char *s) { printf("%s", s); } void print(char c) { printf("%c", c); } void print(int16_t v) { printf("%d", v); } void print(int32_t vl) { printf("%ld", vl); } void print(double vd, int =2) { printf("%0.2f", vd); } void println(uint8_t u, int fmt=0) { if (fmt == 0) printf("%u\n", u); else printf("%04X\n", u); } void println(uint16_t u, int fmt=0) { if (fmt == 0) printf("%u\n", u); else printf("%04X\n", u); } void println(uint32_t ul, int fmt=0) { if (fmt == 0) printf("%lu\n", ul); else printf("%04lX\n", ul); } void println(const char *s="") { printf("%s\n", s); } void println(double vd, int prec=2) { printf("%0.2f\n", vd); } int16_t height(void), width(void); uint8_t getRotation(void); protected: const int16_t WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes int16_t _width, _height, // Display w/h as modified by current rotation cursor_x, cursor_y; uint16_t textcolor, textbgcolor; uint8_t textsize, rotation; boolean wrap; // If set, 'wrap' text at right edge of display #if defined USE_VFONTS public: void setFont(const PROGMEM uint8_t *ads, uint8_t mode = 0); void drawFontChar(int16_t x, int16_t y, uint8_t c, uint16_t color, uint16_t bg, uint8_t size); int8_t charWidth(uint8_t c); private: uint8_t *vfont_ads, vfont_wid, vfont_ht, vfont_ofs, vfont_siz, vfont_mode, *vfont_letter_ads; #endif }; #endif // _ADAFRUIT_GFX_H