Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/drivers/Adafruit_UC8151D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "Adafruit_EPD.h"

#define EPD_RAM_BW 0x10

#define BUSY_WAIT 500

/**************************************************************************/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/drivers/Adafruit_UC8151D.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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};

Expand All @@ -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};
Expand Down Expand Up @@ -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