GxEPD2_260_M01.h 5.1 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: these e-papers require 3.3V supply AND data lines!
  3. //
  4. // based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
  5. // Controller: UC8151 (IL0373) : https://www.good-display.com/public/html/pdfjs/viewer/viewernew.html?file=https://v4.cecdn.yun300.cn/100001_1909185148/UC8151D.pdf
  6. // Controller: IL0373 (UC8151) : http://www.e-paper-display.com/download_detail/downloadsId=535.html
  7. //
  8. // Author: Jean-Marc Zingg
  9. //
  10. // Version: see library.properties
  11. //
  12. // Library: https://github.com/ZinggJM/GxEPD2
  13. #ifndef _GxEPD2_260_M01_H_
  14. #define _GxEPD2_260_M01_H_
  15. #include "../GxEPD2_EPD.h"
  16. class GxEPD2_260_M01 : public GxEPD2_EPD
  17. {
  18. public:
  19. // attributes
  20. static const uint16_t WIDTH = 152;
  21. static const uint16_t HEIGHT = 296;
  22. static const GxEPD2::Panel panel = GxEPD2::GDEW026M01;
  23. static const bool hasColor = false;
  24. static const bool hasPartialUpdate = true;
  25. static const bool hasFastPartialUpdate = true; // set false for extended temperature range
  26. static const uint16_t power_on_time = 100; // ms, e.g. 60981us
  27. static const uint16_t power_off_time = 50; // ms, e.g. 39736us
  28. static const uint16_t full_refresh_time = 3400; // ms, e.g. 3308455us
  29. static const uint16_t partial_refresh_time = 1000; // ms, e.g. 938384us
  30. // constructor
  31. GxEPD2_260_M01(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
  32. // methods (virtual)
  33. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  34. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  35. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  36. // write to controller memory, without screen refresh; x and w should be multiple of 8
  37. 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);
  38. void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  39. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  40. 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);
  41. 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,
  42. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  43. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  44. 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);
  45. // write to controller memory, with screen refresh; x and w should be multiple of 8
  46. 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);
  47. void drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  48. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  49. 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);
  50. 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,
  51. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  52. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  53. 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);
  54. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  55. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  56. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  57. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  58. private:
  59. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  60. void _PowerOn();
  61. void _PowerOff();
  62. void _InitDisplay();
  63. void _Init_Full();
  64. void _Init_Part();
  65. void _Update_Full();
  66. void _Update_Part();
  67. private:
  68. static const unsigned char lut_20_vcomDC_partial[];
  69. static const unsigned char lut_21_ww_partial[];
  70. static const unsigned char lut_22_bw_partial[];
  71. static const unsigned char lut_23_wb_partial[];
  72. static const unsigned char lut_24_bb_partial[];
  73. };
  74. #endif