EPD_3in7_U.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. #include "EPD_3in7_U.h"
  2. #include "Debug.h"
  3. //GC 0.9S
  4. static const UBYTE EPD_3in7_U_lut_R20_GC[] =
  5. {
  6. 0x05,0x01,0x01,0x01,0x01,0x01,0x01,
  7. 0x01,0x12,0x1C,0x01,0x01,0x01,0x01,
  8. 0x01,0x20,0x20,0x20,0x01,0x01,0x01,
  9. 0x01,0x08,0x12,0x05,0x05,0x01,0x02,
  10. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  11. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  12. };
  13. static const UBYTE EPD_3in7_U_lut_R21_GC[] =
  14. {
  15. 0x05,0x41,0x81,0x01,0x01,0x01,0x01,
  16. 0x01,0x52,0x1C,0x01,0x01,0x01,0x01,
  17. 0x01,0x20,0xA0,0x60,0x01,0x01,0x01,
  18. 0x01,0x88,0x12,0x85,0x05,0x01,0x02,
  19. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  20. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  21. };
  22. static const UBYTE EPD_3in7_U_lut_R22_GC[] =
  23. {
  24. 0x05,0x41,0x81,0x01,0x01,0x01,0x01,
  25. 0x01,0x52,0x1C,0x01,0x01,0x01,0x01,
  26. 0x01,0x20,0xA0,0x60,0x01,0x01,0x01,
  27. 0x01,0x88,0x12,0x85,0x05,0x01,0x02,
  28. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  29. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  30. };
  31. static const UBYTE EPD_3in7_U_lut_R23_GC[] =
  32. {
  33. 0x05,0x41,0x81,0x01,0x01,0x01,0x01,
  34. 0x01,0x12,0x9C,0x01,0x01,0x01,0x01,
  35. 0x01,0x60,0xA0,0x20,0x01,0x01,0x01,
  36. 0x01,0x08,0x52,0x05,0x45,0x01,0x02,
  37. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  38. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  39. };
  40. static const UBYTE EPD_3in7_U_lut_R24_GC[] =
  41. {
  42. 0x05,0x41,0x81,0x01,0x01,0x01,0x01,
  43. 0x01,0x12,0x9C,0x01,0x01,0x01,0x01,
  44. 0x01,0x60,0xA0,0x20,0x01,0x01,0x01,
  45. 0x01,0x08,0x52,0x05,0x45,0x01,0x02,
  46. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  47. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  48. };
  49. // DU 0.3s
  50. static const UBYTE EPD_3in7_U_lut_R20_DU[] =
  51. {
  52. 0x01,0x16,0x16,0x01,0x01,0x01,0x01,
  53. 0x01,0x00,0x00,0x00,0x00,0x01,0x00,
  54. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  55. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  56. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  57. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  58. };
  59. static const UBYTE EPD_3in7_U_lut_R21_DU[] =
  60. {
  61. 0x01,0x96,0x16,0x81,0x01,0x01,0x01,
  62. 0x01,0x00,0x00,0x00,0x00,0x01,0x00,
  63. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  64. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  65. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  66. 0x00,0x00,0x00,0x00,0x00,0x00,0x00
  67. };
  68. static const UBYTE EPD_3in7_U_lut_R22_DU[] =
  69. {
  70. 0x01,0x96,0x16,0x81,0x01,0x01,0x01,
  71. 0x01,0x00,0x00,0x00,0x00,0x01,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_3in7_U_lut_R23_DU[] =
  78. {
  79. 0x01,0x96,0x56,0x01,0x01,0x01,0x01,
  80. 0x01,0x00,0x00,0x00,0x00,0x01,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. static const UBYTE EPD_3in7_U_lut_R24_DU[] =
  87. {
  88. 0x01,0x96,0x56,0x01,0x01,0x01,0x01,
  89. 0x01,0x00,0x00,0x00,0x00,0x01,0x00,
  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. };
  95. //
  96. static const UBYTE EPD_3in7_U_lut_vcom[] =
  97. {
  98. 0x05,0x14,0x14,0x01,0x01,0x01,0x01,
  99. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  100. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  101. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  102. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  103. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  104. };
  105. static const UBYTE EPD_3in7_U_lut_ww[] =
  106. {
  107. 0x05,0x54,0x94,0x01,0x01,0x01,0x01,
  108. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  109. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  110. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  111. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  112. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  113. };
  114. static const UBYTE EPD_3in7_U_lut_bw[] =
  115. {
  116. 0x05,0x54,0x94,0x01,0x01,0x01,0x01,
  117. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  118. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  119. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  120. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  121. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  122. };
  123. static const UBYTE EPD_3in7_U_lut_wb[] =
  124. {
  125. 0x05,0x54,0x94,0x01,0x01,0x01,0x01,
  126. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  127. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  128. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  129. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  130. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  131. };
  132. static const UBYTE EPD_3in7_U_lut_bb[] =
  133. {
  134. 0x05,0x54,0x94,0x01,0x01,0x01,0x01,
  135. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  136. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  137. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  138. 0x01,0x00,0x00,0x00,0x00,0x01,0x01,
  139. 0x01,0x00,0x00,0x00,0x00,0x01,0x01
  140. };
  141. unsigned char EPD_3in7_U_Flag = 0;
  142. /******************************************************************************
  143. function : Software reset
  144. parameter:
  145. ******************************************************************************/
  146. void EPD_3in7_U_Reset(void)
  147. {
  148. DEV_Digital_Write(EPD_RST_PIN, 1);
  149. DEV_Delay_ms(200);
  150. DEV_Digital_Write(EPD_RST_PIN, 0);
  151. DEV_Delay_ms(2);
  152. DEV_Digital_Write(EPD_RST_PIN, 1);
  153. DEV_Delay_ms(200);
  154. }
  155. /******************************************************************************
  156. function : send command
  157. parameter:
  158. Reg : Command register
  159. ******************************************************************************/
  160. void EPD_3in7_U_SendCommand(UBYTE Reg)
  161. {
  162. DEV_Digital_Write(EPD_DC_PIN, 0);
  163. DEV_Digital_Write(EPD_CS_PIN, 0);
  164. DEV_SPI_WriteByte(Reg);
  165. DEV_Digital_Write(EPD_CS_PIN, 1);
  166. }
  167. /******************************************************************************
  168. function : send data
  169. parameter:
  170. Data : Write data
  171. ******************************************************************************/
  172. void EPD_3in7_U_SendData(UBYTE Data)
  173. {
  174. DEV_Digital_Write(EPD_DC_PIN, 1);
  175. DEV_Digital_Write(EPD_CS_PIN, 0);
  176. DEV_SPI_WriteByte(Data);
  177. DEV_Digital_Write(EPD_CS_PIN, 1);
  178. }
  179. /******************************************************************************
  180. function : Read Busy
  181. parameter:
  182. ******************************************************************************/
  183. void EPD_3in7_U_ReadBusy(void)
  184. {
  185. EPD_Busy_WaitUntil(1,0);
  186. // Debug("e-Paper busy\r\n");
  187. // UBYTE busy;
  188. // do {
  189. // busy = DEV_Digital_Read(EPD_BUSY_PIN);
  190. // } while(!busy);
  191. // DEV_Delay_ms(200);
  192. // Debug("e-Paper busy release\r\n");
  193. }
  194. /**
  195. * @brief
  196. *
  197. */
  198. void EPD_3in7_U_lut(void)
  199. {
  200. UBYTE count;
  201. EPD_3in7_U_SendCommand(0x20); // vcom
  202. for(count = 0; count < 42 ; count++)
  203. {
  204. EPD_3in7_U_SendData(EPD_3in7_U_lut_vcom[count]);
  205. }
  206. EPD_3in7_U_SendCommand(0x21); // ww --
  207. for(count = 0; count < 42 ; count++)
  208. {
  209. EPD_3in7_U_SendData(EPD_3in7_U_lut_ww[count]);
  210. }
  211. EPD_3in7_U_SendCommand(0x22); // bw r
  212. for(count = 0; count < 42 ; count++)
  213. {
  214. EPD_3in7_U_SendData(EPD_3in7_U_lut_bw[count]);
  215. }
  216. EPD_3in7_U_SendCommand(0x23); // wb w
  217. for(count = 0; count < 42 ; count++)
  218. {
  219. EPD_3in7_U_SendData(EPD_3in7_U_lut_bb[count]);
  220. }
  221. EPD_3in7_U_SendCommand(0x24); // bb b
  222. for(count = 0; count < 42 ; count++)
  223. {
  224. EPD_3in7_U_SendData(EPD_3in7_U_lut_wb[count]);
  225. }
  226. }
  227. /**
  228. * @brief
  229. *
  230. */
  231. void EPD_3in7_U_refresh(void)
  232. {
  233. EPD_3in7_U_SendCommand(0x17);
  234. EPD_3in7_U_SendData(0xA5);
  235. EPD_3in7_U_ReadBusy();
  236. DEV_Delay_ms(200);
  237. }
  238. // LUT download
  239. void EPD_3in7_U_lut_GC(void)
  240. {
  241. UBYTE count;
  242. EPD_3in7_U_SendCommand(0x20); // vcom
  243. for(count = 0; count < sizeof(EPD_3in7_U_lut_R20_GC) ; count++)
  244. {
  245. EPD_3in7_U_SendData(EPD_3in7_U_lut_R20_GC[count]);
  246. }
  247. EPD_3in7_U_SendCommand(0x21); // red not use
  248. for(count = 0; count < 42 ; count++)
  249. {
  250. EPD_3in7_U_SendData(EPD_3in7_U_lut_R21_GC[count]);
  251. }
  252. EPD_3in7_U_SendCommand(0x24); // bb b
  253. for(count = 0; count < 42 ; count++)
  254. {
  255. EPD_3in7_U_SendData(EPD_3in7_U_lut_R24_GC[count]);
  256. }
  257. if(EPD_3in7_U_Flag == 0)
  258. {
  259. EPD_3in7_U_SendCommand(0x22); // bw r
  260. for(count = 0; count < sizeof(EPD_3in7_U_lut_R22_GC) ; count++)
  261. {
  262. EPD_3in7_U_SendData(EPD_3in7_U_lut_R22_GC[count]);
  263. }
  264. EPD_3in7_U_SendCommand(0x23); // wb w
  265. for(count = 0; count < 42 ; count++)
  266. {
  267. EPD_3in7_U_SendData(EPD_3in7_U_lut_R23_GC[count]);
  268. }
  269. EPD_3in7_U_Flag = 1;
  270. }
  271. else
  272. {
  273. EPD_3in7_U_SendCommand(0x22); // bw r
  274. for(count = 0; count < sizeof(EPD_3in7_U_lut_R23_GC) ; count++)
  275. {
  276. EPD_3in7_U_SendData(EPD_3in7_U_lut_R23_GC[count]);
  277. }
  278. EPD_3in7_U_SendCommand(0x23); // wb w
  279. for(count = 0; count < 42 ; count++)
  280. {
  281. EPD_3in7_U_SendData(EPD_3in7_U_lut_R22_GC[count]);
  282. }
  283. EPD_3in7_U_Flag = 0;
  284. }
  285. }
  286. // LUT download
  287. void EPD_3in7_U_lut_DU(void)
  288. {
  289. UBYTE count;
  290. EPD_3in7_U_SendCommand(0x20); // vcom
  291. for(count = 0; count < sizeof(EPD_3in7_U_lut_R20_DU) ; count++)
  292. {
  293. EPD_3in7_U_SendData(EPD_3in7_U_lut_R20_DU[count]);
  294. }
  295. EPD_3in7_U_SendCommand(0x21); // red not use
  296. for(count = 0; count < 42 ; count++)
  297. {
  298. EPD_3in7_U_SendData(EPD_3in7_U_lut_R21_DU[count]);
  299. }
  300. EPD_3in7_U_SendCommand(0x24); // bb b
  301. for(count = 0; count < 42 ; count++)
  302. {
  303. EPD_3in7_U_SendData(EPD_3in7_U_lut_R24_DU[count]);
  304. }
  305. if(EPD_3in7_U_Flag == 0)
  306. {
  307. EPD_3in7_U_SendCommand(0x22); // bw r
  308. for(count = 0; count < sizeof(EPD_3in7_U_lut_R22_DU) ; count++)
  309. {
  310. EPD_3in7_U_SendData(EPD_3in7_U_lut_R22_DU[count]);
  311. }
  312. EPD_3in7_U_SendCommand(0x23); // wb w
  313. for(count = 0; count < 42 ; count++)
  314. {
  315. EPD_3in7_U_SendData(EPD_3in7_U_lut_R23_DU[count]);
  316. }
  317. EPD_3in7_U_Flag = 1;
  318. }
  319. else
  320. {
  321. EPD_3in7_U_SendCommand(0x22); // bw r
  322. for(count = 0; count < sizeof(EPD_3in7_U_lut_R23_DU) ; count++)
  323. {
  324. EPD_3in7_U_SendData(EPD_3in7_U_lut_R23_DU[count]);
  325. }
  326. EPD_3in7_U_SendCommand(0x23); // wb w
  327. for(count = 0; count < 42 ; count++)
  328. {
  329. EPD_3in7_U_SendData(EPD_3in7_U_lut_R22_DU[count]);
  330. }
  331. EPD_3in7_U_Flag = 0;
  332. }
  333. }
  334. /******************************************************************************
  335. function : Initialize the e-Paper register
  336. parameter:
  337. ******************************************************************************/
  338. void EPD_3in7_U_Init(UBYTE mode)
  339. {
  340. EPD_3in7_U_Flag = 0;
  341. EPD_3in7_U_Reset();
  342. EPD_3in7_U_SendCommand(0x00); // panel setting PSR
  343. EPD_3in7_U_SendData(0xFF); // RES1 RES0 REG KW/R UD SHL SHD_N RST_N
  344. EPD_3in7_U_SendData(0x01); // x x x VCMZ TS_AUTO TIGE NORG VC_LUTZ
  345. EPD_3in7_U_SendCommand(0x01); // POWER SETTING PWR
  346. EPD_3in7_U_SendData(0x03); // x x x x x x VDS_EN VDG_EN
  347. EPD_3in7_U_SendData(0x10); // x x x VCOM_SLWE VGH[3:0] VGH=20V, VGL=-20V
  348. EPD_3in7_U_SendData(0x3F); // x x VSH[5:0] VSH = 15V
  349. EPD_3in7_U_SendData(0x3F); // x x VSL[5:0] VSL=-15V
  350. EPD_3in7_U_SendData(0x03); // OPTEN VDHR[6:0] VHDR=6.4V
  351. // T_VDS_OFF[1:0] 00=1 frame; 01=2 frame; 10=3 frame; 11=4 frame
  352. EPD_3in7_U_SendCommand(0x06); // booster soft start BTST
  353. EPD_3in7_U_SendData(0x37); // BT_PHA[7:0]
  354. EPD_3in7_U_SendData(0x3D); // BT_PHB[7:0]
  355. EPD_3in7_U_SendData(0x3D); // x x BT_PHC[5:0]
  356. EPD_3in7_U_SendCommand(0x60); // TCON setting TCON
  357. EPD_3in7_U_SendData(0x22); // S2G[3:0] G2S[3:0] non-overlap = 12
  358. EPD_3in7_U_SendCommand(0x82); // VCOM_DC setting VDCS
  359. EPD_3in7_U_SendData(0x07); // x VDCS[6:0] VCOM_DC value= -1.9v 00~3f,0x12=-1.9v
  360. EPD_3in7_U_SendCommand(0x30);
  361. EPD_3in7_U_SendData(0x09);
  362. EPD_3in7_U_SendCommand(0xe3); // power saving PWS
  363. EPD_3in7_U_SendData(0x88); // VCOM_W[3:0] SD_W[3:0]
  364. EPD_3in7_U_SendCommand(0x61); // resoultion setting
  365. EPD_3in7_U_SendData(0xf0); // HRES[7:3] 0 0 0
  366. EPD_3in7_U_SendData(0x01); // x x x x x x x VRES[8]
  367. EPD_3in7_U_SendData(0xA0); // VRES[7:0]
  368. EPD_3in7_U_SendCommand(0x50);
  369. EPD_3in7_U_SendData(0xB7);
  370. // add for luatos
  371. EPD_3in7_U_display_NUM(EPD_3in7_U_WHITE);
  372. EPD_3in7_U_lut_GC();
  373. EPD_3in7_U_refresh();
  374. EPD_3in7_U_SendCommand(0x50);
  375. EPD_3in7_U_SendData(0x17);
  376. }
  377. void EPD_3in7_U_display(UBYTE *Image, UBYTE *Image2)
  378. {
  379. UWORD i;
  380. EPD_3in7_U_SendCommand(0x13); //Transfer new data
  381. for(i=0;i<(EPD_3in7_U_WIDTH*EPD_3in7_U_HEIGHT/8);i++)
  382. {
  383. EPD_3in7_U_SendData(*Image);
  384. Image++;
  385. }
  386. // add for luatos
  387. EPD_3in7_U_lut_GC();
  388. EPD_3in7_U_refresh();
  389. }
  390. void EPD_3in7_U_display_NUM(UBYTE NUM)
  391. {
  392. UWORD row, column;
  393. // UWORD pcnt = 0;
  394. EPD_3in7_U_SendCommand(0x13); //Transfer new data
  395. for(column=0; column<EPD_3in7_U_HEIGHT; column++)
  396. {
  397. for(row=0; row<EPD_3in7_U_WIDTH/8; row++)
  398. {
  399. switch (NUM)
  400. {
  401. case EPD_3in7_U_WHITE:
  402. EPD_3in7_U_SendData(0xFF);
  403. break;
  404. case EPD_3in7_U_BLACK:
  405. EPD_3in7_U_SendData(0x00);
  406. break;
  407. case EPD_3in7_U_Source_Line:
  408. EPD_3in7_U_SendData(0xAA);
  409. break;
  410. case EPD_3in7_U_Gate_Line:
  411. if(column%2)
  412. EPD_3in7_U_SendData(0xff); //An odd number of Gate line
  413. else
  414. EPD_3in7_U_SendData(0x00); //The even line Gate
  415. break;
  416. case EPD_3in7_U_Chessboard:
  417. if(row>=(EPD_3in7_U_WIDTH/8/2)&&column>=(EPD_3in7_U_HEIGHT/2))
  418. EPD_3in7_U_SendData(0xff);
  419. else if(row<(EPD_3in7_U_WIDTH/8/2)&&column<(EPD_3in7_U_HEIGHT/2))
  420. EPD_3in7_U_SendData(0xff);
  421. else
  422. EPD_3in7_U_SendData(0x00);
  423. break;
  424. case EPD_3in7_U_LEFT_BLACK_RIGHT_WHITE:
  425. if(row>=(EPD_3in7_U_WIDTH/8/2))
  426. EPD_3in7_U_SendData(0xff);
  427. else
  428. EPD_3in7_U_SendData(0x00);
  429. break;
  430. case EPD_3in7_U_UP_BLACK_DOWN_WHITE:
  431. if(column>=(EPD_3in7_U_HEIGHT/2))
  432. EPD_3in7_U_SendData(0xFF);
  433. else
  434. EPD_3in7_U_SendData(0x00);
  435. break;
  436. case EPD_3in7_U_Frame:
  437. if(column==0||column==(EPD_3in7_U_HEIGHT-1))
  438. EPD_3in7_U_SendData(0x00);
  439. else if(row==0)
  440. EPD_3in7_U_SendData(0x7F);
  441. else if(row==(EPD_3in7_U_WIDTH/8-1))
  442. EPD_3in7_U_SendData(0xFE);
  443. else
  444. EPD_3in7_U_SendData(0xFF);
  445. break;
  446. case EPD_3in7_U_Crosstalk:
  447. if((row>=(EPD_3in7_U_WIDTH/8/3)&&row<=(EPD_3in7_U_WIDTH/8/3*2)&&column<=(EPD_3in7_U_HEIGHT/3))||(row>=(EPD_3in7_U_WIDTH/8/3)&&row<=(EPD_3in7_U_WIDTH/8/3*2)&&column>=(EPD_3in7_U_HEIGHT/3*2)))
  448. EPD_3in7_U_SendData(0x00);
  449. else
  450. EPD_3in7_U_SendData(0xFF);
  451. break;
  452. case EPD_3in7_U_Image:
  453. //EPD_3in7_U_SendData(gImage_1[pcnt++]);
  454. break;
  455. default:
  456. break;
  457. }
  458. }
  459. }
  460. }
  461. /******************************************************************************
  462. function : Clear screen
  463. parameter:
  464. ******************************************************************************/
  465. void EPD_3in7_U_Clear(void)
  466. {
  467. UWORD i;
  468. EPD_3in7_U_SendCommand(0x13); //Transfer new data
  469. for(i=0;i<(EPD_3in7_U_WIDTH*EPD_3in7_U_HEIGHT/8);i++)
  470. {
  471. EPD_3in7_U_SendData(0xFF);
  472. }
  473. EPD_3in7_U_lut_GC();
  474. EPD_3in7_U_refresh();
  475. }
  476. /******************************************************************************
  477. function : Enter sleep mode
  478. parameter:
  479. ******************************************************************************/
  480. void EPD_3in7_U_sleep(void)
  481. {
  482. EPD_3in7_U_SendCommand(0X07); //deep sleep
  483. EPD_3in7_U_SendData(0xA5);
  484. }