GxEPD2_290c.h 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: IL0373 : http://www.e-paper-display.com/download_detail/downloadsId=535.html
  6. //
  7. // Author: Jean-Marc Zingg
  8. //
  9. // Version: see library.properties
  10. //
  11. // Library: https://github.com/ZinggJM/GxEPD2
  12. #ifndef _GxEPD2_290c_H_
  13. #define _GxEPD2_290c_H_
  14. #include "../GxEPD2_EPD.h"
  15. class GxEPD2_290c : public GxEPD2_EPD
  16. {
  17. public:
  18. // attributes
  19. static const uint16_t WIDTH = 128;
  20. static const uint16_t WIDTH_VISIBLE = WIDTH;
  21. static const uint16_t HEIGHT = 296;
  22. static const GxEPD2::Panel panel = GxEPD2::GDEW029Z10;
  23. static const bool hasColor = true;
  24. static const bool hasPartialUpdate = true;
  25. static const bool usePartialUpdateWindow = true; // set false for better image
  26. static const bool hasFastPartialUpdate = false;
  27. static const uint16_t power_on_time = 40; // ms, e.g. 36557us
  28. static const uint16_t power_off_time = 30; // ms, e.g. 20291us
  29. static const uint16_t full_refresh_time = 15000; // ms, e.g. 14845408us
  30. static const uint16_t partial_refresh_time = 15000; // ms, e.g. 14845408us
  31. // constructor
  32. GxEPD2_290c(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. // write to controller memory, with screen refresh; x and w should be multiple of 8
  49. 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);
  50. void drawImagePart(const uint8_t bitmap[], 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. 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);
  53. 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,
  54. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  55. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  56. 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);
  57. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  58. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  59. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  60. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  61. private:
  62. void _writeScreenBuffer(uint8_t value);
  63. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  64. void _PowerOn();
  65. void _PowerOff();
  66. void _InitDisplay();
  67. void _Init_Full();
  68. void _Init_Part();
  69. void _Update_Full();
  70. void _Update_Part();
  71. };
  72. #endif