Skip to content

Commit

Permalink
disable power when waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed May 3, 2020
1 parent 6b4d0ef commit 16725dc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/demo/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ void loop() {

printf("current temperature: %f\n", epd_ambient_temperature());
delay(300);
epd_poweron();


epd_poweron();
volatile uint32_t t1 = millis();
epd_clear();
volatile uint32_t t2 = millis();
printf("EPD clear took %dms.\n", t2 - t1);
epd_poweroff();

epd_draw_hline(20, 20, EPD_WIDTH - 40, 0x00, framebuffer);
epd_draw_hline(20, EPD_HEIGHT - 20, EPD_WIDTH - 40, 0x00, framebuffer);
Expand Down Expand Up @@ -71,9 +72,11 @@ void loop() {
"➸ High-quality font rendering ✎🙋",
&cursor_x, &cursor_y, framebuffer);

epd_poweron();
t1 = millis();
epd_draw_grayscale_image(epd_full_screen(), framebuffer);
t2 = millis();
epd_poweroff();
printf("EPD draw took %dms.\n", t2 - t1);

delay(1000);
Expand All @@ -84,8 +87,9 @@ void loop() {
cursor_y = 600;
#endif
char *string = "➠ With partial clear...";
epd_poweron();
writeln((GFXfont *)&FiraSans, string, &cursor_x, &cursor_y, NULL);

epd_poweroff();
delay(1000);

Rect_t to_clear = {
Expand All @@ -98,11 +102,14 @@ void loop() {
.width = EPD_WIDTH - 70 - 25 - giraffe_width,
.height = 400,
};
epd_poweron();
epd_clear_area(to_clear);
epd_poweroff();

cursor_x = 500;
cursor_y = 390;
string = "And partial update!";
epd_poweron();
writeln((GFXfont *)&FiraSans, string, &cursor_x, &cursor_y, NULL);

Rect_t board_area = {
Expand Down

0 comments on commit 16725dc

Please sign in to comment.