mirror of
https://github.com/usetrmnl/bb_epaper.git
synced 2026-04-29 13:43:26 -07:00
Enhanced example
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user