diff --git a/platformio.ini b/platformio.ini index 1ff5e92ce..5d991fe38 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,6 +20,7 @@ default_envs = tbeam ;default_envs = pca10059_diy_eink ;default_envs = meshtastic-diy-v1 ;default_envs = meshtastic-diy-v1.1 +;default_envs = m5stack-coreink extra_configs = variants/*/platformio.ini diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 073b313cd..ef6bac4cf 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -31,6 +31,11 @@ //4.2 inch 300x400 - GxEPD2_420_M01 #define TECHO_DISPLAY_MODEL GxEPD2_420_M01 +#elif defined(M5_COREINK) +//M5Stack CoreInk +//1.54 inch 200x200 - GxEPD2_154_M09 +#define TECHO_DISPLAY_MODEL GxEPD2_154_M09 + #endif GxEPD2_BW *adafruitDisplay; @@ -58,6 +63,12 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl) //GxEPD2_420_M01 setGeometry(GEOMETRY_RAWMODE, 300, 400); + #elif defined(M5_COREINK) + + //M5Stack_CoreInk 200x200 + //1.54 inch 200x200 - GxEPD2_154_M09 + setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH); + #endif // setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution // setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does @@ -108,7 +119,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit) // 4.2 inch 300x400 - GxEPD2_420_M01 //adafruitDisplay->nextPage(); - #elif defined(PCA10059) + #elif defined(PCA10059) || defined(M5_COREINK) adafruitDisplay->nextPage(); #endif @@ -180,35 +191,10 @@ bool EInkDisplay::connect() adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0)); //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates - //RAK14000 2.13 inch b/w 250x122 does not support partial updates adafruitDisplay->setRotation(3); //For 1.54, 2.9 and 4.2 //adafruitDisplay->setRotation(1); - - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); - adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + //adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } else { (void)adafruitDisplay; } @@ -221,6 +207,12 @@ bool EInkDisplay::connect() adafruitDisplay->setRotation(3); adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } +#elif defined(M5_COREINK) + auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY); + adafruitDisplay = new GxEPD2_BW(*lowLevel); + adafruitDisplay->init(115200, true, 10, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0)); + adafruitDisplay->setRotation(0); + adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT); #endif diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini new file mode 100644 index 000000000..a6a35d80e --- /dev/null +++ b/variants/m5stack_coreink/platformio.ini @@ -0,0 +1,18 @@ +[env:m5stack-coreink] +extends = esp32_base +board = m5stack-coreink +build_flags = + ${esp32_base.build_flags} -D M5_COREINK -I variants/m5stack_coreink + ;-D RADIOLIB_VERBOSE + -Ofast + -D__MCUXPRESSO + -DEPD_HEIGHT=200 + -DEPD_WIDTH=200 + -DM5STACK +lib_deps = + ${esp32_base.lib_deps} + zinggjm/GxEPD2@^1.4.5 + lewisxhe/PCF8563_Library@^0.0.1 +board_build.f_cpu = 240000000L +upload_protocol = esptool +upload_port = /dev/ttyACM* diff --git a/variants/m5stack_coreink/variant.h b/variants/m5stack_coreink/variant.h new file mode 100644 index 000000000..ff9eda6f4 --- /dev/null +++ b/variants/m5stack_coreink/variant.h @@ -0,0 +1,49 @@ +#define I2C_SDA 21 //-1 +#define I2C_SCL 22 //-1 + +//#define LED_PIN 10 + +#include "pcf8563.h" +// PCF8563 RTC Module +#define PCF8563_RTC 0x51 + +#define BUTTON_NEED_PULLUP +#define BUTTON_PIN 5 + +//Wheel +// Down 37 +// Push 38 +// Up 39 + +// Top Physical Button 5 + +#undef RF95_SCK +#undef RF95_MISO +#undef RF95_MOSI +#undef RF95_NSS +#define USE_RF95 + +#define RF95_SCK 18 //13 +#define RF95_MISO 34 //26 +#define RF95_MOSI 23 //25 +#define RF95_NSS 14 +#define LORA_DIO0 25 //32 now moved from ext port +#define LORA_RESET 26 //33 now moved from ext port +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC + +#define NO_GPS +// This board has no GPS for now +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define HAS_EINK +//https://docs.m5stack.com/en/core/coreink +//https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/coreink/coreink_sch.pdf +#define PIN_EINK_EN -1 +#define PIN_EINK_CS 9 // EPD_CS +#define PIN_EINK_BUSY 4 // EPD_BUSY +#define PIN_EINK_DC 15 // EPD_D/C +#define PIN_EINK_RES -1 // Connected to GPIO0 but no needed !!!! maybe causing issue ? +#define PIN_EINK_SCLK 18 // EPD_SCLK +#define PIN_EINK_MOSI 23 // EPD_MOSI