22#include " Adafruit_EPD.h"
33
44#define EPD_RAM_BW 0x10
5-
65#define BUSY_WAIT 500
76
87/* *************************************************************************/
@@ -26,6 +25,9 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int16_t SID,
2625 int16_t BUSY)
2726 : Adafruit_EPD(width, height, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY) {
2827
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,22 @@ 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+ 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+
198220/* *************************************************************************/
199221/* !
200222 @brief Transfer the data stored in the buffer(s) to the display
0 commit comments