Skip to content

Commit b7cce9e

Browse files
committed
Added Inkplate 2
1 parent eef1f33 commit b7cce9e

File tree

17 files changed

+476
-755
lines changed

17 files changed

+476
-755
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Inkplate_Basic example for e-radionica.com Inkplate 2
3+
For this example you will need only USB cable and Inkplate 2.
4+
Select "Inkplate 2(ESP32)" from Tools -> Board menu.
5+
Don't have "Inkplate 2(ESP32)" option? Follow our tutorial and add it:
6+
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
7+
8+
This example will show you how you can draw some simple graphics using
9+
Adafruit GFX functions. Yes, Inkplate library is 100% compatible with GFX lib!
10+
Learn more about Adafruit GFX: https://learn.adafruit.com/adafruit-gfx-graphics-library )
11+
12+
Want to learn more about Inkplate? Visit www.inkplate.io
13+
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
14+
15 Feb 2022 by e-radionica.com
15+
*/
16+
17+
#include "Inkplate.h"
18+
19+
// Initialize Inkplate object
20+
Inkplate display;
21+
22+
void setup()
23+
{
24+
// Begin serial communication
25+
Serial.begin(115200);
26+
27+
// Initialize Inkplate
28+
display.begin();
29+
30+
display.setTextSize(2); // Set text size
31+
display.setTextColor(BLACK); // Set text color
32+
display.setCursor(0, 0); // Set cursor position
33+
34+
display.print("Test"); // Print text
35+
36+
display.setTextColor(RED);
37+
display.setCursor(0, 20);
38+
display.print("Test");
39+
40+
// Draw text with shadow, specify color for text and background
41+
display.drawTextWithShadow(0, 40, "Test", RED, BLACK);
42+
43+
display.setTextSize(1);
44+
display.drawTextWithShadow(110, 80, "By soldered.com", RED, BLACK);
45+
46+
// Other basic drawing functions supported
47+
display.drawLine(10, 80, 100, 100, RED);
48+
49+
// Display to screen
50+
display.display();
51+
52+
// Go to deep sleep
53+
display.setPanelDeepSleep(0);
54+
esp_deep_sleep_start();
55+
}
56+
57+
void loop()
58+
{
59+
// Empty...
60+
}

examples/Inkplate5/Basic_Inkplate_Functionality/Inkplate_Basic_BW/Inkplate_Basic_BW.ino

Lines changed: 0 additions & 739 deletions
This file was deleted.

keywords.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ getCursorY KEYWORD2
5656
touchInArea KEYWORD2
5757
setFrontlight KEYWORD2
5858
frontlight KEYWORD2
59-
setTextColor KEYWORD2
59+
setTextColor KEYWORD2
60+
setPanelDeepSleep KEYWORD2
61+
drawTextWithShadow KEYWORD2
6062

6163
# Instances (KEYWORD2)
6264

src/Inkplate.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
#include "Inkplate.h"
2121

22-
#ifdef ARDUINO_INKPLATECOLOR
22+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
2323
Inkplate::Inkplate() : Adafruit_GFX(E_INK_WIDTH, E_INK_HEIGHT), Graphics(E_INK_WIDTH, E_INK_HEIGHT)
2424
#else
2525

2626
Inkplate::Inkplate(uint8_t _mode) : Adafruit_GFX(E_INK_WIDTH, E_INK_HEIGHT), Graphics(E_INK_WIDTH, E_INK_HEIGHT)
2727
#endif
2828
{
29-
#ifndef ARDUINO_INKPLATECOLOR
29+
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2)
3030
setDisplayMode(_mode);
3131
#endif
3232
}
@@ -39,8 +39,10 @@ Inkplate::Inkplate(uint8_t _mode) : Adafruit_GFX(E_INK_WIDTH, E_INK_HEIGHT), Gra
3939
*/
4040
void Inkplate::clearDisplay()
4141
{
42-
#ifdef ARDUINO_INKPLATECOLOR
42+
#if defined(ARDUINO_INKPLATECOLOR)
4343
memset(DMemory4Bit, WHITE << 4 | WHITE, E_INK_WIDTH * E_INK_HEIGHT / 2);
44+
#elif defined(ARDUINO_INKPLATE2)
45+
memset(DMemory4Bit, 255, E_INK_WIDTH * E_INK_HEIGHT / 4);
4446
#else
4547
// Clear 1 bit per pixel display buffer
4648
if (getDisplayMode() == 0)
@@ -52,7 +54,7 @@ void Inkplate::clearDisplay()
5254
#endif
5355
}
5456

55-
#ifndef ARDUINO_INKPLATECOLOR
57+
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2)
5658

5759
/**
5860
* @brief display function update display with new data from buffer

src/Inkplate.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern SdFat sd;
3838
class Inkplate : public System, public Graphics
3939
{
4040
public:
41-
#ifdef ARDUINO_INKPLATECOLOR
41+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
4242
Inkplate();
4343
#else
4444
Inkplate(uint8_t _mode);
@@ -55,7 +55,7 @@ class Inkplate : public System, public Graphics
5555
// void writeRow(uint8_t data);
5656
uint32_t partialUpdate(bool _forced = false, bool leaveOn = false);
5757

58-
#ifdef ARDUINO_INKPLATECOLOR
58+
#if defined(ARDUINO_INKPLATECOLOR)
5959
void clean();
6060

6161
// These 4 functions need to refactored because conflicting functionalities
@@ -65,6 +65,14 @@ class Inkplate : public System, public Graphics
6565
bool getPanelDeepSleepState();
6666

6767
void setMCPForLowPower();
68+
#elif defined(ARDUINO_INKPLATE2)
69+
void clean();
70+
71+
// These 4 functions need to refactored because conflicting functionalities
72+
void setPanelState(bool _state);
73+
bool getPanelState();
74+
void setPanelDeepSleep(bool _state);
75+
bool getPanelDeepSleepState();
6876
#else
6977
int einkOn();
7078
void einkOff();
@@ -93,7 +101,7 @@ class Inkplate : public System, public Graphics
93101
private:
94102
void precalculateGamma(uint8_t *c, float gamma);
95103

96-
#ifdef ARDUINO_INKPLATECOLOR
104+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
97105
bool _panelState = false;
98106

99107
void resetPanel();
@@ -124,6 +132,10 @@ class Inkplate : public System, public Graphics
124132
#ifdef WAVEFORM3BIT
125133
uint8_t waveform3Bit[8][9] = WAVEFORM3BIT;
126134
#endif
135+
136+
#ifdef ARDUINO_INKPLATE2
137+
bool waitForEpd(uint16_t _timeout);
138+
#endif
127139
};
128140

129141
#endif

0 commit comments

Comments
 (0)