EPD_3in7_U.c 17 KB

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