diff --git a/src/drivers/Adafruit_UC8151D.cpp b/src/drivers/Adafruit_UC8151D.cpp index 3272c89..f34d4a4 100644 --- a/src/drivers/Adafruit_UC8151D.cpp +++ b/src/drivers/Adafruit_UC8151D.cpp @@ -2,7 +2,6 @@ #include "Adafruit_EPD.h" #define EPD_RAM_BW 0x10 - #define BUSY_WAIT 500 /**************************************************************************/ @@ -138,6 +137,7 @@ void Adafruit_UC8151D::powerUp() { init_code = _epd_init_code; } EPD_commandList(init_code); + sendResolution(); if (_epd_lut_code) { EPD_commandList(_epd_lut_code); @@ -195,6 +195,22 @@ void Adafruit_UC8151D::setRAMAddress(uint16_t x, uint16_t y) { (void)y; } +/**************************************************************************/ +/*! + @brief Sends the resolution to the EPD +*/ +/**************************************************************************/ +void Adafruit_UC8151D::sendResolution() { + const uint8_t uc8151d_resolution_init_code[]{ + UC8151D_TRES, + 3, + (uint8_t)height(), + (uint8_t)((width() & 0xFF00) >> 8), + (uint8_t)(width() & 0x00FF), + 0xFE}; + EPD_commandList(uc8151d_resolution_init_code); +} + /**************************************************************************/ /*! @brief Transfer the data stored in the buffer(s) to the display diff --git a/src/drivers/Adafruit_UC8151D.h b/src/drivers/Adafruit_UC8151D.h index ac097f4..567f7ca 100644 --- a/src/drivers/Adafruit_UC8151D.h +++ b/src/drivers/Adafruit_UC8151D.h @@ -26,7 +26,7 @@ #define UC8151D_PBC 0x44 #define UC8151D_CDI 0x50 #define UC8151D_LPD 0x51 -#define UC8151D_TRES 0x65 +#define UC8151D_TRES 0x61 #define UC8151D_GSST 0x70 #define UC8151D_REV 0x70 #define UC8151D_FLG 0x71 @@ -57,7 +57,6 @@ const uint8_t uc8151d_trifull_init_code[] { UC8151D_PON, 0, 0xFF, 10, UC8151D_PSR, 2, 0x0F, 0x89, - 0x61, 3, 0x80, 0x01, 0x28, UC8151D_CDI, 1, 0x77, 0xFE}; @@ -69,7 +68,6 @@ const uint8_t uc8151d_partial_init_code[] { 0xFF, 10, UC8151D_PSR, 1, 0xBF, //LUT from OTP 128x296 UC8151D_PLL, 1, 0x3C, // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ - 0x61, 3, 0x80, 0x01, 0x28, //resolution setting UC8151D_VDCS, 1, 0x12, //vcom_DC setting UC8151D_CDI, 1, 0x47, 0xFE}; @@ -145,13 +143,13 @@ class Adafruit_UC8151D : public Adafruit_EPD { void powerUp(); void powerDown(); void update(); - void displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); protected: uint8_t writeRAMCommand(uint8_t index); void setRAMAddress(uint16_t x, uint16_t y); void busy_wait(); + void sendResolution(); }; #endif