GxEPD2_270c.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.good-display.com/download_list/downloadcategoryid=34&isMode=false.html
  5. //
  6. // Author: Jean-Marc Zingg
  7. //
  8. // Version: see library.properties
  9. //
  10. // Library: https://github.com/ZinggJM/GxEPD2
  11. #ifndef _GxEPD2_270c_H_
  12. #define _GxEPD2_270c_H_
  13. #include "../GxEPD2_EPD.h"
  14. class GxEPD2_270c : public GxEPD2_EPD
  15. {
  16. public:
  17. // attributes
  18. static const uint16_t WIDTH = 176;
  19. static const uint16_t HEIGHT = 264;
  20. static const GxEPD2::Panel panel = GxEPD2::GDEW027C44;
  21. static const bool hasColor = true;
  22. static const bool hasPartialUpdate = true;
  23. static const bool hasFastPartialUpdate = false;
  24. // constructor
  25. GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy);
  26. // methods (virtual)
  27. void init(uint32_t serial_diag_bitrate = 0); // = 0 : disabled
  28. // Support for Bitmaps (Sprites) to Controller Buffer and to Screen
  29. void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
  30. void clearScreen(uint8_t black_value, uint8_t color_value); // init controller memory and screen
  31. void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
  32. void writeScreenBuffer(uint8_t black_value, uint8_t color_value); // init controller memory
  33. // write to controller memory, without screen refresh; x and w should be multiple of 8
  34. 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);
  35. 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);
  36. // write sprite of native data to controller memory, without screen refresh; x and w should be multiple of 8
  37. 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);
  38. // write to controller memory, with screen refresh; x and w should be multiple of 8
  39. 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);
  40. 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);
  41. // write sprite of native data to controller memory, with screen refresh; x and w should be multiple of 8
  42. 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);
  43. void refresh(bool partial_update_mode = false); // screen refresh from controller memory to full screen
  44. void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen
  45. void powerOff();
  46. private:
  47. void _writeData_nCS(const uint8_t* data, uint16_t n);
  48. void _writeScreenBuffer(uint8_t value);
  49. void _setPartialRamArea_270c(uint8_t cmd, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  50. void _PowerOn();
  51. void _PowerOff();
  52. void _InitDisplay();
  53. void _Init_Full();
  54. void _Init_Part();
  55. void _Update_Full();
  56. void _Update_Part();
  57. protected:
  58. bool _initial, _power_is_on;
  59. };
  60. #endif