jeremyjh / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
45 stars 22 forks source link

TFT_invertDisplay #1

Closed jas39 closed 4 years ago

jas39 commented 4 years ago

There seems to be a missing reservation of the SPI bus in function TFT_invertDisplay and TFT_setGammaCurve. Propose something like this:

void TFT_invertDisplay(const uint8_t mode) {
    if (disp_select() == ESP_OK) {
      if ( mode == INVERT_ON ) disp_spi_transfer_cmd(TFT_INVONN);
      else disp_spi_transfer_cmd(TFT_INVOFF);
      disp_deselect();
    }
}

void TFT_setGammaCurve(uint8_t gm) {
  uint8_t gamma_curve = 1 << (gm & 0x03);
  if (disp_select() == ESP_OK) {
      disp_spi_transfer_cmd_data(TFT_CMD_GAMMASET, &gamma_curve, 1);
      disp_deselect();
  }
}

This is verified on Lilygo T-Display (ST7789V based)

jeremyjh commented 4 years ago

Thanks! I had not tried TFT_invertDisplay yet, but I confirmed it did not work until doing this on my ILI9341. Do you want to submit a PR?

jas39 commented 4 years ago

Please go ahead and fix it as my git knowledge is too limited 😊