Put eink screen to sleep

This commit is contained in:
Zuckerberg 2023-11-13 22:45:12 -07:00
parent 8aca70574f
commit fb30109f42
3 changed files with 17 additions and 14 deletions

View File

@ -454,8 +454,10 @@ void IT8951DisplayArea(uint16_t usX, uint16_t usY, uint16_t usW, uint16_t usH, u
LCDWriteData(usDpyMode); LCDWriteData(usDpyMode);
} }
void IT8951_BMP_Example(uint32_t x, uint32_t y, uint32_t w, uint32_t h) void IT8951_BMP(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *image)
{ {
gpFrameBuf = image;
IT8951LdImgInfo stLdImgInfo; IT8951LdImgInfo stLdImgInfo;
IT8951AreaImgInfo stAreaImgInfo; IT8951AreaImgInfo stAreaImgInfo;
@ -476,5 +478,5 @@ void IT8951_BMP_Example(uint32_t x, uint32_t y, uint32_t w, uint32_t h)
//Load Image from Host to IT8951 Image Buffer //Load Image from Host to IT8951 Image Buffer
IT8951HostAreaPackedPixelWrite(&stLdImgInfo, &stAreaImgInfo);//Display function 2 IT8951HostAreaPackedPixelWrite(&stLdImgInfo, &stAreaImgInfo);//Display function 2
//Display Area ?V (x,y,w,h) with mode 2 for fast gray clear mode - depends on current waveform //Display Area ?V (x,y,w,h) with mode 2 for fast gray clear mode - depends on current waveform
//IT8951DisplayArea(0,0, gstI80DevInfo.usPanelW, gstI80DevInfo.usPanelH, 2); IT8951DisplayArea(0, 0, w, h, 2);
} }

View File

@ -53,18 +53,18 @@ void initDisplay()
{ {
if (epd.Init() != 0) if (epd.Init() != 0)
{ {
Serial.print("e-Paper init failed"); Serial.println("e-Paper init failed");
return; return;
} }
} }
void drawImage(uint8_t *image) void drawImage(uint8_t *image)
{ {
Serial.print("Wake up display\n"); Serial.println("Wake up display");
epd.Reset(); epd.Reset();
Serial.print("Draw image\n"); Serial.println("Draw image");
epd.EPD_7IN3F_Display(image); epd.EPD_7IN3F_Display(image);
Serial.print("Put display to sleep\n"); Serial.println("Put display to sleep");
epd.Sleep(); epd.Sleep();
} }
#endif #endif

View File

@ -93,14 +93,15 @@ void initDisplay()
void drawImage(uint8_t *image) void drawImage(uint8_t *image)
{ {
gpFrameBuf = image; Serial.println("Wake up display");
Serial.println("Sending image"); IT8951SystemRun();
IT8951_BMP_Example(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT); Serial.println("Draw image");
Serial.println("Displaying image"); IT8951_BMP(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, image);
IT8951DisplayArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, 2); Serial.println("Waiting for display to finish...");
Serial.println("Waiting for display ...");
LCDWaitForReady(); LCDWaitForReady();
Serial.println("done"); Serial.println("Done");
Serial.println("Putting display to sleep.");
IT8951Sleep();
} }
#endif #endif