Skip to content

Commit d7d1507

Browse files
committed
Updated some examples per specification
1 parent e529be2 commit d7d1507

File tree

8 files changed

+25622
-9
lines changed

8 files changed

+25622
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Inkplate6FLICK_Simple_Deep_Sleep example for Soldered Inkplate 6FLICK
3+
For this example you will need USB cable and Soldered Inkplate 6FLICK.
4+
Select "Soldered Inkplate 6FLICK" from Tools -> Board menu.
5+
Don't have "Soldered Inkplate 6FLICK" option? Follow our tutorial and add it:
6+
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/
7+
8+
This example will show you how you can use low power functionality of Inkplate board.
9+
Inkplate will wake every 20 seconds change content on screen.
10+
11+
NOTE: Because we are using deep sleep, everytime the board wakes up, it starts program from begining.
12+
Also, whole content from RAM gets erased, so you CAN NOT use partial updates.
13+
14+
Want to learn more about Inkplate? Visit www.inkplate.io
15+
Looking to get support? Write on our forums: https://forum.soldered.com/
16+
15 March by Soldered
17+
*/
18+
19+
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
20+
#ifndef ARDUINO_INKPLATE6FLICK
21+
#error "Wrong board selection for this example, please select Soldered Inkplate 6FLICK"
22+
#endif
23+
24+
#include "Inkplate.h" //Include Inkplate library to the sketch
25+
#include "driver/rtc_io.h" //ESP32 library used for deep sleep and RTC wake up pins
26+
#include "picture1.h" //Include .h files of 3 pictures. All three pictures were converted using Inkplate Image Converter
27+
#include "picture2.h"
28+
#include "picture3.h"
29+
const uint8_t *pictures[] = {picture1, picture2,
30+
picture3}; // This array of pinters holds address of every picture in the memory,
31+
// so we can easly select it by selecting index in array
32+
33+
#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
34+
#define TIME_TO_SLEEP 20 // How long ESP32 will be in deep sleep (in seconds)
35+
RTC_DATA_ATTR int slide = 0;
36+
37+
Inkplate display(INKPLATE_3BIT); // Create an object on Inkplate library and also set library into 3 Bit mode (gray)
38+
39+
void setup()
40+
{
41+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
42+
display.clearDisplay(); // Clear frame buffer of display
43+
display.drawImage(pictures[slide], 0, 0, 1100, 825); // Display selected picture at location X=0, Y=0. All three pictures have resolution of 1100x825 pixels
44+
display.display(); // Refresh the screen with new picture
45+
slide++; // Update counter for pictures. With this variable, we choose what picture is going to be displayed on
46+
// screen
47+
if (slide > 2)
48+
slide = 0; // We do not have more than 3 images, so roll back to zero
49+
50+
// Uncomment this line if your Inkplate is older than Aug 2021 as older Inkplates have ESP32 wrover-e chips
51+
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
52+
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer -- wake up after 20s here
53+
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
54+
}
55+
56+
void loop()
57+
{
58+
// Nothing! If you use deep sleep, whole program should be in setup() because each time the board restarts, not in a
59+
// loop()! loop() must be empty!
60+
}

examples/Inkplate6FLICK/Advanced/DeepSleep/Inkplate6FLICK_Simple_Deep_Sleep/picture1.h

Lines changed: 829 additions & 0 deletions
Large diffs are not rendered by default.

examples/Inkplate6FLICK/Advanced/DeepSleep/Inkplate6FLICK_Simple_Deep_Sleep/picture2.h

Lines changed: 829 additions & 0 deletions
Large diffs are not rendered by default.

examples/Inkplate6FLICK/Advanced/DeepSleep/Inkplate6FLICK_Simple_Deep_Sleep/picture3.h

Lines changed: 23886 additions & 0 deletions
Large diffs are not rendered by default.

examples/Inkplate6FLICK/Advanced/DeepSleep/Inkplate6FLICK_Wake_Up_On_Touchscreen/Inkplate6FLICK_Wake_Up_On_Touchscreen.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void setup()
6969
// Enable wake from I/O expander port on gpio 34
7070
esp_sleep_enable_ext1_wakeup(TOUCHPAD_WAKE_MASK, ESP_EXT1_WAKEUP_ALL_LOW);
7171

72+
// Put the touchscreen in deep sleep mode to use less power
73+
display.tsSetPowerState(CYPRESS_TOUCH_DEEP_SLEEP_MODE);
74+
7275
// Go to sleep
7376
esp_deep_sleep_start();
7477
}

examples/Inkplate6FLICK/Basic/Inkplate6FLICK_Grayscale/Inkplate6FLICK_Grayscale.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ void loop()
132132

133133
// Now, let' make a grid using only horizontal and vertical lines in random colors!
134134
display.clearDisplay();
135-
for (int i = 0; i < 800; i += 8)
135+
for (int i = 0; i < 1024; i += 8)
136136
{
137-
display.drawFastVLine(i, 0, 600, (i / 8) & 0x0F);
137+
display.drawFastVLine(i, 0, 768, (i / 8) & 0x0F);
138138
}
139-
for (int i = 0; i < 600; i += 4)
139+
for (int i = 0; i < 768; i += 4)
140140
{
141-
display.drawFastHLine(0, i, 800, (i / 8) & 0x0F);
141+
display.drawFastHLine(0, i, 1024, (i / 8) & 0x0F);
142142
}
143143
displayCurrentAction("Drawing a grid using horizontal and vertical lines in different colors");
144144
display.display();

examples/Inkplate6FLICK/Basic/Inkplate6FLICK_Touch_Registers/Inkplate6FLICK_Touch_Registers.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ void loop()
5858
if (display.tsAvailable())
5959
{
6060
display.tsGetRawData(touchRegs);
61-
for(int i = 0; i < 8; ++i)
61+
for(int i = 0; i < 16; ++i)
6262
{
6363
Serial.print("Reg ");
64+
Serial.print(i);
65+
Serial.print(": ");
6466
Serial.println(touchRegs[i], BIN);
6567
}
6668

6769
Serial.println("---------------------------");
6870
Serial.println();
6971
}
70-
delay(1000);
72+
delay(50);
7173
}

examples/Inkplate6FLICK/Projects/Inkplate6FLICK_Image_Frame_From_Web/Inkplate6FLICK_Image_Frame_From_Web.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ void setup()
2828

2929
display.begin();
3030

31-
// Turn off frontlight
32-
display.frontlight(true);
33-
display.setFrontlight(0);
31+
// To turn off frontlight
32+
// display.frontlight(true);
33+
// display.setFrontlight(0);
34+
35+
// If you want to use frontlight:
36+
// display.frontlight(true);
37+
// display.setFrontlight(35);
3438

3539
// Join wifi
3640
display.connectWiFi(ssid, password);

0 commit comments

Comments
 (0)