Skip to content

Commit

Permalink
Updated some examples per specification
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoric committed May 19, 2024
1 parent e529be2 commit d7d1507
Show file tree
Hide file tree
Showing 8 changed files with 25,622 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Inkplate6FLICK_Simple_Deep_Sleep example for Soldered Inkplate 6FLICK
For this example you will need USB cable and Soldered Inkplate 6FLICK.
Select "Soldered Inkplate 6FLICK" from Tools -> Board menu.
Don't have "Soldered Inkplate 6FLICK" option? Follow our tutorial and add it:
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/
This example will show you how you can use low power functionality of Inkplate board.
Inkplate will wake every 20 seconds change content on screen.
NOTE: Because we are using deep sleep, everytime the board wakes up, it starts program from begining.
Also, whole content from RAM gets erased, so you CAN NOT use partial updates.
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: https://forum.soldered.com/
15 March by Soldered
*/

// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
#ifndef ARDUINO_INKPLATE6FLICK
#error "Wrong board selection for this example, please select Soldered Inkplate 6FLICK"
#endif

#include "Inkplate.h" //Include Inkplate library to the sketch
#include "driver/rtc_io.h" //ESP32 library used for deep sleep and RTC wake up pins
#include "picture1.h" //Include .h files of 3 pictures. All three pictures were converted using Inkplate Image Converter
#include "picture2.h"
#include "picture3.h"
const uint8_t *pictures[] = {picture1, picture2,
picture3}; // This array of pinters holds address of every picture in the memory,
// so we can easly select it by selecting index in array

#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
#define TIME_TO_SLEEP 20 // How long ESP32 will be in deep sleep (in seconds)
RTC_DATA_ATTR int slide = 0;

Inkplate display(INKPLATE_3BIT); // Create an object on Inkplate library and also set library into 3 Bit mode (gray)

void setup()
{
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
display.clearDisplay(); // Clear frame buffer of display
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
display.display(); // Refresh the screen with new picture
slide++; // Update counter for pictures. With this variable, we choose what picture is going to be displayed on
// screen
if (slide > 2)
slide = 0; // We do not have more than 3 images, so roll back to zero

// Uncomment this line if your Inkplate is older than Aug 2021 as older Inkplates have ESP32 wrover-e chips
// rtc_gpio_isolate(GPIO_NUM_12); // Isolate/disable GPIO12 on ESP32 (only to reduce power consumption in sleep)
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer -- wake up after 20s here
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
}

void loop()
{
// Nothing! If you use deep sleep, whole program should be in setup() because each time the board restarts, not in a
// loop()! loop() must be empty!
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ void setup()
// Enable wake from I/O expander port on gpio 34
esp_sleep_enable_ext1_wakeup(TOUCHPAD_WAKE_MASK, ESP_EXT1_WAKEUP_ALL_LOW);

// Put the touchscreen in deep sleep mode to use less power
display.tsSetPowerState(CYPRESS_TOUCH_DEEP_SLEEP_MODE);

// Go to sleep
esp_deep_sleep_start();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ void loop()

// Now, let' make a grid using only horizontal and vertical lines in random colors!
display.clearDisplay();
for (int i = 0; i < 800; i += 8)
for (int i = 0; i < 1024; i += 8)
{
display.drawFastVLine(i, 0, 600, (i / 8) & 0x0F);
display.drawFastVLine(i, 0, 768, (i / 8) & 0x0F);
}
for (int i = 0; i < 600; i += 4)
for (int i = 0; i < 768; i += 4)
{
display.drawFastHLine(0, i, 800, (i / 8) & 0x0F);
display.drawFastHLine(0, i, 1024, (i / 8) & 0x0F);
}
displayCurrentAction("Drawing a grid using horizontal and vertical lines in different colors");
display.display();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ void loop()
if (display.tsAvailable())
{
display.tsGetRawData(touchRegs);
for(int i = 0; i < 8; ++i)
for(int i = 0; i < 16; ++i)
{
Serial.print("Reg ");
Serial.print(i);
Serial.print(": ");
Serial.println(touchRegs[i], BIN);
}

Serial.println("---------------------------");
Serial.println();
}
delay(1000);
delay(50);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ void setup()

display.begin();

// Turn off frontlight
display.frontlight(true);
display.setFrontlight(0);
// To turn off frontlight
// display.frontlight(true);
// display.setFrontlight(0);

// If you want to use frontlight:
// display.frontlight(true);
// display.setFrontlight(35);

// Join wifi
display.connectWiFi(ssid, password);
Expand Down

0 comments on commit d7d1507

Please sign in to comment.