Merge pull request #11054 from gemu2015/ili9342

fix ili9342 rotation
This commit is contained in:
Theo Arends 2021-02-20 16:56:45 +01:00 committed by GitHub
commit 54733cd3f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -411,17 +411,17 @@ void ILI9341_2::setRotation(uint8_t m) {
_height = iheight; _height = iheight;
break; break;
case 1: case 1:
m = (MADCTL_MV | MADCTL_BGR); m = (MADCTL_MY | MADCTL_MV | MADCTL_BGR);
_width = iheight; _width = iheight;
_height = iwidth; _height = iwidth;
break; break;
case 2: case 2:
m = (MADCTL_MY | MADCTL_BGR); m = (MADCTL_MY | MADCTL_MX | MADCTL_BGR);
_width = iwidth; _width = iwidth;
_height = iheight; _height = iheight;
break; break;
case 3: case 3:
m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR); m = (MADCTL_MX | MADCTL_MV | MADCTL_BGR);
_width = iheight; _width = iheight;
_height = iwidth; _height = iwidth;
break; break;
@ -527,7 +527,7 @@ void ili9342_bpwr(uint8_t on);
void ILI9341_2::DisplayOnff(int8_t on) { void ILI9341_2::DisplayOnff(int8_t on) {
if (_hwspi>=2) { if ((_hwspi >= 2) && (_bp < 0)) {
ili9342_bpwr(on); ili9342_bpwr(on);
} }
@ -561,9 +561,11 @@ void ILI9341_2::DisplayOnff(int8_t on) {
} }
void ILI9341_2::invertDisplay(boolean i) { void ILI9341_2::invertDisplay(boolean i) {
SPI_BEGIN_TRANSACTION();
ILI9341_2_CS_LOW ILI9341_2_CS_LOW
writecmd(i ? ILI9341_2_INVON : ILI9341_2_INVOFF); writecmd(i ? ILI9341_2_INVON : ILI9341_2_INVOFF);
ILI9341_2_CS_HIGH ILI9341_2_CS_HIGH
SPI_END_TRANSACTION();
} }
void ili9342_dimm(uint8_t dim); void ili9342_dimm(uint8_t dim);

View File

@ -42,7 +42,7 @@ bool tft_init_done = false;
void ILI9341_InitDriver() void ILI9341_InitDriver()
{ {
#ifdef USE_M5STACK_CORE2 #if (defined(USE_M5STACK_CORE2) || defined(USE_M5STACK_CORE_BASIC))
if (TasmotaGlobal.spi_enabled) { if (TasmotaGlobal.spi_enabled) {
#else #else
// There are displays without CS // There are displays without CS
@ -75,6 +75,9 @@ void ILI9341_InitDriver()
#ifdef USE_M5STACK_CORE2 #ifdef USE_M5STACK_CORE2
// fixed pins on m5stack core2 // fixed pins on m5stack core2
ili9341_2 = new ILI9341_2(5, -2, 15, -2); ili9341_2 = new ILI9341_2(5, -2, 15, -2);
#elif defined(USE_M5STACK_CORE_BASIC)
// int8_t cs, int8_t res, int8_t dc, int8_t bp)
ili9341_2 = new ILI9341_2(14, 33, 27, 32);
#else #else
// check for special case with 2 SPI busses (ESP32 bitcoin) // check for special case with 2 SPI busses (ESP32 bitcoin)
if (TasmotaGlobal.soft_spi_enabled) { if (TasmotaGlobal.soft_spi_enabled) {