Skip to content

Commit

Permalink
added correct handling for waveshare and despi-c02 driver boards
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarzen committed Dec 23, 2023
1 parent 41a3521 commit 5804c9f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions platformio/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
// #define DISP_7C_F
// #define DISP_BW_V1

// E-PAPER DRIVER BOARD
// Uncomment the macro that identifies your driver board hardware.
#define DRIVER_DESPI_C02
// #define DRIVER_WAVESHARE

// 3 COLOR E-INK ACCENT COLOR
// Defines the 3rd color to be used when a 3+ color display is selected.
#if defined(DISP_3C_B) || defined(DISP_7C_F)
Expand Down Expand Up @@ -287,6 +292,10 @@ extern const unsigned long VERY_LOW_BATTERY_SLEEP_INTERVAL;
^ defined(DISP_BW_V1))
#error Invalid configuration. Exactly one display panel must be selected.
#endif
#if !( defined(DRIVER_WAVESHARE) \
^ defined(DRIVER_DESPI_C02))
#error Invalid configuration. Exactly one driver board must be selected.
#endif
#if !(defined(LOCALE))
#error Invalid configuration. Locale not selected.
#endif
Expand Down
10 changes: 9 additions & 1 deletion platformio/src/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,18 @@ void initDisplay()
{
pinMode(PIN_EPD_PWR, OUTPUT);
digitalWrite(PIN_EPD_PWR, HIGH);
#ifdef DRIVER_WAVESHARE
display.init(115200, true, 2, false);
// remap spi for waveshare
SPI.end();
SPI.begin(PIN_EPD_SCK,
PIN_EPD_MISO,
PIN_EPD_MOSI,
PIN_EPD_CS);
#endif
#ifdef DRIVER_DESPI_C02
display.init(115200, true, 10, false);
#endif

display.setRotation(0);
display.setTextSize(1);
Expand All @@ -246,7 +253,8 @@ void initDisplay()
*/
void powerOffDisplay()
{
display.powerOff();
display.hibernate(); // turns powerOff() and sets controller to deep sleep for
// minimum power use
digitalWrite(PIN_EPD_PWR, LOW);
return;
} // end initDisplay
Expand Down

0 comments on commit 5804c9f

Please sign in to comment.