add 4.2 inch epaper module examples

This commit is contained in:
YXZhu
2024-05-22 23:36:56 +08:00
parent 7a725ab68b
commit 708ad3a891
24 changed files with 1929 additions and 1216 deletions
+30 -4
View File
@@ -15,7 +15,7 @@
#include "bmp.h"
// define for White Black Red Epaper Module
#define EPD_BWR
//#define EPD_BWR
uint8_t image_bw[EPD_W_BUFF_SIZE * EPD_H];
#ifdef EPD_BWR
@@ -56,16 +56,25 @@ int main(void)
epd_init();
#ifdef EPD_BWR
#ifdef EPD_42
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
epd_paint_newimage(image_red, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw);
epd_paint_clear(EPD_COLOR_WHITE);
epd_paint_selectimage(image_red);
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_42
epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
epd_display(image_bw, image_red);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -83,6 +92,10 @@ int main(void)
#ifdef EPD_29
epd_paint_showString(10, 0, (uint8_t *)&"2.9 Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#ifdef EPD_42
epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
@@ -99,8 +112,13 @@ int main(void)
#endif
epd_display(image_bw, image_red);
#else
#ifdef EPD_42
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_270, EPD_COLOR_WHITE);
#else
epd_paint_newimage(image_bw, EPD_W, EPD_H, EPD_ROTATE_180, EPD_COLOR_WHITE);
#endif
epd_paint_selectimage(image_bw);
@@ -109,8 +127,12 @@ int main(void)
epd_paint_showPicture((EPD_H - 200) / 2,(EPD_W - 64) / 2,200,64,gImage_5,EPD_COLOR_WHITE);
#else
epd_paint_clear(EPD_COLOR_WHITE);
#ifdef EPD_42
epd_paint_showPicture((EPD_W - 250) / 2, (EPD_H - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#else
epd_paint_showPicture((EPD_H - 250) / 2, (EPD_W - 122) / 2, 250, 122, gImage_4, EPD_COLOR_WHITE);
#endif
#endif
epd_displayBW(image_bw);
epd_enter_deepsleepmode(EPD_DEEPSLEEP_MODE1);
@@ -138,11 +160,15 @@ epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SI
epd_paint_showString(10, 50, (uint8_t *)&"with 296 x 128 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#ifdef EPD_42
epd_paint_showString(10, 0, (uint8_t *)&"4.2 Inch Epaper Module", EPD_FONT_SIZE24x12, EPD_COLOR_BLACK);
epd_paint_showString(10, 50, (uint8_t *)&"with 400 x 300 resolution", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
epd_paint_showString(10, 29, (uint8_t *)&"Designed By WeAct Studio", EPD_FONT_SIZE16x8, EPD_COLOR_BLACK);
#endif
#if 1
epd_paint_showString(10,100,(uint8_t *)&"CH32V103C8T6 Example",EPD_FONT_SIZE16x8,EPD_COLOR_BLACK);
#else
epd_paint_drawRectangle(10, 103, EPD_H - 10, 116, EPD_COLOR_BLACK, 1);
epd_paint_drawRectangle(10, EPD_W-20, EPD_H - 10, EPD_W-6, EPD_COLOR_BLACK, 1);
#endif
sprintf((char *)&text, ">> Partial Mode");