Skip to content

Commit 478fd24

Browse files
author
Lisandro
committed
Now its sending the resolution to the display
UC8151D now sets the display resolution TBS
1 parent d53eec3 commit 478fd24

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/drivers/Adafruit_UC8151D.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "Adafruit_EPD.h"
33

44
#define EPD_RAM_BW 0x10
5-
65
#define BUSY_WAIT 500
76

87
/**************************************************************************/
@@ -138,6 +137,7 @@ void Adafruit_UC8151D::powerUp() {
138137
init_code = _epd_init_code;
139138
}
140139
EPD_commandList(init_code);
140+
sendResolution();
141141

142142
if (_epd_lut_code) {
143143
EPD_commandList(_epd_lut_code);
@@ -195,6 +195,22 @@ void Adafruit_UC8151D::setRAMAddress(uint16_t x, uint16_t y) {
195195
(void)y;
196196
}
197197

198+
/**************************************************************************/
199+
/*!
200+
@brief Sends the resolution to the EPD
201+
*/
202+
/**************************************************************************/
203+
void Adafruit_UC8151D::sendResolution() {
204+
const uint8_t uc8151d_resolution_init_code[]{
205+
UC8151D_TRES,
206+
3,
207+
(uint8_t)height(),
208+
(uint8_t)((width() & 0xFF00) >> 8),
209+
(uint8_t)(width() & 0x00FF),
210+
0xFE};
211+
EPD_commandList(uc8151d_resolution_init_code);
212+
}
213+
198214
/**************************************************************************/
199215
/*!
200216
@brief Transfer the data stored in the buffer(s) to the display

src/drivers/Adafruit_UC8151D.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define UC8151D_PBC 0x44
2727
#define UC8151D_CDI 0x50
2828
#define UC8151D_LPD 0x51
29-
#define UC8151D_TRES 0x65
29+
#define UC8151D_TRES 0x61
3030
#define UC8151D_GSST 0x70
3131
#define UC8151D_REV 0x70
3232
#define UC8151D_FLG 0x71
@@ -57,7 +57,6 @@ const uint8_t uc8151d_trifull_init_code[] {
5757
UC8151D_PON, 0,
5858
0xFF, 10,
5959
UC8151D_PSR, 2, 0x0F, 0x89,
60-
0x61, 3, 0x80, 0x01, 0x28,
6160
UC8151D_CDI, 1, 0x77,
6261
0xFE};
6362

@@ -69,7 +68,6 @@ const uint8_t uc8151d_partial_init_code[] {
6968
0xFF, 10,
7069
UC8151D_PSR, 1, 0xBF, //LUT from OTP 128x296
7170
UC8151D_PLL, 1, 0x3C, // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
72-
0x61, 3, 0x80, 0x01, 0x28, //resolution setting
7371
UC8151D_VDCS, 1, 0x12, //vcom_DC setting
7472
UC8151D_CDI, 1, 0x47,
7573
0xFE};
@@ -145,13 +143,13 @@ class Adafruit_UC8151D : public Adafruit_EPD {
145143
void powerUp();
146144
void powerDown();
147145
void update();
148-
149146
void displayPartial(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
150147

151148
protected:
152149
uint8_t writeRAMCommand(uint8_t index);
153150
void setRAMAddress(uint16_t x, uint16_t y);
154151
void busy_wait();
152+
void sendResolution();
155153
};
156154

157155
#endif

0 commit comments

Comments
 (0)