Skip to content

Commit b113f16

Browse files
committed
Added driver for Inkplate 4
1 parent d7f456b commit b113f16

18 files changed

+553
-65
lines changed

src/Inkplate.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,33 @@
1919

2020
#include "Inkplate.h"
2121

22-
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
22+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2) || defined(ARDUINO_INKPLATE4)
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-
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2)
29+
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2) && !defined(ARDUINO_INKPLATE4)
3030
setDisplayMode(_mode);
3131
#endif
3232
}
3333

3434
/**
3535
* @brief clearDisplay function clears memory buffer for display
3636
*
37-
* @note This does not clears display, only buffer, you need to call
38-
* display() function after this to clear display
37+
* @note This does not clear the actual display, only the memory buffer, you need to call
38+
* display() function after this to clear the display
3939
*/
4040
void Inkplate::clearDisplay()
4141
{
4242
#if defined(ARDUINO_INKPLATECOLOR)
4343
memset(DMemory4Bit, WHITE << 4 | WHITE, E_INK_WIDTH * E_INK_HEIGHT / 2);
4444
#elif defined(ARDUINO_INKPLATE2)
45-
memset(DMemory4Bit, 255, E_INK_WIDTH * E_INK_HEIGHT / 4);
45+
memset(DMemory4Bit, 0xFF, E_INK_WIDTH * E_INK_HEIGHT / 4);
46+
#elif defined(ARDUINO_INKPLATE4)
47+
memset(DMemory4Bit, 0xFF, (E_INK_WIDTH * E_INK_HEIGHT / 8));
48+
memset(DMemory4Bit + (E_INK_WIDTH * E_INK_HEIGHT / 8), 0x00, (E_INK_WIDTH * E_INK_HEIGHT / 8));
4649
#else
4750
// Clear 1 bit per pixel display buffer
4851
if (getDisplayMode() == 0)
@@ -54,7 +57,7 @@ void Inkplate::clearDisplay()
5457
#endif
5558
}
5659

57-
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2)
60+
#if !defined(ARDUINO_INKPLATECOLOR) && !defined(ARDUINO_INKPLATE2) && !defined(ARDUINO_INKPLATE4)
5861

5962
/**
6063
* @brief display function update display with new data from buffer

src/Inkplate.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct waveformData
4949
class Inkplate : public System, public Graphics
5050
{
5151
public:
52-
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
52+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2) || defined(ARDUINO_INKPLATE4)
5353
Inkplate();
5454
#else
5555
Inkplate(uint8_t _mode);
@@ -78,7 +78,7 @@ class Inkplate : public System, public Graphics
7878
bool getPanelDeepSleepState();
7979

8080
void setIOExpanderForLowPower();
81-
#elif defined(ARDUINO_INKPLATE2)
81+
#elif defined(ARDUINO_INKPLATE2) || defined(ARDUINO_INKPLATE4)
8282
void clean();
8383

8484
// These 4 functions need to refactored because conflicting functionalities
@@ -115,7 +115,7 @@ class Inkplate : public System, public Graphics
115115
void precalculateGamma(uint8_t *c, float gamma);
116116

117117

118-
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2)
118+
#if defined(ARDUINO_INKPLATECOLOR) || defined(ARDUINO_INKPLATE2) || defined(ARDUINO_INKPLATE4)
119119
bool _panelState = false;
120120

121121
void resetPanel();
@@ -152,7 +152,7 @@ class Inkplate : public System, public Graphics
152152
uint8_t waveform3Bit[8][9] = WAVEFORM3BIT;
153153
#endif
154154

155-
#ifdef ARDUINO_INKPLATE2
155+
#if defined(ARDUINO_INKPLATE2) || defined(ARDUINO_INKPLATE4)
156156
bool waitForEpd(uint16_t _timeout);
157157
#endif
158158
};

src/boards/Inkplate2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
**************************************************
33
*
44
* @file Inkplate2.h
5-
* @brief Basic funtions for controling inkplate 2
5+
* @brief Basic funtions for controling Inkplate 2
66
*
77
* https://github.com/e-radionicacom/Inkplate-Arduino-library
88
* For support, please reach over forums: forum.e-radionica.com/en

0 commit comments

Comments
 (0)