diff --git a/src/arduino_io.inl b/src/arduino_io.inl index aabcdac..61a62bb 100644 --- a/src/arduino_io.inl +++ b/src/arduino_io.inl @@ -155,7 +155,7 @@ void bbepWriteCmd(BBEPDISP *pBBEP, uint8_t cmd) pBBEP->is_awake = 1; } digitalWrite(pBBEP->iDCPin, LOW); - delay(1); + delayMicroseconds(1); digitalWrite(pBBEP->iCSPin, LOW); if (pBBEP->iSpeed == 0) { // bit bang SPI_Write(pBBEP, &cmd, 1); diff --git a/src/bb_ep.inl b/src/bb_ep.inl index d6fcdde..94a5b7c 100644 --- a/src/bb_ep.inl +++ b/src/bb_ep.inl @@ -3725,6 +3725,46 @@ const uint8_t epd81c_init_full[] PROGMEM = { 0x00 }; +const uint8_t epd133_spectra_init[] PROGMEM = { + BUSY_WAIT, + 10, 0x74, 0xc0, 0x1c, 0x1c, 0xcc, 0xcc, 0xcc, 0x15, 0x15, 0x55, // AN_TM (master only) + 7, 0xf0, 0x49, 0x55, 0x13, 0x5d, 0x05, 0x10, // CMD66 + 3, UC8151_PSR, 0xdf, 0x6b, // panel setting + 2, UC8151_PLL, 0x08, // PLL + 2, UC8151_CDI, 0xf7, // VCOM and data interval + 3, UC8151_TCON, 0x03, 0x03, // TCON + 2, 0x86, 0x10, // AGID + 2, UC8151_PWS, 0x22, // PWS + 2, 0xe0, 0x01, // CCSET + 5, UC8151_TRES, 0x04, 0xb0, 0x03, 0x20, // resolution + 7, UC8151_PWR, 0x0f, 0x00, 0x28, 0x2c, 0x28, 0x38, // power (master only) + 2, 0xb6, 0x07, // EN_BUF (master only) + 3, UC8151_BTST, 0xd8, 0x18, // BTST_P (master only) + 2, 0xb7, 0x01, // BOOST_VDDP_EN (master only) + 3, 0x05, 0xd8, 0x18, // BTST_N (master only) + 2, 0xb0, 0x01, // BUCK_BOOST_VDDN (master only) + 2, 0xb1, 0x02, // TFT_VCOM_POWER (master only) + 1, UC8151_PON, // power on + BUSY_WAIT, + 0x00 +}; +// Slave (CS2) init: only the registers both controllers need; no power-stage regs. +const uint8_t epd133_spectra_init_slave[] PROGMEM = { + BUSY_WAIT, + 7, 0xf0, 0x49, 0x55, 0x13, 0x5d, 0x05, 0x10, // CMD66 + 3, UC8151_PSR, 0xdf, 0x6b, + 2, UC8151_PLL, 0x08, + 2, UC8151_CDI, 0xf7, + 3, UC8151_TCON, 0x03, 0x03, + 2, 0x86, 0x10, // AGID + 2, UC8151_PWS, 0x22, + 2, 0xe0, 0x01, // CCSET + 5, UC8151_TRES, 0x04, 0xb0, 0x03, 0x20, + 1, UC8151_PON, + BUSY_WAIT, + 0x00 +}; + #ifdef NO_RAM uint8_t u8Cache[128]; // buffer a single line of up to 1024 pixels #else // we need a larger cache for 4-bit panels @@ -3820,6 +3860,7 @@ const EPD_PANEL panelDefs[] PROGMEM = { {400, 600, 0, epd40_spectra_init, NULL, NULL, BBEP_7COLOR, BBEP_CHIP_UC81xx, u8Colors_spectra}, // EP40_SPECTRA_400x600 GDEP040E01 Spectra 6 4" 400x600 {176, 264, 0, badger2350_init_full, badger2350_init_fast, badger2350_init_part, BBEP_NEEDS_EXTRA_INIT, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP27_176x264 {176, 264, 0, badger2350g_init_full, badger2350g_init_fast, NULL, BBEP_NEEDS_EXTRA_INIT | BBEP_4GRAY, BBEP_CHIP_SSD16xx, u8Colors_4gray},// EP27_176x264_4GRAY + {1200, 1600, 0, epd133_spectra_init, NULL, epd133_spectra_init_slave, BBEP_NEEDS_EXTRA_INIT | BBEP_SPLIT_BUFFER | BBEP_7COLOR, BBEP_CHIP_UC81xx, u8Colors_spectra}, // EP133_SPECTRA_1200x1600 EL133UF1 (Soldered Inkplate 13 SPECTRA) }; // // Set the e-paper panel type diff --git a/src/bb_epaper.cpp b/src/bb_epaper.cpp index acb2292..9ae5f48 100644 --- a/src/bb_epaper.cpp +++ b/src/bb_epaper.cpp @@ -240,6 +240,34 @@ int rc = BBEP_ERROR_BAD_PARAMETER; return BBEP_SUCCESS; } break; + case EPD_INKPLATE13SPECTRA: // DC:14 RST:4 BUSY:7 CS_M:42 CS_S:39 MOSI:40 SCK:38 + if (setPanelType(EP133_SPECTRA_1200x1600) == BBEP_SUCCESS) { + // Drain the panel's capacitors by holding all of its pins low, + // otherwise it sometimes refuses to refresh + { + const uint8_t u8Pins[8] = {14, 42, 39, 4, 7, 21, 6, 5}; + for (int i = 0; i < 8; i++) { + pinMode(u8Pins[i], OUTPUT); + digitalWrite(u8Pins[i], LOW); + } + } + delay(50); + digitalWrite(6, HIGH); // BS0 high + digitalWrite(14, HIGH); // D/C starts high; library will toggle it per command + digitalWrite(21, HIGH); // EPD power enable + delay(100); // give the panel power time to stabilize + // Both CS pins must be set before initIO() because it sends the init + // sequence to both controllers of this dual-controller panel + _bbep.iCS1Pin = 42; + _bbep.iCS2Pin = 39; + digitalWrite(39, HIGH); // de-select the second controller + initIO(14, 4, 7, 42, 40, 38, 10000000); + pinMode(7, INPUT_PULLUP); // BUSYN was driven low during the drain step + setRotation(270); + return BBEP_SUCCESS; + } + break; + case EPD_TRMNL_OG: // DC:5 CS:6 RST:10 BUSY:4 MOSI:8 SCK:7 if (setPanelType(EP75_800x480) == BBEP_SUCCESS) { initIO(5, 10, 4, 6, 8, 7, 10000000); diff --git a/src/bb_epaper.h b/src/bb_epaper.h index 9821d5e..73ff816 100644 --- a/src/bb_epaper.h +++ b/src/bb_epaper.h @@ -187,6 +187,7 @@ enum { EPD_M5_PAPER_COLOR, // 4" 600x400 Spectra6 EPD_SEEED_STICKY, // 3.97" 800x480 B/W EPD_SEEED_STICKY_4GRAY, + EPD_INKPLATE13SPECTRA, EPD_PRODUCT_COUNT }; @@ -268,6 +269,7 @@ enum { EP40_SPECTRA_400x600, // GDEP040E01 Spectra 6 4" 400x600 EP27_176x264, // Badger2350 EP27_176x264_4GRAY, // Badger2350 + EP133_SPECTRA_1200x1600, // EL133UF1 (Soldered Inkplate 13 SPECTRA) Spectra 6, dual controller EP_PANEL_COUNT }; #ifdef FUTURE