bugfix timing epaper
This commit is contained in:
parent
9d2f1715df
commit
c8bd1acde2
|
@ -34,7 +34,7 @@
|
||||||
#define RST_PIN 19
|
#define RST_PIN 19
|
||||||
#define DC_PIN 20
|
#define DC_PIN 20
|
||||||
#define CS_PIN 10
|
#define CS_PIN 10
|
||||||
#define BUSY_PIN 13
|
#define BUSY_PIN 14
|
||||||
|
|
||||||
class EpdIf {
|
class EpdIf {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -34,7 +34,7 @@ unsigned char image[1024];
|
||||||
Paint paint(image, 0, 0); // width should be the multiple of 8
|
Paint paint(image, 0, 0); // width should be the multiple of 8
|
||||||
Epd epd;
|
Epd epd;
|
||||||
|
|
||||||
long second=0;
|
long second=-2;
|
||||||
|
|
||||||
void setup (void)
|
void setup (void)
|
||||||
{
|
{
|
||||||
|
@ -66,69 +66,17 @@ void setup (void)
|
||||||
* i.e. the next action of SetFrameMemory will set the other memory area
|
* i.e. the next action of SetFrameMemory will set the other memory area
|
||||||
* therefore you have to clear the frame memory twice.
|
* therefore you have to clear the frame memory twice.
|
||||||
*/
|
*/
|
||||||
printf("1");
|
|
||||||
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
|
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
|
||||||
epd.DisplayFrame();
|
epd.DisplayFrame();
|
||||||
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
|
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
|
||||||
epd.DisplayFrame();
|
epd.DisplayFrame();
|
||||||
printf("2");
|
|
||||||
|
|
||||||
paint.SetRotate(ROTATE_0);
|
if (epd.Init(lut_partial_update) != 0) {
|
||||||
paint.SetWidth(200);
|
printf("e-Paper init failed");
|
||||||
paint.SetHeight(24);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* For simplicity, the arguments are explicit numerical coordinates */
|
|
||||||
paint.Clear(COLORED);
|
|
||||||
paint.DrawStringAt(30, 4, "Hello world!", &Font16, UNCOLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 0, 10, paint.GetWidth(), paint.GetHeight());
|
|
||||||
|
|
||||||
printf("3");
|
|
||||||
|
|
||||||
paint.Clear(UNCOLORED);
|
|
||||||
paint.DrawStringAt(30, 4, "e-Paper Demo", &Font16, COLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 0, 30, paint.GetWidth(), paint.GetHeight());
|
|
||||||
|
|
||||||
|
|
||||||
printf("4");
|
|
||||||
paint.SetWidth(64);
|
|
||||||
paint.SetHeight(64);
|
|
||||||
|
|
||||||
paint.Clear(UNCOLORED);
|
|
||||||
paint.DrawRectangle(0, 0, 40, 50, COLORED);
|
|
||||||
paint.DrawLine(0, 0, 40, 50, COLORED);
|
|
||||||
paint.DrawLine(40, 0, 0, 50, COLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 16, 60, paint.GetWidth(), paint.GetHeight());
|
|
||||||
|
|
||||||
printf("5");
|
|
||||||
paint.Clear(UNCOLORED);
|
|
||||||
paint.DrawCircle(32, 32, 30, COLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 120, 60, paint.GetWidth(), paint.GetHeight());
|
|
||||||
|
|
||||||
printf("6");
|
|
||||||
paint.Clear(UNCOLORED);
|
|
||||||
paint.DrawFilledRectangle(0, 0, 40, 50, COLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 16, 130, paint.GetWidth(), paint.GetHeight());
|
|
||||||
|
|
||||||
printf("7");
|
|
||||||
paint.Clear(UNCOLORED);
|
|
||||||
paint.DrawFilledCircle(32, 32, 30, COLORED);
|
|
||||||
epd.SetFrameMemory(paint.GetImage(), 120, 130, paint.GetWidth(), paint.GetHeight());
|
|
||||||
epd.DisplayFrame();
|
|
||||||
|
|
||||||
// delay(2000);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* there are 2 memory areas embedded in the e-paper display
|
|
||||||
* and once the display is refreshed, the memory area will be auto-toggled,
|
|
||||||
* i.e. the next action of SetFrameMemory will set the other memory area
|
|
||||||
* therefore you have to set the frame memory and refresh the display twice.
|
|
||||||
*/
|
|
||||||
// epd.SetFrameMemory(IMAGE_DATA);
|
|
||||||
// epd.DisplayFrame();
|
|
||||||
// epd.SetFrameMemory(IMAGE_DATA);
|
|
||||||
// epd.DisplayFrame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop (void)
|
void loop (void)
|
||||||
|
@ -136,29 +84,28 @@ void loop (void)
|
||||||
char time_string[] = {'0', '0', ':', '0', '0', '\0'};
|
char time_string[] = {'0', '0', ':', '0', '0', '\0'};
|
||||||
|
|
||||||
second ++;
|
second ++;
|
||||||
if (second == 2) {
|
if(second==-1){
|
||||||
if (epd.Init(lut_partial_update) != 0) {
|
epd.SetFrameMemory(IMAGE_DATA);
|
||||||
printf("e-Paper init failed");
|
epd.DisplayFrame();
|
||||||
return;
|
}
|
||||||
}
|
if(second==0){
|
||||||
epd.SetFrameMemory(IMAGE_DATA);
|
epd.SetFrameMemory(IMAGE_DATA);
|
||||||
epd.DisplayFrame();
|
epd.DisplayFrame();
|
||||||
epd.SetFrameMemory(IMAGE_DATA);
|
}
|
||||||
epd.DisplayFrame();
|
if(second > 0){
|
||||||
printf("init end\n");
|
time_string[0] = second / 60 / 10 + '0';
|
||||||
}
|
time_string[1] = second / 60 % 10 + '0';
|
||||||
time_string[0] = second / 60 / 10 + '0';
|
time_string[3] = second % 60 / 10 + '0';
|
||||||
time_string[1] = second / 60 % 10 + '0';
|
time_string[4] = second % 60 % 10 + '0';
|
||||||
time_string[3] = second % 60 / 10 + '0';
|
|
||||||
time_string[4] = second % 60 % 10 + '0';
|
|
||||||
paint.SetWidth(32);
|
|
||||||
paint.SetHeight(96);
|
|
||||||
paint.SetRotate(ROTATE_270);
|
|
||||||
|
|
||||||
paint.Clear(UNCOLORED);
|
paint.SetWidth(32);
|
||||||
paint.DrawStringAt(0, 4, time_string, &Font24, COLORED);
|
paint.SetHeight(96);
|
||||||
epd.SetFrameMemory(paint.GetImage(), 80, 72, paint.GetWidth(), paint.GetHeight());
|
paint.SetRotate(ROTATE_270);
|
||||||
epd.DisplayFrame();
|
|
||||||
|
paint.Clear(UNCOLORED);
|
||||||
|
paint.DrawStringAt(0, 4, time_string, &Font24, COLORED);
|
||||||
|
epd.SetFrameMemory(paint.GetImage(), 80, 72, paint.GetWidth(), paint.GetHeight());
|
||||||
|
epd.DisplayFrame();
|
||||||
|
}
|
||||||
printf("%d ",second);
|
printf("%d ",second);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue