From 60600888e904fa2d71f196cc01bf6be06c7aedb0 Mon Sep 17 00:00:00 2001 From: Larry Bank Date: Mon, 22 Sep 2025 19:18:27 +0100 Subject: [PATCH] Enhanced example --- .../images_and_icons/images_and_icons.ino | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/examples/images_and_icons/images_and_icons.ino b/examples/images_and_icons/images_and_icons.ino index ebda916..9b3456d 100644 --- a/examples/images_and_icons/images_and_icons.ino +++ b/examples/images_and_icons/images_and_icons.ino @@ -7,17 +7,12 @@ #include "bart.h" // compressed 128x64 image #include "smiley.h" // 100x100 compressed image -BBEPAPER bbep(EP295_128x296); -#define CS_PIN 2 -#define DC_PIN 3 -#define RESET_PIN 5 -#define BUSY_PIN 4 -#define CLK_PIN 1 -#define MOSI_PIN 0 +BBEPAPER bbep; void setup() { - bbep.initIO(DC_PIN, RESET_PIN, BUSY_PIN, CS_PIN, MOSI_PIN, CLK_PIN, 8000000); + bbep.begin(EPD_CROWPANEL29); + bbep.allocBuffer(); // Do everything with no local buffer bbep.fillScreen(BBEP_WHITE); bbep.setCursor(0,4); // start a few pixels away from the top edge @@ -30,27 +25,27 @@ void setup() // draw 3x uncompressed icon at x,24 bbep.drawSprite(ucBombMask, SPRITE_WIDTH, SPRITE_HEIGHT, SPRITE_PITCH, x, 24, BBEP_BLACK); } - for (int y=80; y<272; y+=64) { - bbep.loadG5Image(bart, 0, y, BBEP_BLACK, BBEP_WHITE); // draw 3x 128x64 compressed Bart image at 0,y - } + bbep.writePlane(); bbep.refresh(REFRESH_FULL); - bbep.wait(); delay(3000); - // Scaled drawing requires a back buffer - bbep.allocBuffer(); - bbep.setRotation(270); + bbep.fillScreen(BBEP_WHITE); + for (int y=0; y<4; y++) { + bbep.loadG5Image(bart, (y&1)*128, (y&2)*32, BBEP_WHITE, BBEP_BLACK); // draw 3x 128x64 compressed Bart image at 0,y + bbep.writePlane(PLANE_FALSE_DIFF); // force update of all pixels + bbep.refresh(REFRESH_PARTIAL); + } + delay(3000); bbep.fillScreen(BBEP_WHITE); bbep.setFont(FONT_12x16); bbep.setCursor(0,0); - bbep.print("Scaled G5 needs RAM"); + bbep.print("Scaled G5 images"); float f = 0.5; for (int i=0; i<5; i++) { bbep.loadG5Image(smiley, (int)(i*50), 16+(int)(i*12.5*f), BBEP_TRANSPARENT, BBEP_BLACK, f); f += 0.25; } bbep.writePlane(); - bbep.refresh(REFRESH_FULL); - bbep.wait(); + bbep.refresh(REFRESH_FAST); bbep.sleep(DEEP_SLEEP); }