GxEPD2_750_GDEY075T7.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: https://www.good-display.com/comp/xcompanyFile/downloadNew.do?appId=24&fid=1373&id=1125
  5. // Panel: GDEY075T7 : https://www.good-display.com/product/396.html
  6. // Controller: UC8179 : https://v4.cecdn.yun300.cn/100001_1909185148/UC8179.pdf
  7. //
  8. // Author: Jean-Marc Zingg
  9. //
  10. // Version: see library.properties
  11. //
  12. // Library: https://github.com/ZinggJM/GxEPD2
  13. #ifndef _GxEPD2_750_GDEY075T7_H_
  14. #define _GxEPD2_750_GDEY075T7_H_
  15. #include "../GxEPD2_EPD.h"
  16. class GxEPD2_750_GDEY075T7 : public GxEPD2_EPD
  17. {
  18. public:
  19. // attributes
  20. static const uint16_t WIDTH = 800;
  21. static const uint16_t WIDTH_VISIBLE = WIDTH;
  22. static const uint16_t HEIGHT = 480;
  23. static const GxEPD2::Panel panel = GxEPD2::GDEY075T7;
  24. static const bool hasColor = false;
  25. static const bool hasPartialUpdate = true;
  26. static const bool usePartialUpdateWindow = false; // set false for better image
  27. static const bool hasFastPartialUpdate = true; // set this false to force full refresh always
  28. static const bool useFastFullUpdate = true; // set false for extended (low) temperature range
  29. static const bool useFastPartialUpdateFromOTP = true; // set this false for earlier batches, such as the panel I have (1580258us)
  30. static const uint16_t power_on_time = 140; // ms, e.g. 129018us
  31. static const uint16_t power_off_time = 42; // ms, e.g. 40430us
  32. static const uint16_t full_refresh_time = 1200; // ms, e.g. 1171000us
  33. static const uint16_t partial_refresh_time = 450; // ms, e.g. 435000us
  34. // constructor
  35. GxEPD2_750_GDEY075T7(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
  36. // methods (virtual)
  37. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  38. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  39. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  40. // write to controller memory, without screen refresh; x and w should be multiple of 8
  41. 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);
  42. 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);
  43. 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);
  44. void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  45. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  46. void writeImagePartToPrevious(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  47. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  48. 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);
  49. 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,
  50. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  51. // for differential update: set current and previous buffers equal (for fast partial update to work correctly)
  52. // done by controller (N2OCP); override with empty code
  53. 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) {};
  54. void writeImagePartAgain(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  55. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) {};
  56. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  57. 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);
  58. // write to controller memory, with screen refresh; x and w should be multiple of 8
  59. 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);
  60. void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  61. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  62. 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);
  63. 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,
  64. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  65. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  66. 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);
  67. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  68. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  69. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  70. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  71. private:
  72. void _writeScreenBuffer(uint8_t command, uint8_t value);
  73. 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);
  74. 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,
  75. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  76. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  77. void _PowerOn();
  78. void _PowerOff();
  79. void _InitDisplay();
  80. void _Init_Full();
  81. void _Init_Part();
  82. void _Update_Full();
  83. void _Update_Part();
  84. private:
  85. static const unsigned char lut_20_LUTC_partial[];
  86. static const unsigned char lut_21_LUTWW_partial[];
  87. static const unsigned char lut_22_LUTKW_partial[];
  88. static const unsigned char lut_23_LUTWK_partial[];
  89. static const unsigned char lut_24_LUTKK_partial[];
  90. static const unsigned char lut_25_LUTBD_partial[];
  91. };
  92. #endif