Skip to content

Commit

Permalink
Version 1.1.2
Browse files Browse the repository at this point in the history
added support for GDEW029T5
  • Loading branch information
ZinggJM committed Jan 16, 2019
1 parent 3e35c0c commit dbc8ffb
Show file tree
Hide file tree
Showing 47 changed files with 1,273 additions and 590 deletions.
5 changes: 5 additions & 0 deletions ConnectingHardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- these displays are for 3.3V supply and 3.3V data lines
- never connect data lines directly to 5V Arduino data pins, use e.g. 4k7/10k resistor divider
- series resistor only is not enough for reliable operation (back-feed effect through protection diodes)
- 4k7/10k resistor divider may not work with flat cable extensions or Waveshare 4.2 board, use level converter then
- do not forget to connect GND

## mapping suggestions
Expand Down Expand Up @@ -39,6 +40,10 @@
#### mapping suggestion for Arduino MEGA
- BUSY -> 7, RST -> 9, DC -> 8, CS-> 53, CLK -> 52, DIN -> 51

#### mapping suggestion for Arduino DUE
- BUSY -> 7, RST -> 9, DC -> 8, CS-> 77, CLK -> 76, DIN -> 75
- SPI pins are on 6 pin 2x3 SPI header

## connection scheme for (discontinued) DESTM32-S2 connection board for e-paper panels:

```
Expand Down
Binary file modified MyEPDs_UpdateInfos.pdf
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- these displays are for 3.3V supply and 3.3V data lines
- never connect data lines directly to 5V Arduino data pins, use e.g. 4k7/10k resistor divider
- series resistor only is not enough for reliable operation (back-feed effect through protection diodes)
- 4k7/10k resistor divider may not work with flat cable extensions or Waveshare 4.2 board, use level converter then
- do not forget to connect GND

### Paged Drawing, Picture Loop
Expand Down Expand Up @@ -37,7 +38,12 @@
- Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
- Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0

### Version 1.1.1
### Version 1.1.2
- added support for GDEW029T5
- fixed (added) clipping for partial window
- fixed (added) powerOff() after full update (partial update keeps power on)
- added hibernate() for minimum power use by displays that support it
#### Version 1.1.1
- 2.7" b/w GDEW027W3 with fast partial update support, based on new demo code wavetable
- mapping suggestion added for Arduino MEGA
- NOTE: use voltage divider resistors for 5V Arduinos, series resistor is not reliable enough
Expand Down
219 changes: 180 additions & 39 deletions examples/GxEPD2_Example/GxEPD2_Example.ino

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions examples/GxEPD2_Example/GxEPD2_boards_added.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
// Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines!
//
// Display Library based on Demo Example from Good Display: http://www.good-display.com/download_list/downloadcategoryid=34&isMode=false.html
// Display Library based on Demo Example from Good Display: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
//
// Author: Jean-Marc Zingg
//
Expand All @@ -24,8 +24,9 @@
// select one and adapt to your mapping
//GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0213I5F
//GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW029T5
//GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
Expand Down Expand Up @@ -53,8 +54,9 @@
// select one and adapt to your mapping
//GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5)); // GDEW0213I5F
//GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5)); // GDEW029T5
//GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
Expand All @@ -74,8 +76,9 @@
// select one and adapt to your mapping, can use full buffer size (full HEIGHT)
//GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEW0213I5F
//GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEW029T5
//GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GxEPD2
version=1.1.1
version=1.1.2
author=Jean-Marc Zingg
maintainer=Jean-Marc Zingg
sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare.
Expand Down
1 change: 1 addition & 0 deletions src/GxEPD2.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GxEPD2
GDE0213B1, Waveshare_2_13_bw = GDE0213B1,
GDEW0213I5F, Waveshare_2_13_flex = GDEW0213I5F,
GDEH029A1, Waveshare_2_9_bw = GDEH029A1,
GDEW029T5, Waveshare_2_9_bw_T5 = GDEW029T5,
GDEW027W3, Waveshare_2_7_bw = GDEW027W3,
GDEW042T2, Waveshare_4_2_bw = GDEW042T2,
GDEW0583T7, Waveshare_5_83_bw = GDEW0583T7,
Expand Down
46 changes: 30 additions & 16 deletions src/GxEPD2_3C.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#ifndef ENABLE_GxEPD2_GFX
// default is off
#define ENABLE_GxEPD2_GFX 0
#define ENABLE_GxEPD2_GFX 0
#endif

#if ENABLE_GxEPD2_GFX
Expand Down Expand Up @@ -65,7 +65,7 @@ class GxEPD2_3C : public Adafruit_GFX

bool mirror(bool m)
{
swap (_mirror, m);
_swap_ (_mirror, m);
return m;
}

Expand All @@ -77,28 +77,30 @@ class GxEPD2_3C : public Adafruit_GFX
switch (getRotation())
{
case 1:
swap(x, y);
_swap_(x, y);
x = WIDTH - x - 1;
break;
case 2:
x = WIDTH - x - 1;
y = HEIGHT - y - 1;
break;
case 3:
swap(x, y);
_swap_(x, y);
y = HEIGHT - y - 1;
break;
}
// transpose partial window to 0,0
x -= _pw_x;
y -= _pw_y;
// clip to (partial) window
if ((x < 0) || (x >= _pw_w) || (y < 0) || (y >= _pw_h)) return;
// adjust for current page
y -= _current_page * _page_height;
// check if in current page
if ((y < 0) || (y >= _page_height)) return;
uint16_t i = x / 8 + y * (_pw_w / 8);
_black_buffer[i] = (_black_buffer[i] | (1 << (7 - x % 8))); // white
_color_buffer[i] = _color_buffer[i] = (_color_buffer[i] | (1 << (7 - x % 8)));
_color_buffer[i] = (_color_buffer[i] | (1 << (7 - x % 8)));
if (color == GxEPD_WHITE) return;
else if (color == GxEPD_BLACK) _black_buffer[i] = (_black_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
else if (color == GxEPD_RED) _color_buffer[i] = (_color_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
Expand Down Expand Up @@ -142,6 +144,11 @@ class GxEPD2_3C : public Adafruit_GFX
_pw_h = HEIGHT;
}

// setPartialWindow, use parameters according to actual rotation.
// x and w should be multiple of 8, for rotation 0 or 2,
// y and h should be multiple of 8, for rotation 1 or 3,
// else window is increased as needed,
// this is an addressing limitation of the e-paper controllers
void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
{
if (!epd2.hasPartialUpdate) return;
Expand Down Expand Up @@ -205,7 +212,7 @@ class GxEPD2_3C : public Adafruit_GFX
fillScreen(GxEPD_WHITE);
return true;
}
else
else // full update
{
epd2.writeImage(_black_buffer, _color_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
_current_page++;
Expand All @@ -216,13 +223,13 @@ class GxEPD2_3C : public Adafruit_GFX
{
if (!_second_phase)
{
epd2.refresh(false);
epd2.refresh(false); // full update after first phase
_second_phase = true;
fillScreen(GxEPD_WHITE);
return true;
}
else epd2.refresh(true);
} else epd2.refresh(false);
else epd2.refresh(true); // partial update after second phase
} else epd2.refresh(false); // full update after only phase
epd2.powerOff();
return false;
}
Expand Down Expand Up @@ -251,7 +258,7 @@ class GxEPD2_3C : public Adafruit_GFX
}
epd2.refresh(_pw_x, _pw_y, _pw_w, _pw_h);
}
else
else // full update
{
epd2.setPaged(); // for GxEPD2_154c paged workaround
for (_current_page = 0; _current_page < _pages; _current_page++)
Expand All @@ -271,7 +278,8 @@ class GxEPD2_3C : public Adafruit_GFX
epd2.writeImage(_black_buffer, _color_buffer, 0, page_ys, WIDTH, gx_uint16_min(_page_height, HEIGHT - page_ys));
}
}
epd2.refresh();
epd2.refresh(false); // full update
epd2.powerOff();
}
_current_page = 0;
}
Expand Down Expand Up @@ -347,13 +355,19 @@ class GxEPD2_3C : public Adafruit_GFX
{
epd2.refresh(x, y, w, h);
}
// turns off generation of panel driving voltages, avoids screen fading over time
void powerOff()
{
epd2.powerOff();
}
// turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
void hibernate()
{
epd2.hibernate();
}
private:
template <typename T> static inline void
swap(T & a, T & b)
_swap_(T & a, T & b)
{
T t = a;
a = b;
Expand All @@ -372,17 +386,17 @@ class GxEPD2_3C : public Adafruit_GFX
switch (getRotation())
{
case 1:
swap(x, y);
swap(w, h);
_swap_(x, y);
_swap_(w, h);
x = WIDTH - x - w;
break;
case 2:
x = WIDTH - x - w;
y = HEIGHT - y - h;
break;
case 3:
swap(x, y);
swap(w, h);
_swap_(x, y);
_swap_(w, h);
y = HEIGHT - y - h;
break;
}
Expand Down
Loading

0 comments on commit dbc8ffb

Please sign in to comment.