Skip to content

Commit

Permalink
chore: minor adjustments to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
todd-herbert committed Feb 27, 2024
1 parent ebc7ee3 commit 82c52fc
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 84 deletions.
16 changes: 8 additions & 8 deletions examples/Wireless Paper/hardware/sleep_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ void sleepDemo() {

display.setCursor(2, 50);
display.print( \
"Deep sleep current is\n" \
"only 18 micro Amps.\n" \
"\n"\
"Demo will sleep for 10 seconds." \
"Prepare display (and LoRa)\n" \
"for ESP32 deep sleep:\n" \
"\n" \
"Platform::prepareToSleep();\n" \
);

display.update();
Expand All @@ -23,10 +23,10 @@ void sleepDemo() {
drawTitle(title_sleep);
display.setCursor(2, 50);
display.print( \
"Platform::prepareToSleep();\n" \
"\n" \
"Prepares display (and LoRa)\n" \
"for ESP32 deep sleep." \
"Deep sleep current is\n" \
"only 18 micro Amps.\n" \
"\n"\
"Demo will sleep for 10 seconds." \
);
display.update();

Expand Down
42 changes: 6 additions & 36 deletions examples/bitmap_data/bitmap_data.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,6 @@
// "Wireless Paper" boards: skip this, your wiring is pre-set


// (Example automatically picks the correct class and sample image)
#if defined USING_DEPG0150BNS810
#define DISPLAY_CLASS DEPG0150BNS810
#define PENCILS_H "pencils_200x200.h"
#elif defined USING_DEPG0154BNS800
#define DISPLAY_CLASS DEPG0154BNS800
#define PENCILS_H "pencils_152x152.h"
#elif defined USING_GDEP015OC1
#define DISPLAY_CLASS GDEP015OC1
#define PENCILS_H "pencils_200x200.h"
#elif defined USING_DEPG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define PENCILS_H "pencils_250x122.h"
#elif defined USING_QYEG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define PENCILS_H "pencils_250x122.h"
#elif defined USING_DEPG0290BNS75A
#define DISPLAY_CLASS DEPG0290BNS75A
#define PENCILS_H "pencils_296x128.h"
#elif defined USING_DEPG0290BNS800
#define DISPLAY_CLASS DEPG0290BNS800
#define PENCILS_H "pencils_296x128.h"
#elif defined USING_GDE029A1
#define DISPLAY_CLASS GDE029A1
#define PENCILS_H "pencils_296x128.h"
#elif defined USING_DEPG0213BNS800
#define DISPLAY_CLASS DEPG0213BNS800
#define PENCILS_H "pencils_250x122.h"
#elif defined USING_LCMEN2R13EFC1
#define DISPLAY_CLASS LCMEN2R13EFC1
#define PENCILS_H "pencils_250x122.h"
#endif


// DEMO: Bitmap Data
// -----------------
// You may sometime have the need to draw raw bitmap data to the screen
Expand All @@ -70,11 +36,11 @@


#include <heltec-eink-modules.h>
#include "example_resources.h"

// Sample set of raw bitmap data
#include PENCILS_H


// Create the display
// (Example auto-picks correct style)

Expand All @@ -86,6 +52,10 @@
DISPLAY_CLASS display(DC_PIN, CS_PIN, BUSY_PIN);
#endif

// Instead of all this "auto-picking" stuff:
// #include "pencils_200x200.h"
// DEPG0150BNS810 display(2, 4, 5); // Pins for DC, CS, BUSY


void setup() {
display.setRotation(PINS_LEFT); // Don't forget to set the correct rotation, so your image fits how you intended
Expand Down Expand Up @@ -116,7 +86,7 @@ void loop() {
#include <heltec-eink-modules.h>
#include "pencils_200x200.h"
DEPGDEPG0150BNS810 display(2, 4, 5);
DEPG0150BNS810 display(2, 4, 5);
void setup() {
Expand Down
52 changes: 52 additions & 0 deletions examples/bitmap_data/example_resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
This file only exists to make the example simpler to run
It picks the class name and image size to suit your display
Normally, you would have written something like this instead:
#include "pencils_200x200.h"
DEPG0150BNS810 display(2, 4, 5); // Pins for DC, CS, BUSY
*/


#if defined USING_DEPG0150BNS810
#define DISPLAY_CLASS DEPG0150BNS810
#define PENCILS_H "pencils_200x200.h"

#elif defined USING_DEPG0154BNS800
#define DISPLAY_CLASS DEPG0154BNS800
#define PENCILS_H "pencils_152x152.h"

#elif defined USING_GDEP015OC1
#define DISPLAY_CLASS GDEP015OC1
#define PENCILS_H "pencils_200x200.h"

#elif defined USING_DEPG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define PENCILS_H "pencils_250x122.h"

#elif defined USING_QYEG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define PENCILS_H "pencils_250x122.h"

#elif defined USING_DEPG0290BNS75A
#define DISPLAY_CLASS DEPG0290BNS75A
#define PENCILS_H "pencils_296x128.h"

#elif defined USING_DEPG0290BNS800
#define DISPLAY_CLASS DEPG0290BNS800
#define PENCILS_H "pencils_296x128.h"

#elif defined USING_GDE029A1
#define DISPLAY_CLASS GDE029A1
#define PENCILS_H "pencils_296x128.h"

#elif defined USING_DEPG0213BNS800
#define DISPLAY_CLASS DEPG0213BNS800
#define PENCILS_H "pencils_250x122.h"

#elif defined USING_LCMEN2R13EFC1
#define DISPLAY_CLASS LCMEN2R13EFC1
#define PENCILS_H "pencils_250x122.h"

#endif
2 changes: 1 addition & 1 deletion examples/fast_mode/fast_mode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// -- "Wireless Paper" --

// DEPG0213BNS800 display; // (Red Tab)
// LCMEN2R13EFC1 display; // (Green Tab,V1.1)
// LCMEN2R13EFC1 display; // (Green Tab, V1.1)


// DEMO: Fast Mode
Expand Down
51 changes: 51 additions & 0 deletions examples/xbitmap_bw/example_resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
This file only exists to make the example simpler to run
It picks the class name and image size to suit your display
Normally, you would have written something like this instead:
#include "pencils_200x200.h"
DEPG0150BNS810 display(2, 4, 5); // Pins for DC, CS, BUSY
*/

#if defined USING_DEPG0150BNS810
#define DISPLAY_CLASS DEPG0150BNS810
#define CHESS_H "chess_200x200.h"

#elif defined USING_DEPG0154BNS800
#define DISPLAY_CLASS DEPG0154BNS800
#define CHESS_H "chess_152x152.h"

#elif defined USING_GDEP015OC1
#define DISPLAY_CLASS GDEP015OC1
#define CHESS_H "chess_200x200.h"

#elif defined USING_DEPG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define CHESS_H "chess_250x122.h"

#elif defined USING_QYEG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define CHESS_H "chess_250x122.h"

#elif defined USING_DEPG0290BNS75A
#define DISPLAY_CLASS DEPG0290BNS75A
#define CHESS_H "chess_296x128.h"

#elif defined USING_DEPG0290BNS800
#define DISPLAY_CLASS DEPG0290BNS800
#define CHESS_H "chess_296x128.h"

#elif defined USING_GDE029A1
#define DISPLAY_CLASS GDE029A1
#define CHESS_H "chess_296x128.h"

#elif defined USING_DEPG0213BNS800
#define DISPLAY_CLASS DEPG0213BNS800
#define CHESS_H "chess_250x122.h"

#elif defined USING_LCMEN2R13EFC1
#define DISPLAY_CLASS LCMEN2R13EFC1
#define CHESS_H "chess_250x122.h"

#endif
75 changes: 36 additions & 39 deletions examples/xbitmap_bw/xbitmap_bw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,6 @@
// "Wireless Paper" boards: skip this, your wiring is pre-set


// (Example automatically picks the correct class and sample image)
#if defined USING_DEPG0150BNS810
#define DISPLAY_CLASS DEPG0150BNS810
#define CHESS_H "chess_200x200.h"
#elif defined USING_DEPG0154BNS800
#define DISPLAY_CLASS DEPG0154BNS800
#define CHESS_H "chess_152x152.h"
#elif defined USING_GDEP015OC1
#define DISPLAY_CLASS GDEP015OC1
#define CHESS_H "chess_200x200.h"
#elif defined USING_DEPG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define CHESS_H "chess_250x122.h"
#elif defined USING_QYEG0213RWS800
#define DISPLAY_CLASS QYEG0213RWS800
#define CHESS_H "chess_250x122.h"
#elif defined USING_DEPG0290BNS75A
#define DISPLAY_CLASS DEPG0290BNS75A
#define CHESS_H "chess_296x128.h"
#elif defined USING_DEPG0290BNS800
#define DISPLAY_CLASS DEPG0290BNS800
#define CHESS_H "chess_296x128.h"
#elif defined USING_GDE029A1
#define DISPLAY_CLASS GDE029A1
#define CHESS_H "chess_296x128.h"
#elif defined USING_DEPG0213BNS800
#define DISPLAY_CLASS DEPG0213BNS800
#define CHESS_H "chess_250x122.h"
#elif defined USING_LCMEN2R13EFC1
#define DISPLAY_CLASS LCMEN2R13EFC1
#define CHESS_H "chess_250x122.h"
#endif


// DEMO: Black & White XBitmap Images
// -------------------------------------

Expand All @@ -76,13 +42,21 @@
// https://github.com/todd-herbert/heltec-eink-modules/blob/main/docs/XBitmapTutorial/README.md


#include "heltec-eink-modules.h"
#include <heltec-eink-modules.h>
#include "example_resources.h"

// Here we are including the xbm image file (chess.h or similar).
// In this example, for convenience, an appropriate image for you display has been automatically selected. (See above)
// Example auto-selects an image
#include CHESS_H

DISPLAY_CLASS display(DC_PIN, CS_PIN, BUSY_PIN);
// Example auto-selects correct class
#ifdef WIRELESS_PAPER
// For "Wireless Paper" boards, no need to set pins.
DISPLAY_CLASS display;
#else
// For SPI displays, you would normally set your pins here
DISPLAY_CLASS display(DC_PIN, CS_PIN, BUSY_PIN);
#endif


void setup() {
display.setRotation(PINS_LEFT); // Don't forget to set the rotation, so your image fits how you intended
Expand All @@ -94,4 +68,27 @@ void setup() {

void loop() {

}
}

// "That was confusing!"
// Okay, look, here it is without all the tricky stuff to get the example to run with different displays

/*
#include <heltec-eink-modules.h>
#include "chess_200x200.h"
DEPG0150BNS810 display(2, 4, 5);
void setup() {
display.setRotation(90); // Landscape
DRAW (display) {
display.drawXBitmap(0, 0, chess_bits, chess_width, chess_height, BLACK);
}
}
void loop() {}
*/

0 comments on commit 82c52fc

Please sign in to comment.