summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/badge_config.h.template4
-rw-r--r--include/displays.h5
-rw-r--r--platformio.ini12
-rw-r--r--src/main.cpp23
4 files changed, 41 insertions, 3 deletions
diff --git a/include/badge_config.h.template b/include/badge_config.h.template
index ec32e05..c2d0b42 100644
--- a/include/badge_config.h.template
+++ b/include/badge_config.h.template
@@ -1,5 +1,7 @@
#pragma once
-#define UVOK_EPAP_DISPLAY 290
+#include "displays.h"
+
+#define UVOK_EPAP_DISPLAY ...
#define BADGE_SSID_NAME
#define BADGE_SSID_PASS \ No newline at end of file
diff --git a/include/displays.h b/include/displays.h
new file mode 100644
index 0000000..f588697
--- /dev/null
+++ b/include/displays.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#define DISPLAY_WAVESHARE_219_YBW 1
+#define DISPLAY_WAVESHARE_290_BW 2
+#define DISPLAY_ELECROW_290_BW 3
diff --git a/platformio.ini b/platformio.ini
index 8d623a6..8072303 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -18,6 +18,18 @@ lib_deps =
zinggjm/GxEPD2@^1.6.4
h2zero/NimBLE-Arduino@^2.3.2
+# no idea if this is the correct board template
+[env:crowpanel]
+platform = espressif32
+board = esp32-s3-devkitc-1
+framework = arduino
+monitor_speed = 115200
+lib_deps =
+ zinggjm/GxEPD2@^1.6.4
+ h2zero/NimBLE-Arduino@^2.3.2
+build_flags =
+ -I include/elecrow
+
; [env:esp32_ota]
; extends = env:esp32dev
#upload_protocol = espota
diff --git a/src/main.cpp b/src/main.cpp
index 838fde0..0f90d96 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,15 +22,25 @@
#endif
NimBLEServer *server;
-#if UVOK_EPAP_DISPLAY == 219
+#if UVOK_EPAP_DISPLAY == DISPLAY_WAVESHARE_219_YBW
// HINT: Update the library code, set budy timeout to 30 or 60 seconds!
// Small color
GxEPD2_3C<GxEPD2_213_Z19c, GxEPD2_213_Z19c::HEIGHT> display(GxEPD2_213_Z19c(22, 21, 17, 16));
-#elif UVOK_EPAP_DISPLAY == 290
+#elif UVOK_EPAP_DISPLAY == DISPLAY_WAVESHARE_290_BW
// larger b/w
// or T5
// GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(22, 21, 17, 16));
GxEPD2_BW<GxEPD2_290_M06, GxEPD2_290_M06::HEIGHT> display(GxEPD2_290_M06(22, 21, 17, 16));
+#elif UVOK_EPAP_DISPLAY == DISPLAY_ELECROW_290_BW
+/*
+#define SCK 12
+#define MOSI 11
+#define RES 47
+#define DC 46
+#define CS 45
+#define BUSY 48
+*/
+GxEPD2_BW<GxEPD2_290_T94, GxEPD2_290_T94::HEIGHT> display(GxEPD2_290_T94(45, 46, 47, 48));
#else
#error "define display"
#endif
@@ -65,7 +75,16 @@ void setup()
pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->setName("NimBLE");
Serial.println("Init display...");
+
+#if UVOK_EPAP_DISPLAY == DISPLAY_ELECROW_290_BW
+ // Turn on once, let controller handle the rest, lest I want to do re-init...
+ pinMode(7, OUTPUT); // Set pin 7 as output mode
+ digitalWrite(7, HIGH); // Set pin 7 to high level to turn on the screen power
+ display.init(115200, true);
+#else
display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
+#endif
+
display.hibernate();
Serial.println("Display done.");