GxEPD2_266_GDEY0266T90.h 6.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
  2. // Requires HW SPI and Adafruit_GFX. Caution: the e-paper panels require 3.3V supply AND data lines!
  3. //
  4. // based on Demo Example from Good Display, available here: https://www.good-display.com/product/412.html
  5. // Panel: GDEY0266T90 : https://www.good-display.com/product/412.html
  6. // Controller : SSD1680 : https://v4.cecdn.yun300.cn/100001_1909185148/SSD1680.pdf
  7. //
  8. // Author: Jean-Marc Zingg
  9. //
  10. // Version: see library.properties
  11. //
  12. // Library: https://github.com/ZinggJM/GxEPD2
  13. #ifndef _GxEPD2_266_GDEY0266T90_H_
  14. #define _GxEPD2_266_GDEY0266T90_H_
  15. #include "../GxEPD2_EPD.h"
  16. class GxEPD2_266_GDEY0266T90 : public GxEPD2_EPD
  17. {
  18. public:
  19. // attributes
  20. static const uint16_t WIDTH = 152;
  21. static const uint16_t WIDTH_VISIBLE = WIDTH;
  22. static const uint16_t HEIGHT = 296;
  23. static const GxEPD2::Panel panel = GxEPD2::GDEY0266T90;
  24. static const bool hasColor = false;
  25. static const bool hasPartialUpdate = true;
  26. static const bool hasFastPartialUpdate = true;
  27. static const bool useFastFullUpdate = true; // set false for extended (low) temperature range
  28. static const uint16_t power_on_time = 100; // ms, e.g. 96000us
  29. static const uint16_t power_off_time = 150; // ms, e.g. 140000us
  30. static const uint16_t full_refresh_time = 1700; // ms, e.g. 1618000us
  31. static const uint16_t partial_refresh_time = 500; // ms, e.g. 457000us
  32. // constructor
  33. GxEPD2_266_GDEY0266T90(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
  34. // methods (virtual)
  35. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  36. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  37. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  38. void writeScreenBufferAgain(uint8_t value = 0xFF); // init previous buffer controller memory (default white)
  39. // write to controller memory, without screen refresh; x and w should be multiple of 8
  40. void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  41. void writeImageForFullRefresh(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  42. void writeImageToPrevious(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  43. void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  44. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  45. void writeImagePartToPrevious(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  46. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  47. void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  48. void writeImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  49. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  50. // for differential update: set current and previous buffers equal (for fast partial update to work correctly)
  51. void writeImageAgain(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  52. void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  53. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  54. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  55. void writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  56. // write to controller memory, with screen refresh; x and w should be multiple of 8
  57. void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  58. void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  59. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  60. void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  61. void drawImagePart(const uint8_t* black, const uint8_t* color, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  62. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  63. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  64. void drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  65. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  66. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  67. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  68. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  69. private:
  70. void _writeScreenBuffer(uint8_t command, uint8_t value);
  71. void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  72. void _writeImagePart(uint8_t command, const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  73. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  74. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  75. void _PowerOn();
  76. void _PowerOff();
  77. void _InitDisplay();
  78. void _Update_Full();
  79. void _Update_Part();
  80. };
  81. #endif