Skip to content

Commit af4d8b4

Browse files
committed
Add 7.5 black and white four grayscale code
1 parent af0c7dc commit af4d8b4

File tree

1,665 files changed

+828472
-1384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,665 files changed

+828472
-1384
lines changed

Arduino_R4/Arduino_R4.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ void setup() {
55
// EPD_1in02d_test();
66

77
// EPD_1in54_test();
8-
EPD_1in54_V2_test();
8+
// EPD_1in54_V2_test();
99
// EPD_1in54b_test();
1010
// EPD_1in54b_V2_test();
1111
// EPD_1in54c_test();

Arduino_R4/src/Examples/EPD_7in3e_test.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ int EPD_7in3e_test(void)
4646
//Create a new image cache
4747
UBYTE *BlackImage;
4848
UDOUBLE Imagesize = ((EPD_7IN3E_WIDTH % 2 == 0)? (EPD_7IN3E_WIDTH / 2 ): (EPD_7IN3E_WIDTH / 2 + 1)) * EPD_7IN3E_HEIGHT;
49-
if((BlackImage = (UBYTE *)malloc(Imagesize/8)) == NULL) {
49+
if((BlackImage = (UBYTE *)malloc(Imagesize/12)) == NULL) {
5050
Debug("Failed to apply for black memory...\r\n");
5151
return -1;
5252
}
5353
#if 1 // Drawing on the image
54-
Paint_NewImage(BlackImage, EPD_7IN3E_WIDTH/4, EPD_7IN3E_HEIGHT/2, 0, EPD_7IN3E_WHITE);
54+
Paint_NewImage(BlackImage, EPD_7IN3E_WIDTH/4, EPD_7IN3E_HEIGHT/3, 0, EPD_7IN3E_WHITE);
5555
Paint_SetScale(6);
5656
// 1.Select Image
5757
Debug("SelectImage:BlackImage\r\n");
@@ -60,30 +60,30 @@ int EPD_7in3e_test(void)
6060

6161
// 2.Drawing on the image
6262
Debug("Drawing:BlackImage\r\n");
63-
Paint_DrawPoint(10, 80, EPD_7IN3E_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
64-
Paint_DrawPoint(10, 90, EPD_7IN3E_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
65-
Paint_DrawPoint(10, 100, EPD_7IN3E_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
66-
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
67-
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
68-
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
69-
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
70-
Paint_DrawCircle(45, 95, 20, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
71-
Paint_DrawCircle(105, 95, 20, EPD_7IN3E_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
72-
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
73-
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
74-
Paint_DrawString_CN(10, 160, "你好abc", &Font12CN, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
75-
Paint_DrawString_CN(10, 180, "微雪电子", &Font24CN, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
76-
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
77-
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
63+
Paint_DrawPoint(10, 50, EPD_7IN3E_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
64+
Paint_DrawPoint(10, 60, EPD_7IN3E_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
65+
Paint_DrawPoint(10, 70, EPD_7IN3E_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
66+
Paint_DrawLine(20, 40, 70, 90, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
67+
Paint_DrawLine(70, 40, 20, 90, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
68+
Paint_DrawRectangle(20, 40, 70, 90, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
69+
Paint_DrawRectangle(80, 40, 130, 90, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
70+
Paint_DrawCircle(45, 65, 20, EPD_7IN3E_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
71+
Paint_DrawCircle(105, 65, 20, EPD_7IN3E_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
72+
Paint_DrawLine(85, 65, 125, 65, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
73+
Paint_DrawLine(105, 45, 105, 85, EPD_7IN3E_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
74+
Paint_DrawString_CN(10, 100, "你好abc", &Font12CN, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
75+
Paint_DrawString_CN(10, 120, "微雪电子", &Font24CN, EPD_7IN3E_YELLOW, EPD_7IN3E_BLACK);
76+
Paint_DrawNum(10, 0, 123456789, &Font12, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
77+
Paint_DrawNum(10, 17, 987654321, &Font16, EPD_7IN3E_WHITE, EPD_7IN3E_BLACK);
7878
Paint_DrawString_EN(145, 0, "Waveshare", &Font16, EPD_7IN3E_BLACK, EPD_7IN3E_WHITE);
7979
Paint_DrawString_EN(145, 35, "Waveshare", &Font16, EPD_7IN3E_GREEN, EPD_7IN3E_WHITE);
8080
Paint_DrawString_EN(145, 70, "Waveshare", &Font16, EPD_7IN3E_BLUE, EPD_7IN3E_WHITE);
8181
Paint_DrawString_EN(145, 105, "Waveshare", &Font16, EPD_7IN3E_RED, EPD_7IN3E_WHITE);
82-
Paint_DrawString_EN(145, 140, "Waveshare", &Font16, EPD_7IN3E_YELLOW, EPD_7IN3E_WHITE);
82+
// Paint_DrawString_EN(145, 140, "Waveshare", &Font16, EPD_7IN3E_YELLOW, EPD_7IN3E_WHITE);
8383
// Paint_DrawString_EN(145, 175, "Waveshare", &Font16, EPD_7IN3E_ORANGE, EPD_7IN3E_WHITE);
8484

8585
Debug("EPD_Display\r\n");
86-
EPD_7IN3E_DisplayPart(BlackImage, 300, 120, 200, 240);
86+
EPD_7IN3E_DisplayPart(BlackImage, 300, 120, 200, 160);
8787
DEV_Delay_ms(3000);
8888
#endif
8989

Arduino_R4/src/Examples/EPD_7in3f_test.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ int EPD_7in3f_test(void)
4747
//Create a new image cache
4848
UBYTE *BlackImage;
4949
UDOUBLE Imagesize = ((EPD_7IN3F_WIDTH % 2 == 0)? (EPD_7IN3F_WIDTH / 2 ): (EPD_7IN3F_WIDTH / 2 + 1)) * EPD_7IN3F_HEIGHT;
50-
if((BlackImage = (UBYTE *)malloc(Imagesize/8)) == NULL) {
50+
if((BlackImage = (UBYTE *)malloc(Imagesize/12)) == NULL) {
5151
Debug("Failed to apply for black memory...\r\n");
5252
return -1;
5353
}
5454
Debug("Paint_NewImage\r\n");
55-
Paint_NewImage(BlackImage, EPD_7IN3F_WIDTH/4, EPD_7IN3F_HEIGHT/2, 0, EPD_7IN3F_WHITE);
55+
Paint_NewImage(BlackImage, EPD_7IN3F_WIDTH/4, EPD_7IN3F_HEIGHT/3, 0, EPD_7IN3F_WHITE);
5656
Paint_SetScale(7);
5757

5858
#if 1
@@ -68,30 +68,30 @@ int EPD_7in3f_test(void)
6868

6969
// 2.Drawing on the image
7070
Debug("Drawing:BlackImage\r\n");
71-
Paint_DrawPoint(10, 80, EPD_7IN3F_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
72-
Paint_DrawPoint(10, 90, EPD_7IN3F_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
73-
Paint_DrawPoint(10, 100, EPD_7IN3F_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
74-
Paint_DrawLine(20, 70, 70, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
75-
Paint_DrawLine(70, 70, 20, 120, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
76-
Paint_DrawRectangle(20, 70, 70, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
77-
Paint_DrawRectangle(80, 70, 130, 120, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
78-
Paint_DrawCircle(45, 95, 20, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
79-
Paint_DrawCircle(105, 95, 20, EPD_7IN3F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
80-
Paint_DrawLine(85, 95, 125, 95, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
81-
Paint_DrawLine(105, 75, 105, 115, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
82-
Paint_DrawString_CN(10, 160, "你好abc", &Font12CN, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
83-
Paint_DrawString_CN(10, 180, "微雪电子", &Font24CN, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
71+
Paint_DrawPoint(10, 50, EPD_7IN3F_RED, DOT_PIXEL_1X1, DOT_STYLE_DFT);
72+
Paint_DrawPoint(10, 60, EPD_7IN3F_BLUE, DOT_PIXEL_2X2, DOT_STYLE_DFT);
73+
Paint_DrawPoint(10, 70, EPD_7IN3F_GREEN, DOT_PIXEL_3X3, DOT_STYLE_DFT);
74+
Paint_DrawLine(20, 40, 70, 90, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
75+
Paint_DrawLine(70, 40, 20, 90, EPD_7IN3F_ORANGE, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
76+
Paint_DrawRectangle(20, 40, 70, 90, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
77+
Paint_DrawRectangle(80, 40, 130, 90, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
78+
Paint_DrawCircle(45, 65, 20, EPD_7IN3F_BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
79+
Paint_DrawCircle(105, 65, 20, EPD_7IN3F_WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
80+
Paint_DrawLine(85, 65, 125, 56, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
81+
Paint_DrawLine(105, 45, 105, 85, EPD_7IN3F_YELLOW, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
82+
Paint_DrawString_CN(10, 100, "你好abc", &Font12CN, EPD_7IN3F_YELLOW, EPD_7IN3F_WHITE);
83+
Paint_DrawString_CN(10, 120, "微雪电子", &Font24CN, EPD_7IN3F_ORANGE, EPD_7IN3F_BLACK);
8484
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
8585
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_7IN3F_WHITE, EPD_7IN3F_BLACK);
8686
Paint_DrawString_EN(145, 0, "Waveshare", &Font16, EPD_7IN3F_BLACK, EPD_7IN3F_WHITE);
8787
Paint_DrawString_EN(145, 35, "Waveshare", &Font16, EPD_7IN3F_GREEN, EPD_7IN3F_WHITE);
8888
Paint_DrawString_EN(145, 70, "Waveshare", &Font16, EPD_7IN3F_BLUE, EPD_7IN3F_WHITE);
8989
Paint_DrawString_EN(145, 105, "Waveshare", &Font16, EPD_7IN3F_RED, EPD_7IN3F_WHITE);
90-
Paint_DrawString_EN(145, 140, "Waveshare", &Font16, EPD_7IN3F_YELLOW, EPD_7IN3F_WHITE);
91-
Paint_DrawString_EN(145, 175, "Waveshare", &Font16, EPD_7IN3F_ORANGE, EPD_7IN3F_WHITE);
90+
// Paint_DrawString_EN(145, 140, "Waveshare", &Font16, EPD_7IN3F_YELLOW, EPD_7IN3F_WHITE);
91+
// Paint_DrawString_EN(145, 175, "Waveshare", &Font16, EPD_7IN3F_ORANGE, EPD_7IN3F_WHITE);
9292

9393
Debug("EPD_Display\r\n");
94-
EPD_7IN3F_DisplayPart(BlackImage, 300, 120, 200, 240);
94+
EPD_7IN3F_DisplayPart(BlackImage, 300, 120, 200, 160);
9595
DEV_Delay_ms(3000);
9696
#endif
9797

Arduino_R4/src/Examples/EPD_7in3g_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int EPD_7in3g_test(void)
8888
Paint_DrawNum(10, 50, 123456, &Font12, EPD_7IN3G_RED, EPD_7IN3G_WHITE);
8989

9090
Debug("EPD_Display\r\n");
91-
EPD_7IN3G_Display_part(BlackImage, 200, 120, 400, 240);
91+
EPD_7IN3G_Display_part(BlackImage, 200, 120, 400, 160);
9292
DEV_Delay_ms(3000);
9393
#endif
9494

Arduino_R4/src/Examples/EPD_7in5_V2_test.cpp

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int EPD_7in5_V2_test(void)
4646
//Create a new image cache
4747
UBYTE *BlackImage;
4848
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
49-
UWORD Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0)? (EPD_7IN5_V2_WIDTH / 8 ): (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
49+
UDOUBLE Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0)? (EPD_7IN5_V2_WIDTH / 8 ): (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
5050
if((BlackImage = (UBYTE *)malloc(Imagesize/4)) == NULL) {
5151
Debug("Failed to apply for black memory...\r\n");
5252
return -1;
@@ -132,6 +132,48 @@ int EPD_7in5_V2_test(void)
132132
}
133133
#endif
134134

135+
/*
136+
The feature will only be available on screens sold after 24/10/23
137+
*/
138+
#if 0 // show image for array
139+
// free(BlackImage);
140+
// printf("show Gray------------------------\r\n");
141+
// Imagesize = ((EPD_7IN5_V2_WIDTH % 4 == 0)? (EPD_7IN5_V2_WIDTH / 4 ): (EPD_7IN5_V2_WIDTH / 4 + 1)) * EPD_7IN5_V2_HEIGHT;
142+
// if((BlackImage = (UBYTE *)malloc(Imagesize/8)) == NULL) {
143+
// printf("Failed to apply for black memory...\r\n");
144+
// return -1;
145+
// }
146+
EPD_7IN5_V2_Init_4Gray();
147+
printf("4 grayscale display\r\n");
148+
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH/4, EPD_7IN5_V2_HEIGHT/2, 0, WHITE);
149+
Paint_SetScale(4);
150+
Paint_Clear(0xff);
151+
152+
Paint_DrawPoint(10, 80, GRAY4, DOT_PIXEL_1X1, DOT_STYLE_DFT);
153+
Paint_DrawPoint(10, 90, GRAY4, DOT_PIXEL_2X2, DOT_STYLE_DFT);
154+
Paint_DrawPoint(10, 100, GRAY4, DOT_PIXEL_3X3, DOT_STYLE_DFT);
155+
Paint_DrawLine(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
156+
Paint_DrawLine(70, 70, 20, 120, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
157+
Paint_DrawRectangle(20, 70, 70, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
158+
Paint_DrawRectangle(80, 70, 130, 120, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_FULL);
159+
Paint_DrawCircle(45, 95, 20, GRAY4, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
160+
Paint_DrawCircle(105, 95, 20, GRAY2, DOT_PIXEL_1X1, DRAW_FILL_FULL);
161+
Paint_DrawLine(85, 95, 125, 95, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
162+
Paint_DrawLine(105, 75, 105, 115, GRAY4, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
163+
Paint_DrawString_EN(10, 0, "waveshare", &Font16, GRAY4, GRAY1);
164+
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
165+
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
166+
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
167+
Paint_DrawString_CN(130, 0,"你好abc", &Font12CN, GRAY4, GRAY1);
168+
Paint_DrawString_CN(130, 20,"你好abc", &Font12CN, GRAY3, GRAY2);
169+
Paint_DrawString_CN(130, 40,"你好abc", &Font12CN, GRAY2, GRAY3);
170+
Paint_DrawString_CN(130, 60,"你好abc", &Font12CN, GRAY1, GRAY4);
171+
Paint_DrawString_CN(10, 130, "微雪电子", &Font24CN, GRAY1, GRAY4);
172+
EPD_7IN5_V2_WritePicture_4Gray(BlackImage);
173+
DEV_Delay_ms(3000);
174+
175+
#endif
176+
135177
Debug("Clear...\r\n");
136178
EPD_7IN5_V2_Init();
137179
EPD_7IN5_V2_Clear();

0 commit comments

Comments
 (0)