acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
Arduino_TFT.h (3446B)
1 /* 2 * start rewrite from: 3 * https://github.com/adafruit/Adafruit-GFX-Library.git 4 */ 5 #ifndef _ARDUINO_TFT_H_ 6 #define _ARDUINO_TFT_H_ 7 8 #include "Arduino_DataBus.h" 9 #include "Arduino_GFX.h" 10 11 class Arduino_TFT : public Arduino_GFX 12 { 13 public: 14 Arduino_TFT(Arduino_DataBus *bus, int8_t rst, uint8_t r, bool ips, int16_t w, int16_t h, uint8_t col_offset1, uint8_t row_offset1, uint8_t col_offset2, uint8_t row_offset2); 15 16 // This SHOULD be defined by the subclass: 17 void setRotation(uint8_t r) override; 18 19 // This MUST be defined by the subclass: 20 // and also protected function: tftInit() 21 virtual void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) = 0; 22 23 bool begin(int32_t speed = GFX_NOT_DEFINED); 24 void startWrite(void) override; 25 void endWrite(void) override; 26 void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override; 27 void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override; 28 void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override; 29 void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override; 30 31 virtual void writeRepeat(uint16_t color, uint32_t len); 32 33 void setAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h); 34 virtual void writeColor(uint16_t color); 35 36 // TFT optimization code, too big for ATMEL family 37 #if !defined(LITTLE_FOOT_PRINT) 38 virtual void writePixels(uint16_t *data, uint32_t size); 39 virtual void writeIndexedPixels(uint8_t *bitmap, uint16_t *color_index, uint32_t len); 40 virtual void writeIndexedPixelsDouble(uint8_t *bitmap, uint16_t *color_index, uint32_t len); 41 42 void writeBytes(uint8_t *data, uint32_t size); 43 void pushColor(uint16_t color); 44 45 void writeSlashLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override; 46 void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color, uint16_t bg) override; 47 void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg) override; 48 void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h) override; 49 void drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) override; 50 void drawIndexedBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint16_t *color_index, int16_t w, int16_t h) override; 51 void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h) override; 52 void draw16bitRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h) override; 53 void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override; 54 void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override; 55 void draw24bitRGBBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h) override; 56 void draw24bitRGBBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) override; 57 void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg) override; 58 #endif // !defined(LITTLE_FOOT_PRINT) 59 60 protected: 61 virtual void tftInit() = 0; 62 63 Arduino_DataBus *_bus; 64 int8_t _rst; 65 bool _ips; 66 uint8_t COL_OFFSET1, ROW_OFFSET1; 67 uint8_t COL_OFFSET2, ROW_OFFSET2; 68 uint8_t _xStart, _yStart; 69 int16_t _currentX, _currentY; 70 uint16_t _currentW, _currentH; 71 int8_t _override_datamode = GFX_NOT_DEFINED; 72 73 private: 74 }; 75 76 #endif