From ea717bba217490ac2f5bd4628b476a95f635e2dc Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 10 Sep 2023 16:15:22 +0200 Subject: [PATCH] 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 --- drivers/display/display_st7735r.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/display/display_st7735r.c b/drivers/display/display_st7735r.c index 7569e906ed8..a20242d9703 100644 --- a/drivers/display/display_st7735r.c +++ b/drivers/display/display_st7735r.c @@ -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;