Skip to content

Commit

Permalink
new method: setWindow() for more controlled pixel pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
eringerli committed Jun 5, 2022
1 parent e96226d commit 3165d3a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Adafruit_RA8875.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,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
Expand Down

0 comments on commit 3165d3a

Please sign in to comment.