GxEPD2_420.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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: IL0398 : http://www.e-paper-display.com/download_detail/downloadsId=537.html
  6. //
  7. // Author: Jean-Marc Zingg
  8. //
  9. // Version: see library.properties
  10. //
  11. // Library: https://github.com/ZinggJM/GxEPD2
  12. #include "GxEPD2_420.h"
  13. GxEPD2_420::GxEPD2_420(int16_t cs, int16_t dc, int16_t rst, int16_t busy) :
  14. GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
  15. {
  16. }
  17. void GxEPD2_420::clearScreen(uint8_t value)
  18. {
  19. writeScreenBuffer(value);
  20. refresh(true);
  21. writeScreenBuffer(value);
  22. }
  23. void GxEPD2_420::writeScreenBuffer(uint8_t value)
  24. {
  25. _initial_write = false; // initial full screen buffer clean done
  26. if (!_using_partial_mode) _Init_Part();
  27. if (_initial_refresh)
  28. {
  29. _writeCommand(0x10); // init old data
  30. _startTransfer();
  31. for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
  32. {
  33. _transfer(value);
  34. }
  35. _endTransfer();
  36. }
  37. _writeCommand(0x13);
  38. _startTransfer();
  39. for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++)
  40. {
  41. _transfer(value);
  42. }
  43. _endTransfer();
  44. }
  45. void GxEPD2_420::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  46. {
  47. if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
  48. delay(1); // yield() to avoid WDT on ESP8266 and ESP32
  49. int16_t wb = (w + 7) / 8; // width bytes, bitmaps are padded
  50. x -= x % 8; // byte boundary
  51. w = wb * 8; // byte boundary
  52. int16_t x1 = x < 0 ? 0 : x; // limit
  53. int16_t y1 = y < 0 ? 0 : y; // limit
  54. int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
  55. int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
  56. int16_t dx = x1 - x;
  57. int16_t dy = y1 - y;
  58. w1 -= dx;
  59. h1 -= dy;
  60. if ((w1 <= 0) || (h1 <= 0)) return;
  61. if (!_using_partial_mode) _Init_Part();
  62. //uint32_t start = micros();
  63. _writeCommand(0x91); // partial in
  64. _setPartialRamArea(x1, y1, w1, h1);
  65. _writeCommand(0x13);
  66. _startTransfer();
  67. for (int16_t i = 0; i < h1; i++)
  68. {
  69. for (int16_t j = 0; j < w1 / 8; j++)
  70. {
  71. uint8_t data;
  72. // use wb, h of bitmap for index!
  73. int16_t idx = mirror_y ? j + dx / 8 + ((h - 1 - (i + dy))) * wb : j + dx / 8 + (i + dy) * wb;
  74. if (pgm)
  75. {
  76. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  77. data = pgm_read_byte(&bitmap[idx]);
  78. #else
  79. data = bitmap[idx];
  80. #endif
  81. }
  82. else
  83. {
  84. data = bitmap[idx];
  85. }
  86. if (invert) data = ~data;
  87. _transfer(data);
  88. }
  89. }
  90. _endTransfer();
  91. _writeCommand(0x92); // partial out
  92. //Serial.print("GxEPD2_420::writeImage took "); Serial.println(micros() - start);
  93. delay(1); // yield() to avoid WDT on ESP8266 and ESP32
  94. }
  95. void GxEPD2_420::writeImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  96. int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  97. {
  98. if (_initial_write) writeScreenBuffer(); // initial full screen buffer clean
  99. delay(1); // yield() to avoid WDT on ESP8266 and ESP32
  100. if ((w_bitmap < 0) || (h_bitmap < 0) || (w < 0) || (h < 0)) return;
  101. if ((x_part < 0) || (x_part >= w_bitmap)) return;
  102. if ((y_part < 0) || (y_part >= h_bitmap)) return;
  103. int16_t wb_bitmap = (w_bitmap + 7) / 8; // width bytes, bitmaps are padded
  104. x_part -= x_part % 8; // byte boundary
  105. w = w_bitmap - x_part < w ? w_bitmap - x_part : w; // limit
  106. h = h_bitmap - y_part < h ? h_bitmap - y_part : h; // limit
  107. x -= x % 8; // byte boundary
  108. w = 8 * ((w + 7) / 8); // byte boundary, bitmaps are padded
  109. int16_t x1 = x < 0 ? 0 : x; // limit
  110. int16_t y1 = y < 0 ? 0 : y; // limit
  111. int16_t w1 = x + w < int16_t(WIDTH) ? w : int16_t(WIDTH) - x; // limit
  112. int16_t h1 = y + h < int16_t(HEIGHT) ? h : int16_t(HEIGHT) - y; // limit
  113. int16_t dx = x1 - x;
  114. int16_t dy = y1 - y;
  115. w1 -= dx;
  116. h1 -= dy;
  117. if ((w1 <= 0) || (h1 <= 0)) return;
  118. if (!_using_partial_mode) _Init_Part();
  119. _writeCommand(0x91); // partial in
  120. _setPartialRamArea(x1, y1, w1, h1);
  121. _writeCommand(0x13);
  122. _startTransfer();
  123. for (int16_t i = 0; i < h1; i++)
  124. {
  125. for (int16_t j = 0; j < w1 / 8; j++)
  126. {
  127. uint8_t data;
  128. // use wb_bitmap, h_bitmap of bitmap for index!
  129. int16_t idx = mirror_y ? x_part / 8 + j + dx / 8 + ((h_bitmap - 1 - (y_part + i + dy))) * wb_bitmap : x_part / 8 + j + dx / 8 + (y_part + i + dy) * wb_bitmap;
  130. if (pgm)
  131. {
  132. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  133. data = pgm_read_byte(&bitmap[idx]);
  134. #else
  135. data = bitmap[idx];
  136. #endif
  137. }
  138. else
  139. {
  140. data = bitmap[idx];
  141. }
  142. if (invert) data = ~data;
  143. _transfer(data);
  144. }
  145. }
  146. _endTransfer();
  147. _writeCommand(0x92); // partial out
  148. delay(1); // yield() to avoid WDT on ESP8266 and ESP32
  149. }
  150. void GxEPD2_420::writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  151. {
  152. if (black)
  153. {
  154. writeImage(black, x, y, w, h, invert, mirror_y, pgm);
  155. }
  156. }
  157. void GxEPD2_420::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,
  158. int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  159. {
  160. if (black)
  161. {
  162. writeImagePart(black, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
  163. }
  164. }
  165. void GxEPD2_420::writeNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  166. {
  167. if (data1)
  168. {
  169. writeImage(data1, x, y, w, h, invert, mirror_y, pgm);
  170. }
  171. }
  172. void GxEPD2_420::drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  173. {
  174. writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
  175. refresh(x, y, w, h);
  176. writeImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
  177. }
  178. void GxEPD2_420::drawImagePart(const uint8_t bitmap[], int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap,
  179. int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  180. {
  181. writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
  182. refresh(x, y, w, h);
  183. writeImagePart(bitmap, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
  184. }
  185. void GxEPD2_420::drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  186. {
  187. writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
  188. refresh(x, y, w, h);
  189. writeImage(black, color, x, y, w, h, invert, mirror_y, pgm);
  190. }
  191. void GxEPD2_420::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,
  192. int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  193. {
  194. writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
  195. refresh(x, y, w, h);
  196. writeImagePart(black, color, x_part, y_part, w_bitmap, h_bitmap, x, y, w, h, invert, mirror_y, pgm);
  197. }
  198. void GxEPD2_420::drawNative(const uint8_t* data1, const uint8_t* data2, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
  199. {
  200. writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
  201. refresh(x, y, w, h);
  202. writeNative(data1, data2, x, y, w, h, invert, mirror_y, pgm);
  203. }
  204. void GxEPD2_420::refresh(bool partial_update_mode)
  205. {
  206. if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
  207. else
  208. {
  209. if (_using_partial_mode) _Init_Full();
  210. _Update_Full();
  211. _initial_refresh = false; // initial full update done
  212. }
  213. }
  214. void GxEPD2_420::refresh(int16_t x, int16_t y, int16_t w, int16_t h)
  215. {
  216. if (_initial_refresh) return refresh(false); // initial update needs be full update
  217. // intersection with screen
  218. int16_t w1 = x < 0 ? w + x : w; // reduce
  219. int16_t h1 = y < 0 ? h + y : h; // reduce
  220. int16_t x1 = x < 0 ? 0 : x; // limit
  221. int16_t y1 = y < 0 ? 0 : y; // limit
  222. w1 = x1 + w1 < int16_t(WIDTH) ? w1 : int16_t(WIDTH) - x1; // limit
  223. h1 = y1 + h1 < int16_t(HEIGHT) ? h1 : int16_t(HEIGHT) - y1; // limit
  224. if ((w1 <= 0) || (h1 <= 0)) return;
  225. // make x1, w1 multiple of 8
  226. w1 += x1 % 8;
  227. if (w1 % 8 > 0) w1 += 8 - w1 % 8;
  228. x1 -= x1 % 8;
  229. if (!_using_partial_mode) _Init_Part();
  230. if (usePartialUpdateWindow) _writeCommand(0x91); // partial in
  231. _setPartialRamArea(x1, y1, w1, h1);
  232. _Update_Part();
  233. if (usePartialUpdateWindow) _writeCommand(0x92); // partial out
  234. }
  235. void GxEPD2_420::powerOff(void)
  236. {
  237. _PowerOff();
  238. }
  239. void GxEPD2_420::hibernate()
  240. {
  241. _PowerOff();
  242. if (_rst >= 0)
  243. {
  244. _writeCommand(0x07); // deep sleep
  245. _writeData(0xA5); // check code
  246. _hibernating = true;
  247. }
  248. }
  249. void GxEPD2_420::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
  250. {
  251. uint16_t xe = (x + w - 1) | 0x0007; // byte boundary inclusive (last byte)
  252. uint16_t ye = y + h - 1;
  253. x &= 0xFFF8; // byte boundary
  254. _writeCommand(0x90); // partial window
  255. _writeData(x / 256);
  256. _writeData(x % 256);
  257. _writeData(xe / 256);
  258. _writeData(xe % 256);
  259. _writeData(y / 256);
  260. _writeData(y % 256);
  261. _writeData(ye / 256);
  262. _writeData(ye % 256);
  263. _writeData(0x01); // don't see any difference
  264. //_writeData(0x00); // don't see any difference
  265. }
  266. void GxEPD2_420::_PowerOn()
  267. {
  268. if (!_power_is_on)
  269. {
  270. _writeCommand(0x04);
  271. _waitWhileBusy("_PowerOn", power_on_time);
  272. }
  273. _power_is_on = true;
  274. }
  275. void GxEPD2_420::_PowerOff()
  276. {
  277. _writeCommand(0x02); // power off
  278. _waitWhileBusy("_PowerOff", power_off_time);
  279. _power_is_on = false;
  280. _using_partial_mode = false;
  281. }
  282. void GxEPD2_420::_InitDisplay()
  283. {
  284. if (_hibernating) _reset();
  285. _writeCommand(0x01); // POWER SETTING
  286. _writeData (0x03); // VDS_EN, VDG_EN internal
  287. _writeData (0x00); // VCOM_HV, VGHL_LV=16V
  288. _writeData (0x2b); // VDH=11V
  289. _writeData (0x2b); // VDL=11V
  290. _writeCommand(0x06); // boost soft start
  291. _writeData (0x17); // A
  292. _writeData (0x17); // B
  293. _writeData (0x17); // C
  294. _writeCommand(0x00); // panel setting
  295. _writeData(0x3f); // 300x400 B/W mode, LUT set by register
  296. _writeCommand(0x30); // PLL setting
  297. _writeData (0x3a); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
  298. _writeCommand(0x61); // resolution setting
  299. _writeData (WIDTH / 256);
  300. _writeData (WIDTH % 256);
  301. _writeData (HEIGHT / 256);
  302. _writeData (HEIGHT % 256);
  303. _writeCommand(0x82); // vcom_DC setting
  304. //_writeData (0x08); // -0.1 + 8 * -0.05 = -0.5V from demo
  305. _writeData (0x12); // -0.1 + 18 * -0.05 = -1.0V from OTP, slightly better
  306. //_writeData (0x1c); // -0.1 + 28 * -0.05 = -1.5V test, worse
  307. _writeCommand(0x50); // VCOM AND DATA INTERVAL SETTING
  308. //_writeData(0x97); // WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
  309. _writeData(0xd7); // border floating to avoid flashing
  310. }
  311. const unsigned char GxEPD2_420::lut_20_vcom0_full[] PROGMEM =
  312. {
  313. 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
  314. 0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
  315. 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
  316. 0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
  317. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  318. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  319. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  320. 0x00, 0x00
  321. };
  322. const unsigned char GxEPD2_420::lut_21_ww_full[] PROGMEM =
  323. {
  324. 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
  325. 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
  326. 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
  327. 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
  328. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  329. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  330. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  331. };
  332. const unsigned char GxEPD2_420::lut_22_bw_full[] PROGMEM =
  333. {
  334. 0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
  335. 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
  336. 0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
  337. 0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
  338. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  339. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  340. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  341. };
  342. const unsigned char GxEPD2_420::lut_23_wb_full[] PROGMEM =
  343. {
  344. 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
  345. 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
  346. 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
  347. 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
  348. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  349. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  350. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  351. };
  352. const unsigned char GxEPD2_420::lut_24_bb_full[] PROGMEM =
  353. {
  354. 0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
  355. 0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
  356. 0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
  357. 0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
  358. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  359. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  360. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  361. };
  362. // partial update waveform
  363. // same waveform as by demo code from Good Display
  364. //#define T1 0 // color change charge balance pre-phase
  365. //#define T2 0 // color change or sustain charge balance pre-phase
  366. //#define T3 0 // color change or sustain phase
  367. //#define T4 25 // color change phase
  368. // new waveform created by Jean-Marc Zingg for the actual panel
  369. #define T1 25 // color change charge balance pre-phase
  370. #define T2 1 // color change or sustain charge balance pre-phase
  371. #define T3 4 // color change or sustain phase, was 2 before
  372. #define T4 25 // color change phase
  373. // for new waveform without sustain phase: uncomment next 2 lines, not good for fat fonts
  374. //#define T2 0 // color change or sustain charge balance pre-phase // 0 no sustain
  375. //#define T3 0 // color change or sustain phase // 0 no sustain
  376. // "balanced flash once" variant
  377. //#define T1 0 // color change charge balance pre-phase
  378. //#define T2 25 // color change or sustain charge balance pre-phase
  379. //#define T3 25 // color change or sustain phase
  380. //#define T4 0 // color change phase
  381. const unsigned char GxEPD2_420::lut_20_vcom0_partial[] PROGMEM =
  382. {
  383. 0x00, T1, T2, T3, T4, 1, // 00 00 00 00
  384. 0x00, 1, 0, 0, 0, 1, // gnd phase
  385. };
  386. const unsigned char GxEPD2_420::lut_21_ww_partial[] PROGMEM =
  387. { // 10 w
  388. 0x18, T1, T2, T3, T4, 1, // 00 01 10 00
  389. 0x00, 1, 0, 0, 0, 1, // gnd phase
  390. };
  391. const unsigned char GxEPD2_420::lut_22_bw_partial[] PROGMEM =
  392. { // 10 w
  393. 0x5A, T1, T2, T3, T4, 1, // 01 01 10 10
  394. 0x00, 1, 0, 0, 0, 1, // gnd phase
  395. };
  396. const unsigned char GxEPD2_420::lut_23_wb_partial[] PROGMEM =
  397. { // 01 b
  398. 0xA5, T1, T2, T3, T4, 1, // 10 10 01 01
  399. 0x00, 1, 0, 0, 0, 1, // gnd phase
  400. };
  401. const unsigned char GxEPD2_420::lut_24_bb_partial[] PROGMEM =
  402. { // 01 b
  403. 0x24, T1, T2, T3, T4, 1, // 00 10 01 00
  404. 0x00, 1, 0, 0, 0, 1, // gnd phase
  405. };
  406. void GxEPD2_420::_Init_Full()
  407. {
  408. _InitDisplay();
  409. _writeCommand(0x20);
  410. _writeDataPGM(lut_20_vcom0_full, sizeof(lut_20_vcom0_full));
  411. _writeCommand(0x21);
  412. _writeDataPGM(lut_21_ww_full, sizeof(lut_21_ww_full));
  413. _writeCommand(0x22);
  414. _writeDataPGM(lut_22_bw_full, sizeof(lut_22_bw_full));
  415. _writeCommand(0x23);
  416. _writeDataPGM(lut_23_wb_full, sizeof(lut_23_wb_full));
  417. _writeCommand(0x24);
  418. _writeDataPGM(lut_24_bb_full, sizeof(lut_24_bb_full));
  419. _PowerOn();
  420. _using_partial_mode = false;
  421. }
  422. void GxEPD2_420::_Init_Part()
  423. {
  424. _InitDisplay();
  425. _writeCommand(0x20);
  426. _writeDataPGM(lut_20_vcom0_partial, sizeof(lut_20_vcom0_partial), 44 - sizeof(lut_20_vcom0_partial));
  427. _writeCommand(0x21);
  428. _writeDataPGM(lut_21_ww_partial, sizeof(lut_21_ww_partial), 42 - sizeof(lut_21_ww_partial));
  429. _writeCommand(0x22);
  430. _writeDataPGM(lut_22_bw_partial, sizeof(lut_22_bw_partial), 42 - sizeof(lut_22_bw_partial));
  431. _writeCommand(0x23);
  432. _writeDataPGM(lut_23_wb_partial, sizeof(lut_23_wb_partial), 42 - sizeof(lut_23_wb_partial));
  433. _writeCommand(0x24);
  434. _writeDataPGM(lut_24_bb_partial, sizeof(lut_24_bb_partial), 42 - sizeof(lut_24_bb_partial));
  435. _PowerOn();
  436. _using_partial_mode = true;
  437. }
  438. void GxEPD2_420::_Update_Full()
  439. {
  440. _writeCommand(0x12); //display refresh
  441. _waitWhileBusy("_Update_Full", full_refresh_time);
  442. }
  443. void GxEPD2_420::_Update_Part()
  444. {
  445. _writeCommand(0x12); //display refresh
  446. _waitWhileBusy("_Update_Part", partial_refresh_time);
  447. }