Skip to content

Commit 0d834b0

Browse files
jiayadong8995xiaoxiang781216
authored andcommitted
boards/xtensa/esp32s3/esp32s3-box: Fix ILI9342C color inversion
When using the ILI9342C LCD on the esp32s3-box-3 development board, the displayed colors are inverted. add content Manually converts the byte order of color data from little-endian to big-endian before transmission.
1 parent 27a2f88 commit 0d834b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_lcd_ili9342c.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <stdbool.h>
3131
#include <debug.h>
3232
#include <errno.h>
33+
#include <endian.h>
3334
#include <sys/param.h>
3435

3536
#include <nuttx/arch.h>
@@ -420,6 +421,11 @@ static int ili9342c_sendgram(struct ili9341_lcd_s *lcd,
420421
{
421422
struct ili9342c_lcd_dev *priv = (struct ili9342c_lcd_dev *)lcd;
422423

424+
for (uint32_t i = 0; i < nwords; i++)
425+
{
426+
((uint16_t *)wd)[i] = swap16(wd[i]);
427+
}
428+
423429
lcdinfo("lcd:%p, wd=%p, nwords=%" PRIu32 "\n", lcd, wd, nwords);
424430

425431
SPI_SETBITS(priv->spi_dev, 16);

0 commit comments

Comments
 (0)