Test example poop

This commit is contained in:
Steven Tracey 2024-11-20 15:12:12 -05:00
parent 47fbfb0fc2
commit 07d4fddbb8

View File

@ -29,6 +29,27 @@ void Handler(int sigNum) {
} }
int draw() { int draw() {
Debug("EPD_2in13_V4_test Demo\r\n");
if(DEV_Module_Init()!=0){
return -1;
}
Debug("e-Paper Init and Clear...\r\n");
EPD_2in13_V4_Init();
struct timespec start={0,0}, finish={0,0};
clock_gettime(CLOCK_REALTIME,&start);
EPD_2in13_V4_Clear();
clock_gettime(CLOCK_REALTIME,&finish);
Debug("%ld S\r\n",finish.tv_sec-start.tv_sec);
//Create a new image cache
UBYTE *BlackImage;
UWORD Imagesize = ((EPD_2in13_V4_WIDTH % 8 == 0)? (EPD_2in13_V4_WIDTH / 8 ): (EPD_2in13_V4_WIDTH / 8 + 1)) * EPD_2in13_V4_HEIGHT;
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
Debug("Failed to apply for black memory...\r\n");
return -1;
}
Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE); Paint_NewImage(BlackImage, EPD_2in13_V4_WIDTH, EPD_2in13_V4_HEIGHT, 90, WHITE);
Debug("Drawing\r\n"); Debug("Drawing\r\n");
//1.Select Image //1.Select Image
@ -73,7 +94,7 @@ int draw() {
sPaint_time.Min = sPaint_time.Min + 1; sPaint_time.Min = sPaint_time.Min + 1;
sPaint_time.Sec = 0; sPaint_time.Sec = 0;
if (sPaint_time.Min == 60) { if (sPaint_time.Min == 60) {
sPaint_time.Hour = sPaint_time.Hour + 1; sPaint_time.Hour = sPaint_time.Hour + 1;
sPaint_time.Min = 0; sPaint_time.Min = 0;
if (sPaint_time.Hour == 24) { if (sPaint_time.Hour == 24) {
sPaint_time.Hour = 0; sPaint_time.Hour = 0;
@ -86,29 +107,30 @@ int draw() {
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK); Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
num = num - 1; num = num - 1;
if(num == 0) { if (num == 0) {
break; break;
} }
EPD_2in13_V4_Display_Partial(BlackImage); EPD_2in13_V4_Display_Partial(BlackImage);
DEV_Delay_ms(500);//Analog clock 1s DEV_Delay_ms(500);//Analog clock 1s
DEV_Delay_ms(5000); }
DEV_Delay_ms(5000);
Debug("Clear...\r\n"); Debug("Clear...\r\n");
EPD_2in13_V4_Init(); EPD_2in13_V4_Init();
EPD_2in13_V4_Clear(); EPD_2in13_V4_Clear();
Debug("Goto Sleep...\r\n"); Debug("Goto Sleep...\r\n");
EPD_2in13_V4_Sleep(); EPD_2in13_V4_Sleep();
free(BlackImage); free(BlackImage);
BlackImage = NULL; BlackImage = NULL;
DEV_Delay_ms(2000);//important, at least 2s DEV_Delay_ms(2000);//important, at least 2s
// close 5V // close 5V
Debug("close 5V, Module enters 0 power consumption ...\r\n"); Debug("close 5V, Module enters 0 power consumption ...\r\n");
DEV_Module_Exit(); DEV_Module_Exit();
return 0; return 0;
} }
int drawn() { int drawn() {