EPD_3in52.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*****************************************************************************
  2. * | File : EPD_3IN52.C
  3. * | Author : Waveshare team
  4. * | Function : 3.52inch e-paper
  5. * | Info :
  6. *----------------
  7. * | This version: V1.0
  8. * | Date : 2022-05-07
  9. * | Info :
  10. * -----------------------------------------------------------------------------
  11. #
  12. # Permission is hereby granted, free of charge, to any person obtaining a copy
  13. # of this software and associated documnetation files (the "Software"), to deal
  14. # in the Software without restriction, including without limitation the rights
  15. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16. # copies of the Software, and to permit persons to whom the Software is
  17. # furished to do so, subject to the following conditions:
  18. #
  19. # The above copyright notice and this permission notice shall be included in
  20. # all copies or substantial portions of the Software.
  21. #
  22. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  25. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  28. # THE SOFTWARE.
  29. #
  30. ******************************************************************************/
  31. #include <stdlib.h>
  32. #include "EPD_3in52.h"
  33. #include "imagedata.h"
  34. //GC 0.9S
  35. static const UBYTE EPD_3IN52_lut_R20_GC[] =
  36. {
  37. 0x01,0x0f,0x0f,0x0f,0x01,0x01,0x01,
  38. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  39. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  40. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  41. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  42. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  43. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  44. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  45. };
  46. static const UBYTE EPD_3IN52_lut_R21_GC[] =
  47. {
  48. 0x01,0x4f,0x8f,0x0f,0x01,0x01,0x01,
  49. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  50. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  51. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  52. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  53. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  54. };
  55. static const UBYTE EPD_3IN52_lut_R22_GC[] =
  56. {
  57. 0x01,0x0f,0x8f,0x0f,0x01,0x01,0x01,
  58. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  59. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  60. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  61. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  62. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  63. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  64. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  65. };
  66. static const UBYTE EPD_3IN52_lut_R23_GC[] =
  67. {
  68. 0x01,0x4f,0x8f,0x4f,0x01,0x01,0x01,
  69. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  70. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  71. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  72. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  73. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  74. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  75. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  76. };
  77. static const UBYTE EPD_3IN52_lut_R24_GC[] =
  78. {
  79. 0x01,0x0f,0x8f,0x4f,0x01,0x01,0x01,
  80. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  81. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  82. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  83. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  84. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  85. };
  86. // DU 0.3s
  87. static const UBYTE EPD_3IN52_lut_R20_DU[] =
  88. {
  89. 0x01,0x0f,0x01,0x00,0x00,0x01,0x01,
  90. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  91. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  92. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  93. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  94. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  95. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  96. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  97. };
  98. static const UBYTE EPD_3IN52_lut_R21_DU[] =
  99. {
  100. 0x01,0x0f,0x01,0x00,0x00,0x01,0x01,
  101. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  102. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  103. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  104. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  105. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  106. };
  107. static const UBYTE EPD_3IN52_lut_R22_DU[] =
  108. {
  109. 0x01,0x8f,0x01,0x00,0x00,0x01,0x01,
  110. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  111. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  112. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  113. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  114. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  115. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  116. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  117. };
  118. static const UBYTE EPD_3IN52_lut_R23_DU[] =
  119. {
  120. 0x01,0x4f,0x01,0x00,0x00,0x01,0x01,
  121. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  122. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  123. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  124. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  125. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  126. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  127. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  128. };
  129. static const UBYTE EPD_3IN52_lut_R24_DU[] =
  130. {
  131. 0x01,0x0f,0x01,0x00,0x00,0x01,0x01,
  132. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  133. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  134. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  135. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  136. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  137. };
  138. //
  139. static const UBYTE EPD_3IN52_lut_vcom[] =
  140. {
  141. 0x01,0x19,0x19,0x19,0x19,0x01,0x01,
  142. 0x01,0x19,0x19,0x19,0x01,0x01,0x01,
  143. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  144. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  145. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  146. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  147. };
  148. static const UBYTE EPD_3IN52_lut_ww[] =
  149. {
  150. 0x01,0x59,0x99,0x59,0x99,0x01,0x01,
  151. 0x01,0x59,0x99,0x19,0x01,0x01,0x01,
  152. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  153. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  154. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  155. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  156. };
  157. static const UBYTE EPD_3IN52_lut_bw[] =
  158. {
  159. 0x01,0x59,0x99,0x59,0x99,0x01,0x01,
  160. 0x01,0x59,0x99,0x19,0x01,0x01,0x01,
  161. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  162. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  163. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  164. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  165. };
  166. static const UBYTE EPD_3IN52_lut_wb[] =
  167. {
  168. 0x01,0x19,0x99,0x59,0x99,0x01,0x01,
  169. 0x01,0x59,0x99,0x59,0x01,0x01,0x01,
  170. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  171. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  172. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  173. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  174. };
  175. static const UBYTE EPD_3IN52_lut_bb[] =
  176. {
  177. 0x01,0x19,0x99,0x59,0x99,0x01,0x01,
  178. 0x01,0x59,0x99,0x59,0x01,0x01,0x01,
  179. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  180. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  181. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  182. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  183. };
  184. Epd::~Epd() {
  185. };
  186. Epd::Epd() {
  187. reset_pin = RST_PIN;
  188. dc_pin = DC_PIN;
  189. cs_pin = CS_PIN;
  190. busy_pin = BUSY_PIN;
  191. width = EPD_WIDTH;
  192. height = EPD_HEIGHT;
  193. EPD_3IN52_Flag = 0;
  194. };
  195. int Epd::Init(void) {
  196. if (IfInit() != 0) {
  197. return -1;
  198. }
  199. Reset();
  200. EPD_3IN52_Flag = 0;
  201. SendCommand(0x00); // panel setting PSR
  202. SendData(0xFF); // RES1 RES0 REG KW/R UD SHL SHD_N RST_N
  203. SendData(0x01); // x x x VCMZ TS_AUTO TIGE NORG VC_LUTZ
  204. SendCommand(0x01); // POWER SETTING PWR
  205. SendData(0x03); // x x x x x x VDS_EN VDG_EN
  206. SendData(0x10); // x x x VCOM_SLWE VGH[3:0] VGH=20V, VGL=-20V
  207. SendData(0x3F); // x x VSH[5:0] VSH = 15V
  208. SendData(0x3F); // x x VSL[5:0] VSL=-15V
  209. SendData(0x03); // OPTEN VDHR[6:0] VHDR=6.4V
  210. // T_VDS_OFF[1:0] 00=1 frame; 01=2 frame; 10=3 frame; 11=4 frame
  211. SendCommand(0x06); // booster soft start BTST
  212. SendData(0x37); // BT_PHA[7:0]
  213. SendData(0x3D); // BT_PHB[7:0]
  214. SendData(0x3D); // x x BT_PHC[5:0]
  215. SendCommand(0x60); // TCON setting TCON
  216. SendData(0x22); // S2G[3:0] G2S[3:0] non-overlap = 12
  217. SendCommand(0x82); // VCOM_DC setting VDCS
  218. SendData(0x07); // x VDCS[6:0] VCOM_DC value= -1.9v 00~3f,0x12=-1.9v
  219. SendCommand(0x30);
  220. SendData(0x09);
  221. SendCommand(0xe3); // power saving PWS
  222. SendData(0x88); // VCOM_W[3:0] SD_W[3:0]
  223. SendCommand(0x61); // resoultion setting
  224. SendData(0xf0); // HRES[7:3] 0 0 0
  225. SendData(0x01); // x x x x x x x VRES[8]
  226. SendData(0x68); // VRES[7:0]
  227. SendCommand(0x50);
  228. SendData(0xB7);
  229. return 0;
  230. }
  231. /**
  232. * @brief: basic function for sending commands
  233. */
  234. void Epd::SendCommand(unsigned char command) {
  235. DigitalWrite(dc_pin, LOW);
  236. SpiTransfer(command);
  237. }
  238. /**
  239. * @brief: basic function for sending data
  240. */
  241. void Epd::SendData(unsigned char data) {
  242. DigitalWrite(dc_pin, HIGH);
  243. SpiTransfer(data);
  244. }
  245. /**
  246. * @brief: Wait until the busy_pin goes HIGH
  247. */
  248. void Epd::ReadBusy(void) {
  249. Serial.print("e-Paper busy \r\n ");
  250. UBYTE busy;
  251. do {
  252. busy = DigitalRead(busy_pin);
  253. } while(busy);
  254. DelayMs(200);
  255. Serial.print("e-Paper busy release \r\n ");
  256. }
  257. /**
  258. * @brief: module reset.
  259. * often used to awaken the module in deep sleep,
  260. * see Epd::Sleep();
  261. */
  262. void Epd::Reset(void) {
  263. DigitalWrite(reset_pin, HIGH);
  264. DelayMs(200);
  265. DigitalWrite(reset_pin, LOW); //module reset
  266. DelayMs(1);
  267. DigitalWrite(reset_pin, HIGH);
  268. DelayMs(200);
  269. }
  270. void Epd::lut(void)
  271. {
  272. UBYTE count;
  273. SendCommand(0x20); // vcom
  274. for(count = 0; count < 42 ; count++)
  275. {
  276. SendData(EPD_3IN52_lut_vcom[count]);
  277. }
  278. SendCommand(0x21); // ww --
  279. for(count = 0; count < 42 ; count++)
  280. {
  281. SendData(EPD_3IN52_lut_ww[count]);
  282. }
  283. SendCommand(0x22); // bw r
  284. for(count = 0; count < 42 ; count++)
  285. {
  286. SendData(EPD_3IN52_lut_bw[count]);
  287. }
  288. SendCommand(0x23); // wb w
  289. for(count = 0; count < 42 ; count++)
  290. {
  291. SendData(EPD_3IN52_lut_bb[count]);
  292. }
  293. SendCommand(0x24); // bb b
  294. for(count = 0; count < 42 ; count++)
  295. {
  296. SendData(EPD_3IN52_lut_wb[count]);
  297. }
  298. }
  299. void Epd::refresh(void)
  300. {
  301. SendCommand(0x17);
  302. SendData(0xA5);
  303. ReadBusy();
  304. DelayMs(200);
  305. }
  306. // LUT download
  307. void Epd::lut_GC(void)
  308. {
  309. UBYTE count;
  310. SendCommand(0x20); // vcom
  311. for(count = 0; count < 56 ; count++)
  312. {
  313. SendData(EPD_3IN52_lut_R20_GC[count]);
  314. }
  315. SendCommand(0x21); // red not use
  316. for(count = 0; count < 42 ; count++)
  317. {
  318. SendData(EPD_3IN52_lut_R21_GC[count]);
  319. }
  320. SendCommand(0x24); // bb b
  321. for(count = 0; count < 42 ; count++)
  322. {
  323. SendData(EPD_3IN52_lut_R24_GC[count]);
  324. }
  325. if(EPD_3IN52_Flag == 0)
  326. {
  327. SendCommand(0x22); // bw r
  328. for(count = 0; count < 56 ; count++)
  329. {
  330. SendData(EPD_3IN52_lut_R22_GC[count]);
  331. }
  332. SendCommand(0x23); // wb w
  333. for(count = 0; count < 42 ; count++)
  334. {
  335. SendData(EPD_3IN52_lut_R23_GC[count]);
  336. }
  337. EPD_3IN52_Flag = 1;
  338. }
  339. else
  340. {
  341. SendCommand(0x22); // bw r
  342. for(count = 0; count < 56 ; count++)
  343. {
  344. SendData(EPD_3IN52_lut_R23_GC[count]);
  345. }
  346. SendCommand(0x23); // wb w
  347. for(count = 0; count < 42 ; count++)
  348. {
  349. SendData(EPD_3IN52_lut_R22_GC[count]);
  350. }
  351. EPD_3IN52_Flag = 0;
  352. }
  353. }
  354. // LUT download
  355. void Epd::lut_DU(void)
  356. {
  357. UBYTE count;
  358. SendCommand(0x20); // vcom
  359. for(count = 0; count < 56 ; count++)
  360. {
  361. SendData(EPD_3IN52_lut_R20_DU[count]);
  362. }
  363. SendCommand(0x21); // red not use
  364. for(count = 0; count < 42 ; count++)
  365. {
  366. SendData(EPD_3IN52_lut_R21_DU[count]);
  367. }
  368. SendCommand(0x24); // bb b
  369. for(count = 0; count < 42 ; count++)
  370. {
  371. SendData(EPD_3IN52_lut_R24_DU[count]);
  372. }
  373. if(EPD_3IN52_Flag == 0)
  374. {
  375. SendCommand(0x22); // bw r
  376. for(count = 0; count < 56 ; count++)
  377. {
  378. SendData(EPD_3IN52_lut_R22_DU[count]);
  379. }
  380. SendCommand(0x23); // wb w
  381. for(count = 0; count < 42 ; count++)
  382. {
  383. SendData(EPD_3IN52_lut_R23_DU[count]);
  384. }
  385. EPD_3IN52_Flag = 1;
  386. }
  387. else
  388. {
  389. SendCommand(0x22); // bw r
  390. for(count = 0; count < 56 ; count++)
  391. {
  392. SendData(EPD_3IN52_lut_R23_DU[count]);
  393. }
  394. SendCommand(0x23); // wb w
  395. for(count = 0; count < 42 ; count++)
  396. {
  397. SendData(EPD_3IN52_lut_R22_DU[count]);
  398. }
  399. EPD_3IN52_Flag = 0;
  400. }
  401. }
  402. void Epd::display(UBYTE* picData)
  403. {
  404. UWORD i;
  405. SendCommand(0x13); //Transfer new data
  406. for(i=0;i<(width*height/8);i++)
  407. {
  408. SendData(pgm_read_byte(&picData[i]));
  409. }
  410. }
  411. void Epd::display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh)
  412. {
  413. UWORD i,j;
  414. SendCommand(0x13); //Transfer new data
  415. for(i=0; i<height; i++)
  416. for(j=0; j<(width/8); j++)
  417. {
  418. if((j >= xstart/8) && (j < (image_width + xstart)/8) && (i >= ystart) && (i <= (ystart + image_heigh)) )
  419. {
  420. SendData(Image[(i-ystart) * image_width/8 + j - xstart/8]);
  421. // Serial.print(Image[(i-ystart) * image_width/8 + j - xstart], HEX);
  422. // Serial.print(" ");
  423. }
  424. else
  425. {
  426. SendData(0x00);
  427. }
  428. }
  429. }
  430. void Epd::display_NUM(UBYTE NUM)
  431. {
  432. UWORD row, column;
  433. // UWORD pcnt = 0;
  434. SendCommand(0x13); //Transfer new data
  435. for(column=0; column<height; column++)
  436. {
  437. for(row=0; row<width/8; row++)
  438. {
  439. switch (NUM)
  440. {
  441. case EPD_3IN52_WHITE:
  442. SendData(0xFF);
  443. break;
  444. case EPD_3IN52_BLACK:
  445. SendData(0x00);
  446. break;
  447. case EPD_3IN52_Source_Line:
  448. SendData(0xAA);
  449. break;
  450. case EPD_3IN52_Gate_Line:
  451. if(column%2)
  452. SendData(0xff); //An odd number of Gate line
  453. else
  454. SendData(0x00); //The even line Gate
  455. break;
  456. case EPD_3IN52_Chessboard:
  457. if(row>=(width/8/2)&&column>=(height/2))
  458. SendData(0xff);
  459. else if(row<(width/8/2)&&column<(height/2))
  460. SendData(0xff);
  461. else
  462. SendData(0x00);
  463. break;
  464. case EPD_3IN52_LEFT_BLACK_RIGHT_WHITE:
  465. if(row>=(width/8/2))
  466. SendData(0xff);
  467. else
  468. SendData(0x00);
  469. break;
  470. case EPD_3IN52_UP_BLACK_DOWN_WHITE:
  471. if(column>=(height/2))
  472. SendData(0xFF);
  473. else
  474. SendData(0x00);
  475. break;
  476. case EPD_3IN52_Frame:
  477. if(column==0||column==(height-1))
  478. SendData(0x00);
  479. else if(row==0)
  480. SendData(0x7F);
  481. else if(row==(width/8-1))
  482. SendData(0xFE);
  483. else
  484. SendData(0xFF);
  485. break;
  486. case EPD_3IN52_Crosstalk:
  487. if((row>=(width/8/3)&&row<=(width/8/3*2)&&column<=(height/3))||(row>=(width/8/3)&&row<=(width/8/3*2)&&column>=(height/3*2)))
  488. SendData(0x00);
  489. else
  490. SendData(0xFF);
  491. break;
  492. case EPD_3IN52_Image:
  493. //SendData(gImage_1[pcnt++]);
  494. break;
  495. default:
  496. break;
  497. }
  498. }
  499. }
  500. }
  501. /******************************************************************************
  502. function : Clear screen
  503. parameter:
  504. ******************************************************************************/
  505. void Epd::Clear(void)
  506. {
  507. UWORD i;
  508. SendCommand(0x13); //Transfer new data
  509. for(i=0;i<(width*height/8);i++)
  510. {
  511. SendData(0xFF);
  512. }
  513. lut_GC();
  514. refresh();
  515. }
  516. /******************************************************************************
  517. function : Enter sleep mode
  518. parameter:
  519. ******************************************************************************/
  520. void Epd::sleep(void)
  521. {
  522. SendCommand(0X07); //deep sleep
  523. SendData(0xA5);
  524. }