GxEPD2_266c_GDEY0266F51H.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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=1435&id=1018
  5. // Panel: GDEY0266F51H : https://www.good-display.com/product/467.html
  6. // Panel specs: https://v4.cecdn.yun300.cn/100001_1909185148/GDEY0266F51H.pdf
  7. // Controller: JD79667 : no specs, see panel specs for command list subset
  8. //
  9. // Author: Jean-Marc Zingg
  10. //
  11. // Version: see library.properties
  12. //
  13. // Library: https://github.com/ZinggJM/GxEPD2
  14. #ifndef _GxEPD2_266c_GDEY0266F51H_H_
  15. #define _GxEPD2_266c_GDEY0266F51H_H_
  16. #include "../GxEPD2_EPD.h"
  17. class GxEPD2_266c_GDEY0266F51H : public GxEPD2_EPD
  18. {
  19. public:
  20. // attributes
  21. static const uint16_t WIDTH = 184;
  22. static const uint16_t WIDTH_VISIBLE = WIDTH;
  23. static const uint16_t HEIGHT = 360;
  24. static const GxEPD2::Panel panel = GxEPD2::GDEY0266F51H;
  25. static const bool hasColor = true;
  26. static const bool hasPartialUpdate = true; // can be switched off
  27. static const bool hasFastPartialUpdate = false;
  28. static const uint16_t power_on_time = 200; // ms, e.g. 158625us
  29. static const uint16_t power_off_time = 100; // ms, e.g. 81326us
  30. static const uint16_t full_refresh_time = 25000; // ms, e.g. 26028097us
  31. static const uint16_t partial_refresh_time = 25000; // ms, e.g. 26028097us
  32. // constructor
  33. GxEPD2_266c_GDEY0266F51H(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 clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
  38. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  39. void writeScreenBuffer(uint8_t black_value, uint8_t color_value); // init controller memory
  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 writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  43. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  44. 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);
  45. 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,
  46. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  47. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  48. 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);
  49. void writeNativePart(const uint8_t* data1, const uint8_t* data2, 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. // write to controller memory, with screen refresh; x and w should be multiple of 8
  52. 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);
  53. void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  54. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  55. 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);
  56. 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,
  57. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  58. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  59. 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);
  60. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  61. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  62. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  63. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  64. void setPaged(); // for GxEPD2_154c paged workaround, also for 4-color for use with hasPartialUpdate = false
  65. private:
  66. void _refresh(bool partial_update_mode);
  67. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial_mode = true);
  68. void _PowerOn();
  69. void _PowerOff();
  70. void _InitDisplay();
  71. private:
  72. bool _paged;
  73. };
  74. #endif