diff --git a/examples/Wireless Paper/hardware/sleep_demo.h b/examples/Wireless Paper/hardware/sleep_demo.h index a6650bd..2069d7e 100644 --- a/examples/Wireless Paper/hardware/sleep_demo.h +++ b/examples/Wireless Paper/hardware/sleep_demo.h @@ -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(); @@ -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(); diff --git a/examples/bitmap_data/bitmap_data.ino b/examples/bitmap_data/bitmap_data.ino index 394ded1..435cac0 100644 --- a/examples/bitmap_data/bitmap_data.ino +++ b/examples/bitmap_data/bitmap_data.ino @@ -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 @@ -70,11 +36,11 @@ #include +#include "example_resources.h" // Sample set of raw bitmap data #include PENCILS_H - // Create the display // (Example auto-picks correct style) @@ -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 @@ -116,7 +86,7 @@ void loop() { #include #include "pencils_200x200.h" -DEPGDEPG0150BNS810 display(2, 4, 5); +DEPG0150BNS810 display(2, 4, 5); void setup() { diff --git a/examples/bitmap_data/example_resources.h b/examples/bitmap_data/example_resources.h new file mode 100644 index 0000000..2cd39b0 --- /dev/null +++ b/examples/bitmap_data/example_resources.h @@ -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 \ No newline at end of file diff --git a/examples/fast_mode/fast_mode.ino b/examples/fast_mode/fast_mode.ino index 0d4970a..904288b 100644 --- a/examples/fast_mode/fast_mode.ino +++ b/examples/fast_mode/fast_mode.ino @@ -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 diff --git a/examples/xbitmap_bw/example_resources.h b/examples/xbitmap_bw/example_resources.h new file mode 100644 index 0000000..e0ca2b3 --- /dev/null +++ b/examples/xbitmap_bw/example_resources.h @@ -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 \ No newline at end of file diff --git a/examples/xbitmap_bw/xbitmap_bw.ino b/examples/xbitmap_bw/xbitmap_bw.ino index 968fd0c..1fb8f4e 100644 --- a/examples/xbitmap_bw/xbitmap_bw.ino +++ b/examples/xbitmap_bw/xbitmap_bw.ino @@ -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 // ------------------------------------- @@ -76,13 +42,21 @@ // https://github.com/todd-herbert/heltec-eink-modules/blob/main/docs/XBitmapTutorial/README.md -#include "heltec-eink-modules.h" +#include +#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 @@ -94,4 +68,27 @@ void setup() { void loop() { -} \ No newline at end of file +} + +// "That was confusing!" +// Okay, look, here it is without all the tricky stuff to get the example to run with different displays + +/* + +#include +#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() {} + +*/ \ No newline at end of file