From eafe5b921fbb2f5cdcd6114e28c4522ce9ab99b0 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Thu, 24 Sep 2020 13:09:40 +0200 Subject: [PATCH] Add macro for RGB conversion --- include/extdrv/st7735_tft_driver.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/extdrv/st7735_tft_driver.h b/include/extdrv/st7735_tft_driver.h index aa68c54..051c8ca 100644 --- a/include/extdrv/st7735_tft_driver.h +++ b/include/extdrv/st7735_tft_driver.h @@ -85,6 +85,11 @@ struct st7735_ops { int (*erase_display)(struct st7735_display* conf); }; +#define RGB_MSB_TO_16bits_565(r, g, b) \ + (uint16_t)( ((((uint16_t)(r)) ) & 0x00F8) | \ + (((((uint16_t)(g)) << 11) & 0xE000) | ((((uint16_t)(g)) >> 5) & 0x0003)) | \ + ((((uint16_t)(b)) << 5) & 0x1F00) ) + /* Note that GM should be '11' for 128x160 screens and '00' for 132x162 screens */ enum st77xx_defs { ST77xx_NOP = 0x00, /* No operation */ -- 2.43.0