-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reorganize examples; wireless_paper.md
- Loading branch information
1 parent
bc2d951
commit e9d55e3
Showing
17 changed files
with
269 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include <heltec-eink-modules.h> | ||
|
||
// Pick your panel - https://github.com/todd-herbert/heltec-eink-modules#supported-displays | ||
// --------------- | ||
|
||
// -- "Wireless Paper" boards only -- | ||
|
||
// DEPG0213BNS800 display; // (Red Tab) | ||
// LCMEN2R13EFC1 display; // (Green Tab) | ||
|
||
|
||
// DEMO: Wireless Paper - Basic | ||
// -------------------- | ||
// This example is only for Heltec's "Wireless Paper" all-in-one boards. | ||
// A simple sketch to get you going | ||
|
||
#include "Fonts/FreeSans9pt7b.h" | ||
#include "Fonts/FreeSansBold9pt7b.h" | ||
|
||
void setup() { | ||
display.print("Hello, world!"); | ||
display.update(); | ||
|
||
delay(4000); | ||
display.clearMemory(); // Start a new drawing | ||
|
||
display.landscape(); | ||
display.setFont( &FreeSans9pt7b ); | ||
display.printCenter("In the middle."); | ||
display.update(); | ||
|
||
delay(4000); | ||
display.clearMemory(); // Start a new drawing | ||
|
||
display.setCursor(5, 20); // Text Cursor - x:5 y:20 | ||
display.println("Here's a normal update."); | ||
display.update(); | ||
|
||
delay(2000); // Pause to read | ||
|
||
display.fastmodeOn(); | ||
display.println("Here's fastmode,"); | ||
display.update(); | ||
display.println("aka Partial Refresh."); | ||
display.update(); | ||
|
||
delay(2000); // Pause to read | ||
|
||
display.fastmodeOff(); | ||
display.setFont( &FreeSansBold9pt7b ); // Change to bold font | ||
display.println(); | ||
display.println("Don't use too often!"); | ||
display.update(); | ||
|
||
delay(4000); | ||
display.clear(); // Physically clear the screen | ||
|
||
display.fastmodeOn(); | ||
display.setFont( NULL ); // Default Font | ||
display.printCenter("How about a spot?", 0, -40); // 40px above center | ||
display.update(); | ||
|
||
delay(2000); | ||
|
||
display.fastmodeOff(); | ||
display.fillCircle( | ||
display.bounds.full.centerX(), // X: center screen | ||
display.bounds.full.centerY(), // Y: center screen | ||
10, // Radius: 10px | ||
BLACK // Color: black | ||
); | ||
display.update(); | ||
|
||
delay(2000); | ||
|
||
// Here's a convenient trick: | ||
FullBounds f = display.bounds.full; | ||
|
||
display.drawCircle(f.centerX(), f.centerY(), 5, WHITE); // Draw a smaller white circle inside, giving a "ring" shape | ||
display.update(); | ||
|
||
delay(10000); | ||
display.clear(); // Physically clear the screen, ready for your next masterpiece | ||
} | ||
|
||
void loop() { | ||
|
||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#include <heltec-eink-modules.h> | ||
|
||
// Find your wiring - https://github.com/todd-herbert/heltec-eink-modules#wiring | ||
// ---------------- | ||
|
||
#define PIN_DC 2 | ||
#define PIN_CS 4 | ||
#define PIN_BUSY 5 | ||
|
||
// "Wireless Paper" boards: skip this, your wiring is pre-set | ||
|
||
|
||
// Pick your panel - https://github.com/todd-herbert/heltec-eink-modules#supported-displays | ||
// --------------- | ||
|
||
// -- SPI Displays -- | ||
|
||
// DEPG0150BNS810 display( PIN_DC, PIN_CS, PIN_BUSY ); // 1.54" - Mono | ||
// DEPG0154BNS800 display( PIN_DC, PIN_CS, PIN_BUSY); // 1.54" - Mono | ||
// GDEP015OC1 display( PIN_DC, PIN_CS, PIN_BUSY); // 1.54" - Mono | ||
// DEPG0213RWS800 display( PIN_DC, PIN_CS, PIN_BUSY ); // 2.13" - 3 Color Red | ||
// QYEG0213RWS800 display( PIN_DC, PIN_CS, PIN_BUSY ); // 2.13" - 3 Color Red | ||
// DEPG0290BNS75A display( PIN_DC, PIN_CS, PIN_BUSY ); // 2.9" - Mono | ||
// DEPG0290BNS800 display( PIN_DC, PIN_CS, PIN_BUSY ); // 2.9" - Mono | ||
// GDE029A1 display( PIN_DC, PIN_CS, PIN_BUSY ); // 2.9" - Mono | ||
|
||
// -- "Wireless Paper" -- | ||
|
||
// DEPG0213BNS800 display; // (Red Tab) | ||
// LCMEN2R13EFC1 display; // (Green Tab) | ||
|
||
|
||
// DEMO: Text | ||
// ------------------ | ||
// A few examples of text, to get you started | ||
|
||
// Include a font (for later) | ||
#include "Fonts/FreeSerif9pt7b.h" | ||
|
||
void setup() { | ||
|
||
// Nothing fancy | ||
DRAW (display) { | ||
display.print("Hello, World!"); | ||
} | ||
|
||
// Pause to read | ||
delay(4000); | ||
|
||
// -------------------------------- | ||
|
||
display.setRotation(90); // Rotate 90deg clocklwise - more room | ||
display.setFont( & FreeSerif9pt7b ); // Set font - pass the address (&) of the font | ||
display.setBackgroundColor(BLACK); // Background: BLACK | ||
display.setTextColor(WHITE); // Text: WHITE | ||
display.setCursor(5, 20); // Cursor to x:5 y:20 - think "word processor" | ||
|
||
DRAW (display) { | ||
display.println("black"); | ||
display.println("on"); | ||
display.println("white"); | ||
} | ||
|
||
// Pause to read | ||
delay(4000); | ||
|
||
// -------------------------------- | ||
|
||
display.setFont( NULL ); // Font: back to default | ||
display.setBackgroundColor(WHITE); // Background: WHITE | ||
display.setTextColor(BLACK); // Text: BLACK | ||
|
||
DRAW (display) { | ||
display.setTextSize(3); | ||
display.printCenter("Big"); // Centered | ||
|
||
display.setTextSize(1); | ||
display.printCenter("Small", 0, 30); // 30px below center | ||
} | ||
|
||
// Pause to read | ||
delay(4000); | ||
|
||
// -------------------------------- | ||
|
||
// Let's use the nice font again | ||
display.setFont( &FreeSerif9pt7b ); | ||
|
||
char sample_text[] = "Measure!"; | ||
|
||
int offset_left; | ||
int offset_top; | ||
unsigned int text_width; | ||
unsigned int text_height; | ||
|
||
// If the cursor were placed at 0, 0: | ||
// Where would the left and top edges be? (negative) | ||
// How wide and how tall would the text be? | ||
// Don't blame me, this is an AdafruitGFX method | ||
display.getTextBounds(sample_text, 0, 0, &offset_left, &offset_top, &text_width, &text_height); | ||
|
||
// Where to place cursor: for align bottom-right | ||
unsigned int cursor_right = display.bounds.full.right() - (text_width + offset_left); | ||
unsigned int cursor_bottom = display.bounds.full.bottom() - (text_height + offset_top); | ||
|
||
// Where to place cursor: for align top-left | ||
unsigned int cursor_left = 0 - offset_left; | ||
unsigned int cursor_top = 0 - offset_top; | ||
|
||
DRAW(display) { | ||
// Move to bottom right, print text | ||
display.setCursor(cursor_right, cursor_bottom); | ||
display.print(sample_text); | ||
|
||
// Move to top left, print text | ||
display.setCursor(cursor_left, cursor_top); | ||
display.print(sample_text); | ||
} | ||
|
||
// Pause | ||
delay(4000); | ||
|
||
// -------------------------------- | ||
|
||
// If you just want to align top-left, these is a lazier way: | ||
|
||
char sample_text2[] = "Easier"; | ||
|
||
DRAW (display) { | ||
display.setCursorTopLeft(sample_text2, 0, 0); | ||
display.print(sample_text2); | ||
} | ||
|
||
delay(4000); | ||
display.clear(); | ||
} | ||
|
||
void loop() { | ||
|
||
} |