This commit is contained in:
Alexandre B 2024-02-24 22:01:28 -05:00
parent c4158aee6f
commit 56f4178f35
3 changed files with 34 additions and 23 deletions

View File

@ -1,5 +1,5 @@
{
"idf.portWin": "COM19",
"idf.portWin": "COM15",
"idf.adapterTargetName": "esp32",
"idf.openOcdConfigs": [
"board/esp32-bridge.cfg"

View File

@ -1,5 +1,10 @@
#include <GxEPD.h>
#include <GxGDEW042Z15/GxGDEW042Z15.h> // 4.2" b/w/r
//#include <GxGDEW042Z15/GxGDEW042Z15.h> // 4.2" b/w/r
#include <GxGDEW029Z10/GxGDEW029Z10.h> // 2.9" b/w/r
//#include <GxGDEW029Z10/GxGDEW029Z10.h>
//#include <GxDEPG0290BS/DEPG0290BS.h>
//#include <GxDEPG0290BS/GxDEPG0290BS.h>
//#include <GxGDEP015OC1/GxGDEP015OC1.h>
#include GxEPD_BitmapExamples
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMono9pt7b.h>
@ -14,37 +19,40 @@
#include <SD.h>
#include <SPI.h>
#if defined(ESP8266)
GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=D4*/ 2, /*BUSY=D2*/ 4); // default selection of D4(=2), D2(=4)
//#if defined(ESP8266)
//GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
//GxEPD_Class display(io, /*RST=D4*/ 2, /*BUSY=D2*/ 4); // default selection of D4(=2), D2(=4)
#elif defined(ESP32)
//#elif defined(ESP32)
GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16); // arbitrary selection of 17, 16
GxEPD_Class display(io, /*RST=*/ 16, /*BUSY=*/ 4); // arbitrary selection of (16), 4
//GxIO_Class io(SPI, SS, 22, 21);
//GxEPD_Class display(io, 16, 4);
#elif defined(ARDUINO_ARCH_SAMD)
GxIO_Class io(SPI, /*CS=*/ 4, /*DC=*/ 7, /*RST=*/ 6);
GxEPD_Class display(io, /*RST=*/ 6, /*BUSY=*/ 5);
//#elif defined(ARDUINO_ARCH_SAMD)
//GxIO_Class io(SPI, /*CS=*/ 4, /*DC=*/ 7, /*RST=*/ 6);
//GxEPD_Class display(io, /*RST=*/ 6, /*BUSY=*/ 5);
#elif defined(ARDUINO_GENERIC_STM32F103C) && defined(MCU_STM32F103C8)
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 3, /*RST=*/ 2);
GxEPD_Class display(io, /*RST=*/ 2, /*BUSY=*/ 1);
//#elif defined(ARDUINO_GENERIC_STM32F103C) && defined(MCU_STM32F103C8)
//GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 3, /*RST=*/ 2);
//GxEPD_Class display(io, /*RST=*/ 2, /*BUSY=*/ 1);
#elif defined(ARDUINO_GENERIC_STM32F103V) && defined(MCU_STM32F103VB)
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ PE15, /*RST=*/ PE14); // DC, RST as wired by DESPI-M01
GxEPD_Class display(io, /*RST=*/ PE14, /*BUSY=*/ PE13); // RST, BUSY as wired by DESPI-M01
//#elif defined(ARDUINO_GENERIC_STM32F103V) && defined(MCU_STM32F103VB)
//GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ PE15, /*RST=*/ PE14); // DC, RST as wired by DESPI-M01
//GxEPD_Class display(io, /*RST=*/ PE14, /*BUSY=*/ PE13); // RST, BUSY as wired by DESPI-M01
#elif defined(ARDUINO_AVR_MEGA2560)
//#elif defined(ARDUINO_AVR_MEGA2560)
// select one, depending on your CS connection
//GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
//GxIO_Class io(SPI, /*CS=*/ 10, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9, CS on 10 (for CS same as on UNO, for SPI on ICSP use)
GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7
#else
// //GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7
//#else
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7
#endif
// //GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
// //GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7
//#endif
class Dashboard {
private:

View File

@ -14,15 +14,18 @@ void setup() {
// Initialize ePaper display
display.init(115200);
display.fillScreen(GxEPD_BLACK);
display.update();
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setFont(&FreeMono9pt7b);
display.setCursor(205, 10);
display.print("ESP32_DisplayNode"); // Takes 195 pixels in width
//display.setCursor(205, 10);
//display.print("ESP32_DisplayNode"); // Takes 195 pixels in width
display.setCursor(5, 5);
display.setFont(&TomThumb);
display.print("10.100.50.105");
display.update();
// Add UI elements
// Draw axis: (x1,y1) @ 5, 100 and width-2*margin_x height-2*margin_y
display.drawRect(5, 155, display.width()-10, display.height()-160, GxEPD_RED);