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 4edd16a commit 427b351
Show file tree
Hide file tree
Showing 2 changed files with 24 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 @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Adafruit_RA8875.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class Adafruit_RA8875 : public Adafruit_GFX {
/* Graphics functions */
void graphicsMode(void);
void setXY(uint16_t x, uint16_t y);
void setWindow(uint16_t xStart, uint16_t xEnd, uint16_t yStart,
uint16_t yEnd);
void pushPixels(uint32_t num, uint16_t p);
void fillRect(void);

Expand Down

0 comments on commit 427b351

Please sign in to comment.