mirror of
https://github.com/adafruit/TFTLCD-Library.git
synced 2026-07-28 04:06:02 +00:00
Restored goTo() function for now
This commit is contained in:
@@ -66,6 +66,27 @@ static volatile uint8_t *wrportreg;
|
||||
#include "pins_arduino.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
// Deprecated function -- here for compat w/old code
|
||||
void Adafruit_TFTLCD::goTo(int x, int y) {
|
||||
if (driver == 0x9325 || driver == 0x9328) {
|
||||
writeRegister16(0x0020, x); // GRAM Address Set (Horizontal Address) (R20h)
|
||||
writeRegister16(0x0021, y); // GRAM Address Set (Vertical Address) (R21h)
|
||||
writeCommand(0x0022); // Write Data to GRAM (R22h)
|
||||
}
|
||||
if (driver == 0x7575) {
|
||||
writeRegister8(HX8347G_COLADDRSTART2, x>>8);
|
||||
writeRegister8(HX8347G_COLADDRSTART1, x);
|
||||
writeRegister8(HX8347G_ROWADDRSTART2, y>>8);
|
||||
writeRegister8(HX8347G_ROWADDRSTART1, y);
|
||||
|
||||
writeRegister8(HX8347G_COLADDREND2, 0);
|
||||
writeRegister8(HX8347G_COLADDREND1, TFTWIDTH-1);
|
||||
writeRegister8(HX8347G_ROWADDREND2, (TFTHEIGHT-1)>>8);
|
||||
writeRegister8(HX8347G_ROWADDREND1, (TFTHEIGHT-1)&0xFF);
|
||||
writeCommand(0x0022); // Write Data to GRAM (R22h)
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_TFTLCD::setAddrWindow(int x1, int y1, int x2, int y2) {
|
||||
|
||||
if (driver == 0x9325 || driver == 0x9328) {
|
||||
|
||||
@@ -103,6 +103,7 @@ class Adafruit_TFTLCD : public Adafruit_GFX {
|
||||
// commands
|
||||
void begin(uint16_t id = 0x9325);
|
||||
void setAddrWindow(int x1, int y1, int x2, int y2);
|
||||
void goTo(int x, int y); // deprecated
|
||||
void reset(void);
|
||||
|
||||
/* low level */
|
||||
|
||||
@@ -151,13 +151,13 @@ void bmpdraw(File f, int x, int y) {
|
||||
} else if (identifier == 0x7575) {
|
||||
if (tft.getRotation() == 3) {
|
||||
tft.writeRegister8(HX8347G_MEMACCESS, 0x20);
|
||||
tft.setWindow(x, y+i, 319, y+i);
|
||||
tft.setAddrWindow(x, y+i, 319, y+i);
|
||||
} else if (tft.getRotation() == 2) {
|
||||
tft.writeRegister8(HX8347G_MEMACCESS, 0x40);
|
||||
tft.goTo(x, y+i);
|
||||
} else if (tft.getRotation() == 1) {
|
||||
tft.writeRegister8(HX8347G_MEMACCESS, 0xA0);
|
||||
tft.setWindow(x, y+bmpHeight-1-i, 319, y+bmpHeight-i);
|
||||
tft.setAddrWindow(x, y+bmpHeight-1-i, 319, y+bmpHeight-i);
|
||||
} else if (tft.getRotation() == 0) {
|
||||
tft.writeRegister8(HX8347G_MEMACCESS, 0x0);
|
||||
tft.goTo(x, y+bmpHeight-i-1);
|
||||
@@ -268,4 +268,4 @@ uint32_t read32(File f) {
|
||||
d <<= 16;
|
||||
d |= b;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user