GxEPD2_290_C90c.h 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: SSD1680 : https://v4.cecdn.yun300.cn/100001_1909185148/SSD1680.pdf
  6. //
  7. // Author: Jean-Marc Zingg
  8. //
  9. // Version: see library.properties
  10. //
  11. // Library: https://github.com/ZinggJM/GxEPD2
  12. #ifndef _GxEPD2_290_C90c_H_
  13. #define _GxEPD2_290_C90c_H_
  14. #include "../GxEPD2_EPD.h"
  15. class GxEPD2_290_C90c : public GxEPD2_EPD
  16. {
  17. public:
  18. // attributes
  19. static const uint16_t WIDTH = 128;
  20. static const uint16_t HEIGHT = 296;
  21. static const GxEPD2::Panel panel = GxEPD2::GDEM029C90;
  22. static const bool hasColor = true;
  23. static const bool hasPartialUpdate = true; // but refresh is full screen
  24. static const bool hasFastPartialUpdate = false;
  25. static const uint16_t power_on_time = 100; // ms, e.g. 94628us
  26. static const uint16_t power_off_time = 150; // ms, e.g. 139874us
  27. static const uint16_t full_refresh_time = 27000; // ms, e.g. 26130024us
  28. static const uint16_t partial_refresh_time = 27000; // ms, e.g. 26130024us
  29. // constructor
  30. GxEPD2_290_C90c(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
  31. // methods (virtual)
  32. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  33. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  34. void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
  35. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  36. void writeScreenBuffer(uint8_t black_value, uint8_t color_value); // init controller memory
  37. // write to controller memory, without screen refresh; x and w should be multiple of 8
  38. 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);
  39. void writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  40. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  41. 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);
  42. 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,
  43. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  44. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  45. 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);
  46. // write to controller memory, with screen refresh; x and w should be multiple of 8
  47. 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);
  48. void drawImagePart(const uint8_t bitmap[], 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. 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);
  51. 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,
  52. int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
  53. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  54. 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);
  55. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  56. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  57. void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
  58. void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
  59. private:
  60. void _writeScreenBuffer(uint8_t value);
  61. void _setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  62. void _PowerOn();
  63. void _PowerOff();
  64. void _InitDisplay();
  65. void _Init_Full();
  66. void _Init_Part();
  67. void _Update_Full();
  68. void _Update_Part();
  69. };
  70. #endif