From 16557bac7bb25c4751de544486b22d079daf56d6 Mon Sep 17 00:00:00 2001 From: Christian Riggenbach Date: Sun, 5 Jun 2022 21:11:54 +0200 Subject: [PATCH] new method: setWindow() for more controlled pixel pushing --- Adafruit_RA8875.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Adafruit_RA8875.cpp b/Adafruit_RA8875.cpp index 0dc9641..729c505 100644 --- a/Adafruit_RA8875.cpp +++ b/Adafruit_RA8875.cpp @@ -568,6 +568,28 @@ void Adafruit_RA8875::setXY(uint16_t x, uint16_t y) { writeReg(RA8875_CURV1, y >> 8); } +/**************************************************************************/ +/*! + Sets the current window for pushing pixels + + @param xStart The 0-based x location to start the window + @param xEnd The 0-base x location to end the window + @param yStart The 0-based y location to start the window + @param yEnd The 0-base y location to end the window + */ +/**************************************************************************/ +void Adafruit_RA8875::setWindow(uint16_t xStart, uint16_t xEnd, uint16_t yStart, + uint16_t yEnd) { + writeReg(RA8875_HSAW0, (uint8_t)(xStart & 0x0FF)); + writeReg(RA8875_HSAW1, (uint8_t)(xStart >> 8)); + writeReg(RA8875_VSAW0, (uint8_t)(yStart & 0x0FF)); + writeReg(RA8875_VSAW1, (uint8_t)(yStart >> 8)); + writeReg(RA8875_HEAW0, (uint8_t)(xEnd & 0x0FF)); + writeReg(RA8875_HEAW1, (uint8_t)(xEnd >> 8)); + writeReg(RA8875_VEAW0, (uint8_t)(yEnd & 0x0FF)); + writeReg(RA8875_VEAW1, (uint8_t)(yEnd >> 8)); +} + /**************************************************************************/ /*! HW accelerated function to push a chunk of raw pixel data