2
2
#include " Adafruit_EPD.h"
3
3
4
4
#define EPD_RAM_BW 0x10
5
-
6
5
#define BUSY_WAIT 500
7
6
8
7
/* *************************************************************************/
@@ -26,6 +25,9 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int16_t SID,
26
25
int16_t BUSY)
27
26
: Adafruit_EPD(width, height, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY) {
28
27
28
+ horizontalResolution = width;
29
+ verticalResolution = height;
30
+
29
31
if ((width % 8 ) != 0 ) {
30
32
width += 8 - (width % 8 );
31
33
}
@@ -62,6 +64,9 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int16_t DC,
62
64
int16_t BUSY, SPIClass *spi)
63
65
: Adafruit_EPD(width, height, DC, RST, CS, SRCS, BUSY, spi) {
64
66
67
+ horizontalResolution = width;
68
+ verticalResolution = height;
69
+
65
70
if ((height % 8 ) != 0 ) {
66
71
height += 8 - (height % 8 );
67
72
}
@@ -138,6 +143,7 @@ void Adafruit_UC8151D::powerUp() {
138
143
init_code = _epd_init_code;
139
144
}
140
145
EPD_commandList (init_code);
146
+ sendResolution ();
141
147
142
148
if (_epd_lut_code) {
143
149
EPD_commandList (_epd_lut_code);
@@ -195,6 +201,22 @@ void Adafruit_UC8151D::setRAMAddress(uint16_t x, uint16_t y) {
195
201
(void )y;
196
202
}
197
203
204
+ /* *************************************************************************/
205
+ /* !
206
+ @brief Sends the resolution to the EPD
207
+ */
208
+ /* *************************************************************************/
209
+ void Adafruit_UC8151D::sendResolution () {
210
+ const uint8_t uc8151d_resolution_init_code[]{
211
+ UC8151D_TRES,
212
+ 3 ,
213
+ verticalResolution,
214
+ (uint8_t )((horizontalResolution & 0xFF00 ) >> 8 ),
215
+ (uint8_t )(horizontalResolution & 0x00FF ),
216
+ 0xFE };
217
+ EPD_commandList (uc8151d_resolution_init_code);
218
+ }
219
+
198
220
/* *************************************************************************/
199
221
/* !
200
222
@brief Transfer the data stored in the buffer(s) to the display
0 commit comments