drivers: display: st7735r: support ST7735S

ST7735S requires the COLMOD command be repeated as part of writing
pixels, otherwise it goes back to some kind of default which is likely
wrong.

ST7735S works correctly after this plus the previous two commits; tested
on STM32L462 + KD0096FM.

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2023-09-10 16:15:22 +02:00 committed by Carles Cufí
commit ea717bba21

View file

@ -172,11 +172,18 @@ static int st7735r_set_mem_area(const struct device *dev,
const uint16_t x, const uint16_t y,
const uint16_t w, const uint16_t h)
{
const struct st7735r_config *config = dev->config;
struct st7735r_data *data = dev->data;
uint16_t spi_data[2];
int ret;
/* ST7735S requires repeating COLMOD for each transfer */
ret = st7735r_transmit_hold(dev, ST7735R_CMD_COLMOD, &config->colmod, 1);
if (ret < 0) {
return ret;
}
uint16_t ram_x = x + data->x_offset;
uint16_t ram_y = y + data->y_offset;