diff --git a/src/Adafruit_EPD.cpp b/src/Adafruit_EPD.cpp index 325f863..7458c15 100644 --- a/src/Adafruit_EPD.cpp +++ b/src/Adafruit_EPD.cpp @@ -226,7 +226,7 @@ void Adafruit_EPD::drawPixel(int16_t x, int16_t y, uint16_t color) { return; uint8_t *black_pBuf, *color_pBuf; - //Serial.printf("(%d, %d) -> ", x, y); + // Serial.printf("(%d, %d) -> ", x, y); // check rotation, move pixel around if necessary switch (getRotation()) { @@ -249,16 +249,16 @@ void Adafruit_EPD::drawPixel(int16_t x, int16_t y, uint16_t color) { if (_HEIGHT % 8 != 0) { _HEIGHT += 8 - (_HEIGHT % 8); } - //Serial.printf("(%d, %d) : ", x, y); + // Serial.printf("(%d, %d) : ", x, y); uint16_t addr; if (_data_entry_mode == THINKING_UC8179) { addr = ((uint32_t)(HEIGHT - 1 - y) * (uint32_t)WIDTH + x) / 8; } else { // THINKINK_STANDARD default! - addr = ((uint32_t)(WIDTH - 1 - x) * (uint32_t)_HEIGHT + y) / 8; + addr = ((uint32_t)(WIDTH - 1 - x) * (uint32_t)_HEIGHT + y) / 8; } uint8_t black_c, color_c; - //Serial.printf("0x%0x\n\r",addr); + // Serial.printf("0x%0x\n\r",addr); if (use_sram) { black_c = sram.read8(blackbuffer_addr + addr); diff --git a/src/Adafruit_ThinkInk.h b/src/Adafruit_ThinkInk.h index 66a2be5..8cb388d 100644 --- a/src/Adafruit_ThinkInk.h +++ b/src/Adafruit_ThinkInk.h @@ -26,8 +26,8 @@ #include "panels/ThinkInk_270_Grayscale4_W3.h" #include "panels/ThinkInk_270_Tricolor_C44.h" #include "panels/ThinkInk_270_Tricolor_Z70.h" -#include "panels/ThinkInk_290_Grayscale4_T5.h" #include "panels/ThinkInk_290_Grayscale4_EAAMFGN.h" +#include "panels/ThinkInk_290_Grayscale4_T5.h" #include "panels/ThinkInk_290_Mono_BN.h" #include "panels/ThinkInk_290_Mono_M06.h" #include "panels/ThinkInk_290_Tricolor_RH.h" @@ -36,13 +36,13 @@ #include "panels/ThinkInk_290_Tricolor_Z94.h" #include "panels/ThinkInk_370_Mono_BAAMFGN.h" #include "panels/ThinkInk_370_Tricolor_BABMFGNR.h" +#include "panels/ThinkInk_420_Grayscale4_MFGN.h" #include "panels/ThinkInk_420_Grayscale4_T2.h" #include "panels/ThinkInk_420_Mono_BN.h" #include "panels/ThinkInk_420_Mono_M06.h" -#include "panels/ThinkInk_420_Grayscale4_MFGN.h" +#include "panels/ThinkInk_420_Tricolor_MFGNR.h" #include "panels/ThinkInk_420_Tricolor_RW.h" #include "panels/ThinkInk_420_Tricolor_Z21.h" -#include "panels/ThinkInk_420_Tricolor_MFGNR.h" #include "panels/ThinkInk_583_Mono_AAAMFGN.h" #include "panels/ThinkInk_583_Tricolor_AABMFGNR.h" #include "panels/ThinkInk_750_Tricolor_AABMFGNR.h" diff --git a/src/drivers/Adafruit_SSD1683.h b/src/drivers/Adafruit_SSD1683.h index 5952b92..9d1b683 100644 --- a/src/drivers/Adafruit_SSD1683.h +++ b/src/drivers/Adafruit_SSD1683.h @@ -28,7 +28,7 @@ #define SSD1683_DISP_CTRL2 0x22 #define SSD1683_WRITE_RAM1 0x24 #define SSD1683_WRITE_RAM2 0x26 -#define SSD1683_READ_RAM1 0x27 +#define SSD1683_READ_RAM1 0x27 #define SSD1683_SENSE_VCOM 0x28 #define SSD1683_SENSEDUR_VCOM 0x29 #define SSD1683_PROGOTP_VCOM 0x2A diff --git a/src/drivers/Adafruit_UC8151D.cpp b/src/drivers/Adafruit_UC8151D.cpp index 3d4cc4a..ac742d4 100644 --- a/src/drivers/Adafruit_UC8151D.cpp +++ b/src/drivers/Adafruit_UC8151D.cpp @@ -263,7 +263,7 @@ void Adafruit_UC8151D::displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, buf[2] = y1 >> 8; buf[3] = y1 & 0xFF; buf[4] = (y2) >> 8; - buf[5] = (y2) & 0xFF; + buf[5] = (y2)&0xFF; buf[6] = 0x28; EPD_command(UC8151D_PTL, buf, 7); // resolution setting diff --git a/src/drivers/Adafruit_UC8179.cpp b/src/drivers/Adafruit_UC8179.cpp index 3c0fa2d..a1b8c3a 100644 --- a/src/drivers/Adafruit_UC8179.cpp +++ b/src/drivers/Adafruit_UC8179.cpp @@ -174,13 +174,13 @@ void Adafruit_UC8179::powerUp() { init_code = _epd_init_code; } EPD_commandList(init_code); - + // Set display size uint8_t buf[4]; buf[0] = WIDTH >> 8; buf[1] = WIDTH & 0xFF; buf[2] = HEIGHT >> 8; - buf[3] = HEIGHT & 0xFF; + buf[3] = HEIGHT & 0xFF; Serial.printf("W %d H %d\n\r", WIDTH, HEIGHT); EPD_command(UC8179_TRES, buf, 4); } diff --git a/src/panels/ThinkInk_290_Grayscale4_EAAMFGN.h b/src/panels/ThinkInk_290_Grayscale4_EAAMFGN.h index 7bd5744..c642be7 100644 --- a/src/panels/ThinkInk_290_Grayscale4_EAAMFGN.h +++ b/src/panels/ThinkInk_290_Grayscale4_EAAMFGN.h @@ -97,15 +97,15 @@ static const uint8_t ti_290mfgn_gray4_lut_code[] = { class ThinkInk_290_Grayscale4_EAAMFGN : public Adafruit_SSD1680 { public: - ThinkInk_290_Grayscale4_EAAMFGN(int16_t SID, int16_t SCLK, int16_t DC, - int16_t RST, int16_t CS, int16_t SRCS, - int16_t MISO, int16_t BUSY = -1) - : Adafruit_SSD1680(296, 128, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - - ThinkInk_290_Grayscale4_EAAMFGN(int16_t DC, int16_t RST, int16_t CS, - int16_t SRCS, int16_t BUSY = -1, - SPIClass* spi = &SPI) - : Adafruit_SSD1680(296, 128, DC, RST, CS, SRCS, BUSY, spi){}; + ThinkInk_290_Grayscale4_EAAMFGN(int16_t SID, int16_t SCLK, int16_t DC, + int16_t RST, int16_t CS, int16_t SRCS, + int16_t MISO, int16_t BUSY = -1) + : Adafruit_SSD1680(296, 128, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; + + ThinkInk_290_Grayscale4_EAAMFGN(int16_t DC, int16_t RST, int16_t CS, + int16_t SRCS, int16_t BUSY = -1, + SPIClass* spi = &SPI) + : Adafruit_SSD1680(296, 128, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_GRAYSCALE4) { Adafruit_SSD1680::begin(true); diff --git a/src/panels/ThinkInk_370_Mono_BAAMFGN.h b/src/panels/ThinkInk_370_Mono_BAAMFGN.h index cb582fa..cda7b41 100644 --- a/src/panels/ThinkInk_370_Mono_BAAMFGN.h +++ b/src/panels/ThinkInk_370_Mono_BAAMFGN.h @@ -4,23 +4,28 @@ // This file is #included by Adafruit_ThinkInk.h and does not need to // #include anything else to pick up the EPD header or ink mode enum. -const uint8_t uc8253_mono_init_code[] { - UC8253_POWERON, 0, // soft reset - 0xFF, 50, // busy wait - UC8253_VCOM_CDI, 1, 0x97, - UC8253_PANELSETTING, 2, 0b11011111, 0x8D, - 0xFE}; +const uint8_t uc8253_mono_init_code[]{UC8253_POWERON, + 0, // soft reset + 0xFF, + 50, // busy wait + UC8253_VCOM_CDI, + 1, + 0x97, + UC8253_PANELSETTING, + 2, + 0b11011111, + 0x8D, + 0xFE}; class ThinkInk_370_Mono_BAAMFGN : public Adafruit_UC8253 { public: - ThinkInk_370_Mono_BAAMFGN(int16_t SID, int16_t SCLK, int16_t DC, - int16_t RST, int16_t CS, int16_t SRCS, - int16_t MISO, int16_t BUSY = -1) - : Adafruit_UC8253(416, 240, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; + ThinkInk_370_Mono_BAAMFGN(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, + int16_t CS, int16_t SRCS, int16_t MISO, + int16_t BUSY = -1) + : Adafruit_UC8253(416, 240, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - ThinkInk_370_Mono_BAAMFGN(int16_t DC, int16_t RST, int16_t CS, - int16_t SRCS, int16_t BUSY = -1, - SPIClass* spi = &SPI) + ThinkInk_370_Mono_BAAMFGN(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, + int16_t BUSY = -1, SPIClass* spi = &SPI) : Adafruit_UC8253(416, 240, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_MONO) { diff --git a/src/panels/ThinkInk_370_Tricolor_BABMFGNR.h b/src/panels/ThinkInk_370_Tricolor_BABMFGNR.h index 2896261..8bb0183 100644 --- a/src/panels/ThinkInk_370_Tricolor_BABMFGNR.h +++ b/src/panels/ThinkInk_370_Tricolor_BABMFGNR.h @@ -4,21 +4,25 @@ // This file is #included by Adafruit_ThinkInk.h and does not need to // #include anything else to pick up the EPD header or ink mode enum. -const uint8_t uc8253_tricolor_init_code[] { - UC8253_POWERON, 0, // soft reset - 0xFF, 50, // busy wait - UC8253_PANELSETTING, 2, 0b11001111, 0x8D, - 0xFE}; +const uint8_t uc8253_tricolor_init_code[]{UC8253_POWERON, + 0, // soft reset + 0xFF, + 50, // busy wait + UC8253_PANELSETTING, + 2, + 0b11001111, + 0x8D, + 0xFE}; class ThinkInk_370_Tricolor_BABMFGNR : public Adafruit_UC8253 { public: - ThinkInk_370_Tricolor_BABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, - int16_t RST, int16_t CS, int16_t SRCS, + ThinkInk_370_Tricolor_BABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, + int16_t RST, int16_t CS, int16_t SRCS, int16_t MISO, int16_t BUSY = -1) - : Adafruit_UC8253(416, 240, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; + : Adafruit_UC8253(416, 240, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - ThinkInk_370_Tricolor_BABMFGNR(int16_t DC, int16_t RST, int16_t CS, - int16_t SRCS, int16_t BUSY = -1, + ThinkInk_370_Tricolor_BABMFGNR(int16_t DC, int16_t RST, int16_t CS, + int16_t SRCS, int16_t BUSY = -1, SPIClass* spi = &SPI) : Adafruit_UC8253(416, 240, DC, RST, CS, SRCS, BUSY, spi){}; diff --git a/src/panels/ThinkInk_420_Grayscale4_MFGN.h b/src/panels/ThinkInk_420_Grayscale4_MFGN.h index 3249c2c..a3d3585 100644 --- a/src/panels/ThinkInk_420_Grayscale4_MFGN.h +++ b/src/panels/ThinkInk_420_Grayscale4_MFGN.h @@ -4,99 +4,108 @@ // This file is #included by Adafruit_ThinkInk.h and does not need to // #include anything else to pick up the EPD header or ink mode enum. -static const uint8_t ti_420mfgn_monofull_init_code[] { - SSD1683_SW_RESET, 0, // 0x12 - Software reset - 0xFF, 50, // Wait for busy (20ms delay) - - SSD1683_DISP_CTRL1, 2, // 0x21 - Display update control - 0x40, // Display update control 1 - 0x00, // Display update control 2 - - SSD1683_WRITE_BORDER, 1, // 0x3C - Border waveform control - 0x05, // Border color/waveform - - SSD1683_DATA_MODE, 1, // 0x11 - Data entry mode - 0x03, // Y decrement, X increment - - 0xFE // End of initialization +static const uint8_t ti_420mfgn_monofull_init_code[]{ + SSD1683_SW_RESET, + 0, // 0x12 - Software reset + 0xFF, + 50, // Wait for busy (20ms delay) + + SSD1683_DISP_CTRL1, + 2, // 0x21 - Display update control + 0x40, // Display update control 1 + 0x00, // Display update control 2 + + SSD1683_WRITE_BORDER, + 1, // 0x3C - Border waveform control + 0x05, // Border color/waveform + + SSD1683_DATA_MODE, + 1, // 0x11 - Data entry mode + 0x03, // Y decrement, X increment + + 0xFE // End of initialization }; -static const uint8_t ti_420mfgn_gray4_init_code[] { - SSD1683_SW_RESET, 0, // 0x12 - Software reset - 0xFF, 50, // Wait for busy (20ms delay) +static const uint8_t ti_420mfgn_gray4_init_code[]{ + SSD1683_SW_RESET, + 0, // 0x12 - Software reset + 0xFF, + 50, // Wait for busy (20ms delay) - SSD1683_DISP_CTRL1, 2, // 0x21 - Display update control - 0x00, // Display update control 1 - 0x00, // Display update control 2 + SSD1683_DISP_CTRL1, + 2, // 0x21 - Display update control + 0x00, // Display update control 1 + 0x00, // Display update control 2 - SSD1683_WRITE_BORDER, 1, // 0x3C - Border waveform control - 0x03, // Border color/waveform + SSD1683_WRITE_BORDER, + 1, // 0x3C - Border waveform control + 0x03, // Border color/waveform - SSD1683_BOOST_SOFTSTART, 4, - 0x8B, 0x9C, 0xA4, 0x0F, - - SSD1683_DATA_MODE, 1, // 0x11 - Data entry mode - 0x03, // Y decrement, X increment - - SSD1683_END_OPTION, 1, 0x07, // LUT[227] - SSD1683_GATE_VOLTAGE, 1, 0x17, - SSD1683_SOURCE_VOLTAGE, 3, 0x41, 0xA8, 0x32, // LUT[229~231] - SSD1683_WRITE_VCOM, 1, 0x30, // LUT[232] - 0xFE // End of initialization + SSD1683_BOOST_SOFTSTART, + 4, + 0x8B, + 0x9C, + 0xA4, + 0x0F, + + SSD1683_DATA_MODE, + 1, // 0x11 - Data entry mode + 0x03, // Y decrement, X increment + + SSD1683_END_OPTION, + 1, + 0x07, // LUT[227] + SSD1683_GATE_VOLTAGE, + 1, + 0x17, + SSD1683_SOURCE_VOLTAGE, + 3, + 0x41, + 0xA8, + 0x32, // LUT[229~231] + SSD1683_WRITE_VCOM, + 1, + 0x30, // LUT[232] + 0xFE // End of initialization }; static const uint8_t ti_420mfgn_gray4_lut_code[] = { - 0x32, 227, - 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, - 0x05, 0x0A, 0x01, 0x0A, 0x01, 0x01, 0x01, - 0x05, 0x08, 0x03, 0x02, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x03, 0x82, 0x84, 0x01, 0x01, - 0x01, 0x84, 0x84, 0x82, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x0A, 0x1B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x83, 0x82, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x8A, 0x1B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x83, 0x02, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x8A, 0x9B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x03, 0x42, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x42, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, - 0xFE // EOM + 0x32, 227, 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, 0x05, 0x0A, 0x01, + 0x0A, 0x01, 0x01, 0x01, 0x05, 0x08, 0x03, 0x02, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x0A, 0x1B, 0x0F, + 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, + 0x03, 0x82, 0x84, 0x01, 0x01, 0x01, 0x84, 0x84, 0x82, 0x00, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x0A, 0x1B, 0x8F, 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, + 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, 0x83, 0x82, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x8A, 0x1B, 0x8F, + 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, + 0x83, 0x02, 0x04, 0x01, 0x01, 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x8A, 0x9B, 0x8F, 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, + 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, 0x03, 0x42, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x42, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, + 0xFE // EOM }; - class ThinkInk_420_Grayscale4_MFGN : public Adafruit_SSD1683 { public: - ThinkInk_420_Grayscale4_MFGN(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, - int16_t CS, int16_t SRCS, int16_t MISO, - int16_t BUSY = -1) + ThinkInk_420_Grayscale4_MFGN(int16_t SID, int16_t SCLK, int16_t DC, + int16_t RST, int16_t CS, int16_t SRCS, + int16_t MISO, int16_t BUSY = -1) : Adafruit_SSD1683(300, 400, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - ThinkInk_420_Grayscale4_MFGN(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, - int16_t BUSY = -1, SPIClass* spi = &SPI) + ThinkInk_420_Grayscale4_MFGN(int16_t DC, int16_t RST, int16_t CS, + int16_t SRCS, int16_t BUSY = -1, + SPIClass* spi = &SPI) : Adafruit_SSD1683(300, 400, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_MONO) { - Adafruit_SSD1683::begin(true); inkmode = mode; // Preserve ink mode for ImageReader or others @@ -105,7 +114,7 @@ class ThinkInk_420_Grayscale4_MFGN : public Adafruit_SSD1683 { setBlackBuffer(0, true); // layer 1 uninverted _epd_init_code = ti_420mfgn_gray4_init_code; - _epd_lut_code = ti_420mfgn_gray4_lut_code; + _epd_lut_code = ti_420mfgn_gray4_lut_code; layer_colors[EPD_WHITE] = 0b00; layer_colors[EPD_BLACK] = 0b11; @@ -127,8 +136,8 @@ class ThinkInk_420_Grayscale4_MFGN : public Adafruit_SSD1683 { layer_colors[EPD_GRAY] = 0b01; layer_colors[EPD_LIGHT] = 0b00; layer_colors[EPD_DARK] = 0b01; - - _display_update_val = 0xF7; + + _display_update_val = 0xF7; } setRotation(1); default_refresh_delay = 1000; diff --git a/src/panels/ThinkInk_420_Tricolor_MFGNR.h b/src/panels/ThinkInk_420_Tricolor_MFGNR.h index c4a0843..2c499d0 100644 --- a/src/panels/ThinkInk_420_Tricolor_MFGNR.h +++ b/src/panels/ThinkInk_420_Tricolor_MFGNR.h @@ -4,97 +4,106 @@ // This file is #included by Adafruit_ThinkInk.h and does not need to // #include anything else to pick up the EPD header or ink mode enum. -static const uint8_t ti_420mfgnr_tri_init_code[] { - SSD1683_SW_RESET, 0, // 0x12 - Software reset - 0xFF, 50, // Wait for busy (20ms delay) +static const uint8_t ti_420mfgnr_tri_init_code[]{ + SSD1683_SW_RESET, + 0, // 0x12 - Software reset + 0xFF, + 50, // Wait for busy (20ms delay) - SSD1683_WRITE_BORDER, 1, // 0x3C - Border waveform control - 0x05, // Border color/waveform + SSD1683_WRITE_BORDER, + 1, // 0x3C - Border waveform control + 0x05, // Border color/waveform - SSD1683_TEMP_CONTROL, 1, 0x80, // 0x18 read temp - - SSD1683_DATA_MODE, 1, // 0x11 - Data entry mode - 0x03, // Y decrement, X increment + SSD1683_TEMP_CONTROL, + 1, + 0x80, // 0x18 read temp - 0xFE // End of initialization + SSD1683_DATA_MODE, + 1, // 0x11 - Data entry mode + 0x03, // Y decrement, X increment + + 0xFE // End of initialization }; -static const uint8_t ti_420mfgnr_gray4_init_code[] { - SSD1683_SW_RESET, 0, // 0x12 - Software reset - 0xFF, 50, // Wait for busy (20ms delay) +static const uint8_t ti_420mfgnr_gray4_init_code[]{ + SSD1683_SW_RESET, + 0, // 0x12 - Software reset + 0xFF, + 50, // Wait for busy (20ms delay) - SSD1683_DISP_CTRL1, 2, // 0x21 - Display update control - 0x00, // Display update control 1 - 0x00, // Display update control 2 + SSD1683_DISP_CTRL1, + 2, // 0x21 - Display update control + 0x00, // Display update control 1 + 0x00, // Display update control 2 - SSD1683_WRITE_BORDER, 1, // 0x3C - Border waveform control - 0x03, // Border color/waveform + SSD1683_WRITE_BORDER, + 1, // 0x3C - Border waveform control + 0x03, // Border color/waveform - SSD1683_BOOST_SOFTSTART, 4, - 0x8B, 0x9C, 0xA4, 0x0F, - - SSD1683_DATA_MODE, 1, // 0x11 - Data entry mode - 0x03, // Y decrement, X increment - - SSD1683_END_OPTION, 1, 0x07, // LUT[227] - SSD1683_GATE_VOLTAGE, 1, 0x17, - SSD1683_SOURCE_VOLTAGE, 3, 0x41, 0xA8, 0x32, // LUT[229~231] - SSD1683_WRITE_VCOM, 1, 0x30, // LUT[232] - 0xFE // End of initialization + SSD1683_BOOST_SOFTSTART, + 4, + 0x8B, + 0x9C, + 0xA4, + 0x0F, + + SSD1683_DATA_MODE, + 1, // 0x11 - Data entry mode + 0x03, // Y decrement, X increment + + SSD1683_END_OPTION, + 1, + 0x07, // LUT[227] + SSD1683_GATE_VOLTAGE, + 1, + 0x17, + SSD1683_SOURCE_VOLTAGE, + 3, + 0x41, + 0xA8, + 0x32, // LUT[229~231] + SSD1683_WRITE_VCOM, + 1, + 0x30, // LUT[232] + 0xFE // End of initialization }; static const uint8_t ti_420mfgnr_gray4_lut_code[] = { - 0x32, 227, - 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, - 0x05, 0x0A, 0x01, 0x0A, 0x01, 0x01, 0x01, - 0x05, 0x08, 0x03, 0x02, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x03, 0x82, 0x84, 0x01, 0x01, - 0x01, 0x84, 0x84, 0x82, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x0A, 0x1B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x83, 0x82, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x8A, 0x1B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x83, 0x02, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x8A, 0x9B, 0x8F, 0x03, 0x01, 0x01, - 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, - 0x05, 0x48, 0x03, 0x42, 0x04, 0x01, 0x01, - 0x01, 0x04, 0x04, 0x42, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, - 0xFE // EOM + 0x32, 227, 0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, 0x05, 0x0A, 0x01, + 0x0A, 0x01, 0x01, 0x01, 0x05, 0x08, 0x03, 0x02, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x0A, 0x1B, 0x0F, + 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, + 0x03, 0x82, 0x84, 0x01, 0x01, 0x01, 0x84, 0x84, 0x82, 0x00, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x0A, 0x1B, 0x8F, 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, + 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, 0x83, 0x82, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x8A, 0x1B, 0x8F, + 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, + 0x83, 0x02, 0x04, 0x01, 0x01, 0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x01, 0x8A, 0x9B, 0x8F, 0x03, 0x01, 0x01, 0x05, 0x4A, 0x01, + 0x8A, 0x01, 0x01, 0x01, 0x05, 0x48, 0x03, 0x42, 0x04, 0x01, 0x01, 0x01, + 0x04, 0x04, 0x42, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, + 0xFE // EOM }; - class ThinkInk_420_Mono_MFGNR : public Adafruit_SSD1683 { public: ThinkInk_420_Mono_MFGNR(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, - int16_t CS, int16_t SRCS, int16_t MISO, - int16_t BUSY = -1) + int16_t CS, int16_t SRCS, int16_t MISO, + int16_t BUSY = -1) : Adafruit_SSD1683(300, 400, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; ThinkInk_420_Mono_MFGNR(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, - int16_t BUSY = -1, SPIClass* spi = &SPI) + int16_t BUSY = -1, SPIClass* spi = &SPI) : Adafruit_SSD1683(300, 400, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_TRICOLOR) { - Adafruit_SSD1683::begin(true); inkmode = mode; // Preserve ink mode for ImageReader or others @@ -103,7 +112,7 @@ class ThinkInk_420_Mono_MFGNR : public Adafruit_SSD1683 { setBlackBuffer(0, true); // layer 1 uninverted _epd_init_code = ti_420mfgnr_gray4_init_code; - _epd_lut_code = ti_420mfgnr_gray4_lut_code; + _epd_lut_code = ti_420mfgnr_gray4_lut_code; layer_colors[EPD_WHITE] = 0b00; layer_colors[EPD_BLACK] = 0b11; @@ -117,8 +126,8 @@ class ThinkInk_420_Mono_MFGNR : public Adafruit_SSD1683 { } else if (mode == THINKINK_TRICOLOR) { setBlackBuffer(0, true); setColorBuffer(1, false); - - _epd_init_code = ti_420mfgnr_tri_init_code; + + _epd_init_code = ti_420mfgnr_tri_init_code; layer_colors[EPD_WHITE] = 0b00; layer_colors[EPD_BLACK] = 0b01; @@ -126,8 +135,8 @@ class ThinkInk_420_Mono_MFGNR : public Adafruit_SSD1683 { layer_colors[EPD_GRAY] = 0b10; layer_colors[EPD_LIGHT] = 0b00; layer_colors[EPD_DARK] = 0b01; - - _display_update_val = 0xF7; + + _display_update_val = 0xF7; default_refresh_delay = 13000; } setRotation(1); diff --git a/src/panels/ThinkInk_583_Mono_AAAMFGN.h b/src/panels/ThinkInk_583_Mono_AAAMFGN.h index 8d2a8d7..82ec5dc 100644 --- a/src/panels/ThinkInk_583_Mono_AAAMFGN.h +++ b/src/panels/ThinkInk_583_Mono_AAAMFGN.h @@ -3,40 +3,53 @@ #include "Adafruit_EPD.h" -const uint8_t uc8179_mono_init_code[] { - UC8179_POWERSETTING, 4, - 0x07, // VGH=20V - 0x07, // VGL=-20V - 0x3F, // VDH=15V - 0x3F, // VDL=-15V +const uint8_t uc8179_mono_init_code[]{UC8179_POWERSETTING, + 4, + 0x07, // VGH=20V + 0x07, // VGL=-20V + 0x3F, // VDH=15V + 0x3F, // VDL=-15V - UC8179_POWERON, 0, - 0xFF, 100, // busy wait - - UC8179_PANELSETTING, 1, - 0b010111, // BW OTP LUT + UC8179_POWERON, + 0, + 0xFF, + 100, // busy wait - UC8179_TRES, 4, - 0x02, 0x88, 0x01, 0xE0, - - UC8179_DUALSPI, 1, 0x00, + UC8179_PANELSETTING, + 1, + 0b010111, // BW OTP LUT - UC8179_WRITE_VCOM, 2, 0x10, 0x07, - UC8179_TCON, 1, 0x22, + UC8179_TRES, + 4, + 0x02, + 0x88, + 0x01, + 0xE0, - 0xFE}; + UC8179_DUALSPI, + 1, + 0x00, + UC8179_WRITE_VCOM, + 2, + 0x10, + 0x07, + UC8179_TCON, + 1, + 0x22, + + 0xFE}; class ThinkInk_583_Mono_AAAMFGN : public Adafruit_UC8179 { private: public: ThinkInk_583_Mono_AAAMFGN(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, - int16_t CS, int16_t SRCS, int16_t MISO, - int16_t BUSY = -1) + int16_t CS, int16_t SRCS, int16_t MISO, + int16_t BUSY = -1) : Adafruit_UC8179(648, 480, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; ThinkInk_583_Mono_AAAMFGN(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, - int16_t BUSY = -1, SPIClass* spi = &SPI) + int16_t BUSY = -1, SPIClass* spi = &SPI) : Adafruit_UC8179(648, 480, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_MONO) { diff --git a/src/panels/ThinkInk_583_Tricolor_AABMFGNR.h b/src/panels/ThinkInk_583_Tricolor_AABMFGNR.h index d51d4cc..11b70b8 100644 --- a/src/panels/ThinkInk_583_Tricolor_AABMFGNR.h +++ b/src/panels/ThinkInk_583_Tricolor_AABMFGNR.h @@ -30,17 +30,17 @@ const uint8_t uc8179_tricolor_init_code[] { // clang-format on - class ThinkInk_583_Tricolor_AABMFGNR : public Adafruit_UC8179 { private: public: - ThinkInk_583_Tricolor_AABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, - int16_t CS, int16_t SRCS, int16_t MISO, - int16_t BUSY = -1) + ThinkInk_583_Tricolor_AABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, + int16_t RST, int16_t CS, int16_t SRCS, + int16_t MISO, int16_t BUSY = -1) : Adafruit_UC8179(648, 480, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - ThinkInk_583_Tricolor_AABMFGNR(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, - int16_t BUSY = -1, SPIClass* spi = &SPI) + ThinkInk_583_Tricolor_AABMFGNR(int16_t DC, int16_t RST, int16_t CS, + int16_t SRCS, int16_t BUSY = -1, + SPIClass* spi = &SPI) : Adafruit_UC8179(648, 480, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_TRICOLOR) { diff --git a/src/panels/ThinkInk_750_Tricolor_AABMFGNR.h b/src/panels/ThinkInk_750_Tricolor_AABMFGNR.h index 2369136..0502617 100644 --- a/src/panels/ThinkInk_750_Tricolor_AABMFGNR.h +++ b/src/panels/ThinkInk_750_Tricolor_AABMFGNR.h @@ -30,17 +30,17 @@ const uint8_t uc8179_750_tricolor_init_code[] { // clang-format on - class ThinkInk_750_Tricolor_AABMFGNR : public Adafruit_UC8179 { private: public: - ThinkInk_750_Tricolor_AABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST, - int16_t CS, int16_t SRCS, int16_t MISO, - int16_t BUSY = -1) + ThinkInk_750_Tricolor_AABMFGNR(int16_t SID, int16_t SCLK, int16_t DC, + int16_t RST, int16_t CS, int16_t SRCS, + int16_t MISO, int16_t BUSY = -1) : Adafruit_UC8179(800, 480, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){}; - ThinkInk_750_Tricolor_AABMFGNR(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS, - int16_t BUSY = -1, SPIClass* spi = &SPI) + ThinkInk_750_Tricolor_AABMFGNR(int16_t DC, int16_t RST, int16_t CS, + int16_t SRCS, int16_t BUSY = -1, + SPIClass* spi = &SPI) : Adafruit_UC8179(800, 480, DC, RST, CS, SRCS, BUSY, spi){}; void begin(thinkinkmode_t mode = THINKINK_TRICOLOR) {