-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
148 changed files
with
29,868 additions
and
5 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
100 changes: 100 additions & 0 deletions
100
examples/Inkplate5/Advanced/DeepSleep/Inkplate5_Wake_Up_Button/Inkplate5_Wake_Up_Button.ino
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,100 @@ | ||
/* | ||
Inkplate5_Wake_Up_Button example for Soldered Inkplate 5 | ||
For this example you will need a USB-C cable and an Inkplate5 | ||
Select "Soldered Inkplate5" from Tools -> Board menu. | ||
Don't have "Soldered Inkplate5" option? Follow our tutorial and add it: | ||
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/ | ||
Here is shown how to use ESP interrupts to wake up the MCU from deepsleep when wake up button | ||
is pressed. Also, wake up on timer after 30 seconds of deep sleep if the button is not pressed. | ||
NOTE: Button press will be detected when Inkplate ends with drawing to the screen(when the red | ||
color stops flickering). If it is pressed when the Inkplate is drawing, nothing will happen, | ||
the click will be ignored. | ||
Want to learn more about Inkplate? Visit www.inkplate.io | ||
Looking to get support? Write on our forums: https://forum.soldered.com/ | ||
24 July 2023 by Soldered | ||
*/ | ||
|
||
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them | ||
#ifndef ARDUINO_INKPLATE5 | ||
#error "Wrong board selection for this example, please select Soldered Inkplate5 in the boards menu." | ||
#endif | ||
|
||
// Include Inkplate library to the sketch | ||
#include <Inkplate.h> | ||
|
||
// Create an object on Inkplate library and also set library into 1-bit mode (BW) | ||
Inkplate display(INKPLATE_1BIT); | ||
|
||
// Conversion factor for micro seconds to seconds | ||
#define uS_TO_S_FACTOR 1000000 | ||
|
||
// Time ESP32 will go to sleep (in seconds) | ||
#define TIME_TO_SLEEP 30 | ||
|
||
// Store int in rtc data, to remain persistent during deep sleep | ||
RTC_DATA_ATTR int bootCount = 0; | ||
|
||
void setup() | ||
{ | ||
// Init Inkplate library (you should call this function ONLY ONCE) | ||
display.begin(); | ||
|
||
++bootCount; | ||
|
||
// Our function declared below | ||
displayInfo(); | ||
|
||
// Go to sleep for TIME_TO_SLEEP seconds | ||
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); | ||
|
||
// Enable wakeup from deep sleep on gpio 36 (wake button) | ||
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, 0); | ||
|
||
// Start deep sleep (this function does not return). Program stops here. | ||
esp_deep_sleep_start(); | ||
} | ||
|
||
void loop() | ||
{ | ||
// Never here! If you use deep sleep, the whole program should be in setup() because the board restarts each | ||
// time. loop() must be empty! | ||
} | ||
|
||
// Function that will write number of boots and boot reason to screen | ||
void displayInfo() | ||
{ | ||
// First, lets delete everything from frame buffer | ||
display.clearDisplay(); | ||
|
||
// Set text cursor and size | ||
display.setCursor(30, 40); | ||
display.setTextSize(3); | ||
|
||
display.print(F("Boot count: ")); | ||
display.println(bootCount, DEC); // Print the number | ||
|
||
// Set next line cursor position | ||
display.setCursor(30, 100); | ||
|
||
// Display wake up reason | ||
esp_sleep_wakeup_cause_t wakeup_reason; | ||
wakeup_reason = esp_sleep_get_wakeup_cause(); | ||
switch (wakeup_reason) | ||
{ | ||
case ESP_SLEEP_WAKEUP_EXT0: | ||
display.println("Wakeup caused by WakeUp button"); | ||
break; | ||
case ESP_SLEEP_WAKEUP_TIMER: | ||
display.println("Wakeup caused by timer"); | ||
break; | ||
default: | ||
display.println("Wakeup was not caused by deep sleep"); | ||
break; | ||
} | ||
|
||
// Show everything on the screen | ||
display.display(); | ||
} |
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
65 changes: 65 additions & 0 deletions
65
...les/InkplatePLUS2/Diagnostics/InkplatePLUS2_Burn_In_Clean/InkplatePLUS2_Burn_In_Clean.ino
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,65 @@ | ||
/* | ||
InkplatePLUS2_Burn_In_Clean example for Soldered Inkplate PLUS2 | ||
For this example you will need only USB-C cable and Inkplate PLUS2. | ||
Select "Soldered Inkplate PLUS2" from Tools -> Board menu. | ||
Don't have "Soldered Inkplate PLUS2" option? Follow our tutorial and add it: | ||
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/ | ||
This example will try to remove heavy burn-in visible on the panel. | ||
Set number of refresh / clear cycles and upload the program. | ||
Want to learn more about Inkplate? Visit www.inkplate.io | ||
Looking to get support? Write on our forums: https://forum.soldered.com/ | ||
24 July 2023 by Soldered | ||
*/ | ||
|
||
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them | ||
#ifndef ARDUINO_INKPLATEPLUS2 | ||
#error "Wrong board selection for this example, please select Inkplate PLUS2 in the boards menu." | ||
#endif | ||
|
||
#include "Inkplate.h" //Include Inkplate library to the sketch | ||
Inkplate display(INKPLATE_1BIT); // Create object on Inkplate library and set library to work in monochorme mode | ||
|
||
// Nubmer of clear cycles. | ||
#define CLEAR_CYCLES 20 | ||
|
||
// Delay between clear cycles (in milliseconds) | ||
#define CYCLES_DELAY 5000 | ||
|
||
void setup() | ||
{ | ||
display.begin(); // Init library (you should call this function ONLY ONCE) | ||
display.clearDisplay(); // Clear any data that may have been in (software) frame buffer. | ||
|
||
display.einkOn(); // Power up epaper power supply | ||
|
||
int cycles = CLEAR_CYCLES; | ||
|
||
// Clean it by writing clear sequence to the panel. | ||
while (cycles) | ||
{ | ||
display.clean(1, 21); | ||
display.clean(2, 1); | ||
display.clean(0, 12); | ||
display.clean(2, 1); | ||
display.clean(1, 21); | ||
display.clean(2, 1); | ||
display.clean(0, 12); | ||
display.clean(2, 1); | ||
|
||
delay(CYCLES_DELAY); | ||
cycles--; | ||
} | ||
|
||
// Print text when clearing is done. | ||
display.setTextSize(4); | ||
display.setCursor(125, 270); | ||
display.print("Clearing done."); | ||
display.display(); | ||
} | ||
|
||
void loop() | ||
{ | ||
// Empty... | ||
} |
Oops, something went wrong.