diff --git a/components/st7735/st7735.h b/components/st7735/st7735.h index 69f688f..497043d 100644 --- a/components/st7735/st7735.h +++ b/components/st7735/st7735.h @@ -80,6 +80,20 @@ #define ST7735_NVMSET 0xFC // NVM setting #define ST7735_PROMACT 0xFE // Program action +namespace esphome { +namespace st7735 { + +template +struct Color565 { + operator Color () const + { + return Color((((N)&0xF800) >> 8), (((N)&0x07E0) >> 3), (((N)&0x001F) << 3)); + } +}; + +} // namespace st7735 +} // namespace esphome + // Some ready-made 16-bit ('565') color settings: #define ST77XX_BLACK 0x0000 /* 0, 0, 0 */ #define ST77XX_NAVY 0x000F /* 0, 0, 128 */