22#include " Adafruit_EPD.h"
33
44#define EPD_RAM_BW 0x10
5-
65#define BUSY_WAIT 500
76
87/* *************************************************************************/
@@ -25,7 +24,10 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int16_t SID,
2524 int16_t CS, int16_t SRCS, int16_t MISO,
2625 int16_t BUSY)
2726 : Adafruit_EPD(width, height, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY) {
28-
27+
28+ horizontalResolution = width;
29+ verticalResolution = height;
30+
2931 if ((width % 8 ) != 0 ) {
3032 width += 8 - (width % 8 );
3133 }
@@ -62,6 +64,9 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int16_t DC,
6264 int16_t BUSY, SPIClass *spi)
6365 : Adafruit_EPD(width, height, DC, RST, CS, SRCS, BUSY, spi) {
6466
67+ horizontalResolution = width;
68+ verticalResolution = height;
69+
6570 if ((height % 8 ) != 0 ) {
6671 height += 8 - (height % 8 );
6772 }
@@ -138,6 +143,7 @@ void Adafruit_UC8151D::powerUp() {
138143 init_code = _epd_init_code;
139144 }
140145 EPD_commandList (init_code);
146+ sendResolution ();
141147
142148 if (_epd_lut_code) {
143149 EPD_commandList (_epd_lut_code);
@@ -195,6 +201,21 @@ void Adafruit_UC8151D::setRAMAddress(uint16_t x, uint16_t y) {
195201 (void )y;
196202}
197203
204+ /* *************************************************************************/
205+ /* !
206+ @brief Sends the resolution to the EPD
207+ */
208+ /* *************************************************************************/
209+ void Adafruit_UC8151D::sendResolution ()
210+ {
211+ const uint8_t uc8151d_resolution_init_code[] {
212+ UC8151D_TRES, 3 , verticalResolution,
213+ (uint8_t )((horizontalResolution & 0xFF00 ) >> 8 ),
214+ (uint8_t )(horizontalResolution & 0x00FF ),
215+ 0xFE };
216+ EPD_commandList (uc8151d_resolution_init_code);
217+ }
218+
198219/* *************************************************************************/
199220/* !
200221 @brief Transfer the data stored in the buffer(s) to the display
0 commit comments