Skip to content
Permalink
Browse files

Fix (Patch) Rotation 2/3 issues for ST7789/ST7735

The ST7789 display can handle 240x320 displays... Looks like these offset the display  to end of memory... So was offsetting the rows by +80...

In other orientation, it starts at other end of memory so don't offset

Likewise ST7735 can handle 128x160.  So on 128x128 make sure offsets are
correct

Worked on my 240x240 display

Also make work on my 1.44" ST7735 including rotation

May need to add more cases of different versions of these displays.

Works on the ones that I have including all 4 rotations.

In Addition make sure setRotation is called for ST7735 as to init offsets
  • Loading branch information...
KurtE committed Jun 27, 2019
1 parent 2c6f0d6 commit 1aa7194c71026fe238b3944e7efc29fe9016ca16
Showing with 8 additions and 6 deletions.
  1. +5 −4 ST7735_t3.cpp
  2. +3 −2 ST7789_t3.cpp
@@ -735,8 +735,8 @@ void ST7735_t3::initR(uint8_t options)
} else if(options == INITR_144GREENTAB) {
_height = ST7735_TFTHEIGHT_144;
commandList(Rcmd2green144);
_colstart = 2;
_rowstart = 3;
_colstart = 0;
_rowstart = 32;
} else {
// _colstart, _rowstart left at default '0' values
commandList(Rcmd2red);
@@ -750,6 +750,7 @@ void ST7735_t3::initR(uint8_t options)
}

tabcolor = options;
setRotation(0);
}


@@ -897,7 +898,7 @@ void ST7735_t3::setRotation(uint8_t m)
_height = ST7735_TFTHEIGHT_18;
}
_xstart = _colstart;
_ystart = _rowstart;
_ystart = 0;//_rowstart;
break;
case 3:
if (tabcolor == INITR_BLACKTAB) {
@@ -912,7 +913,7 @@ void ST7735_t3::setRotation(uint8_t m)
}
_height = ST7735_TFTWIDTH;
_ystart = _colstart;
_xstart = _rowstart;
_xstart = 0;//_rowstart;
break;
}
endSPITransaction();
@@ -51,17 +51,18 @@ void ST7789_t3::setRotation(uint8_t m)
writedata(ST77XX_MADCTL_RGB);

_xstart = _colstart;
_ystart = _rowstart;
_ystart = 0; //_rowstart;
break;

case 3:
writedata(ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB);

_xstart = _rowstart;
_xstart = 0; //_rowstart;
_ystart = _colstart;
break;
}
endSPITransaction();
// Serial.printf("Set rotation %d start(%d %d) row: %d, col: %d\n", m, _xstart, _ystart, _rowstart, _colstart);
}
#define ST7789_240x240_XSTART 0
#define ST7789_240x240_YSTART 80

0 comments on commit 1aa7194

Please sign in to comment.
You can’t perform that action at this time.