summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..1a73845
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,59 @@
+#define ENABLE_GxEPD2_GFX 0
+
+#include <GxEPD2_BW.h>
+#include <Fonts/FreeMonoBold9pt7b.h>
+
+#include "tux.h"
+
+/*
+ see GxEPD2_WS_ESP32_Driver.ino and esp32-waveshare-epd/src/DEV_Config.h
+
+ #define EPD_SCK_PIN 13
+ #define EPD_MOSI_PIN 14
+ #define EPD_CS_PIN 15
+ #define EPD_RST_PIN 26
+ #define EPD_DC_PIN 27
+ #define EPD_BUSY_PIN 25
+
+ mapping of Waveshare ESP32 Driver Board
+ BUSY -> 25, RST -> 26, DC -> 27, CS-> 15, CLK -> 13, DIN -> 14
+ */
+GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25));
+
+
+void board_spi_setup() {
+ /* board-specific setup */
+ SPI.end();
+ SPI.begin(13, 12, 14, 15);
+}
+
+void display_setup() {
+ display.init();
+ board_spi_setup();
+}
+
+void draw() {
+ display.setRotation(1);
+ display.setFont(&FreeMonoBold9pt7b);
+ display.setTextColor(GxEPD_BLACK);
+ display.firstPage();
+
+ do {
+ display.fillScreen(GxEPD_WHITE);
+ display.setCursor(30, 30);
+ display.print("Hello World!");
+
+ display.drawInvertedBitmap(10, 30, tux_280x370, 280, 370, GxEPD_BLACK);
+ } while(display.nextPage());
+}
+
+void setup() {
+ display_setup();
+ draw();
+
+ display.powerOff();
+}
+
+void loop() {
+ delay(1000);
+}