mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2026-10-27 06:21:36 +00:00
woops turns out some SPI displays dont use this format, so make it virtual
This commit is contained in:
1 parent
f573e032cd
commit
cf1e1b0521
2 files changed
+10
-31
No files matched your search
@@ -233,33 +233,6 @@ void Adafruit_SPITFT::spiWrite(uint8_t b) {
|
||||
* Transaction API
|
||||
* */
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief SPI displays set an address window rectangle for blitting pixels
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner x coordinate
|
||||
@param w Width of window
|
||||
@param h Height of window
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SPITFT::setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||
x += _xstart;
|
||||
y += _ystart;
|
||||
uint32_t xa = ((uint32_t)x << 16) | (x+w-1);
|
||||
uint32_t ya = ((uint32_t)y << 16) | (y+h-1);
|
||||
|
||||
//Serial.print("X: "); Serial.println(xa, HEX);
|
||||
//Serial.print("Y: "); Serial.println(ya, HEX);
|
||||
|
||||
writeCommand(xSetCommand); // Column addr set
|
||||
SPI_WRITE32(xa);
|
||||
|
||||
writeCommand(ySetCommand); // Row addr set
|
||||
SPI_WRITE32(ya);
|
||||
|
||||
writeCommand(RAMwriteCommand); // write to RAM
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Begin an SPI transaction & set CS low.
|
||||
|
||||
+10
-4
@@ -48,7 +48,16 @@ class Adafruit_SPITFT : public Adafruit_GFX {
|
||||
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
|
||||
// Transaction API not used by GFX
|
||||
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
|
||||
/*!
|
||||
@brief SPI displays set an address window rectangle for blitting pixels
|
||||
@param x Top left corner x coordinate
|
||||
@param y Top left corner x coordinate
|
||||
@param w Width of window
|
||||
@param h Height of window
|
||||
*/
|
||||
virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
|
||||
|
||||
void writePixel(uint16_t color);
|
||||
void writePixels(uint16_t * colors, uint32_t len);
|
||||
void writeColor(uint16_t color, uint32_t len);
|
||||
@@ -98,9 +107,6 @@ class Adafruit_SPITFT : public Adafruit_GFX {
|
||||
|
||||
uint8_t invertOnCommand = 0, ///< SPI command byte to turn on invert
|
||||
invertOffCommand = 0; ///< SPI command byte to turn off invert
|
||||
uint8_t ySetCommand, ///< SPI command byte to set the Y address window
|
||||
xSetCommand, ///< SPI command byte to set the X address window
|
||||
RAMwriteCommand; ///< SPI command byte to start blitting data to framebuffer RAM
|
||||
int16_t _xstart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the x offset from 0 to align
|
||||
int16_t _ystart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the y offset from 0 to align
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user