GxEPD2_1160c_GDEY116F51.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=2047&id=1477
  5. // Panel: GDEY116F51 : https://www.good-display.com/product/543.html
  6. // Controller: SSD2677 : https://v4.cecdn.yun300.cn/100001_1909185148/SSD2677%28Rev1.1%29.pdf
  7. //
  8. // Author: Jean-Marc Zingg
  9. //
  10. // Version: see library.properties
  11. //
  12. // Library: https://github.com/ZinggJM/GxEPD2
  13. #ifndef _GxEPD2_1160c_GDEY116F51_H_
  14. #define _GxEPD2_1160c_GDEY116F51_H_
  15. #include "../GxEPD2_EPD.h"
  16. class GxEPD2_1160c_GDEY116F51 : public GxEPD2_EPD
  17. {
  18. public:
  19. // attributes
  20. static const uint16_t WIDTH = 960;
  21. static const uint16_t WIDTH_VISIBLE = WIDTH;
  22. static const uint16_t HEIGHT = 640;
  23. static const GxEPD2::Panel panel = GxEPD2::GDEY116F51;
  24. static const bool hasColor = true;
  25. static const bool hasPartialUpdate = true;
  26. static const bool hasFastPartialUpdate = false;
  27. static const uint16_t power_on_time = 100; // ms, e.g. 83001us
  28. static const uint16_t power_off_time = 150; // ms, e.g. 142001us
  29. static const uint16_t full_refresh_time = 20000; // ms, e.g. 19255001us
  30. static const uint16_t partial_refresh_time = 20000; // ms, e.g. 19255001us
  31. // constructor
  32. GxEPD2_1160c_GDEY116F51(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
  33. // methods (virtual)
  34. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  35. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  36. void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
  37. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  38. void writeScreenBuffer(uint8_t black_value, uint8_t color_value); // init controller memory
  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 writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  42. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  43. 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);
  44. 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,
  45. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  46. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  47. 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);
  48. 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,
  49. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  50. // write to controller memory, with screen refresh; x and w should be multiple of 8
  51. 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);
  52. void drawImagePart(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. 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);
  55. 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,
  56. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  57. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  58. 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);
  59. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  60. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  61. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  62. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  63. void setPaged(); // for GxEPD2_154c paged workaround, also for 4-color for use with hasPartialUpdate = false
  64. private:
  65. void _refresh(bool partial_update_mode);
  66. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial_mode = true);
  67. void _PowerOn();
  68. void _PowerOff();
  69. void _InitDisplay();
  70. uint8_t _invert(uint8_t data); // special inversion for demo bitmap
  71. private:
  72. bool _paged;
  73. };
  74. #endif