Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the function TFT_invertDisplay() missing the disp_select() ? #45

Open
Francois-Belanger opened this issue Jul 20, 2018 · 1 comment

Comments

@Francois-Belanger
Copy link

Great library :-) Just that I had to invert the colour for a new LCD and that function didn't work. I had to change to this.

void TFT_invertDisplay(const uint8_t mode) {
if (disp_select() != ESP_OK) {
printf("TFT_invertDisplay ERROR !!!!\n");
return;
}

if ( mode == INVERT_ON ) disp_spi_transfer_cmd(TFT_INVONN);
else disp_spi_transfer_cmd(TFT_INVOFF);

disp_deselect();
}

Is it ok ?

Thanks for the great work.

@jas39
Copy link

jas39 commented Sep 10, 2019

Adding disp_select() to TFT_invertDisplay solved my problem. Likely also needed for TFT_setGammaCurve

// Send the command to invert all of the colors.
// Input: i 0 to disable inversion; non-zero to enable inversion
//==========================================
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();
}
}

// Select gamma curve
// Input: gamma = 0~3
//==================================
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();
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants