diff --git a/esphome/components/ili9341/display.py b/esphome/components/ili9341/display.py index 6b18196ef1..3122b45bbe 100644 --- a/esphome/components/ili9341/display.py +++ b/esphome/components/ili9341/display.py @@ -24,6 +24,7 @@ ili9341 = ili9341_ns.class_( ) ILI9341M5Stack = ili9341_ns.class_("ILI9341M5Stack", ili9341) ILI9341TFT24 = ili9341_ns.class_("ILI9341TFT24", ili9341) +ILI9341TFT24R = ili9341_ns.class_("ILI9341TFT24R", ili9341) ILI9341Model = ili9341_ns.enum("ILI9341Model") ILI9341ColorMode = ili9341_ns.enum("ILI9341ColorMode") @@ -31,6 +32,7 @@ ILI9341ColorMode = ili9341_ns.enum("ILI9341ColorMode") MODELS = { "M5STACK": ILI9341Model.M5STACK, "TFT_2.4": ILI9341Model.TFT_24, + "TFT_2.4R": ILI9341Model.TFT_24R, } ILI9341_MODEL = cv.enum(MODELS, upper=True, space="_") @@ -60,6 +62,8 @@ async def to_code(config): lcd_type = ILI9341M5Stack if config[CONF_MODEL] == "TFT_2.4": lcd_type = ILI9341TFT24 + if config[CONF_MODEL] == "TFT_2.4R": + lcd_type = ILI9341TFT24R rhs = lcd_type.new() var = cg.Pvariable(config[CONF_ID], rhs) diff --git a/esphome/components/ili9341/ili9341_display.cpp b/esphome/components/ili9341/ili9341_display.cpp index 0ad5446d9a..c4fa5f1b10 100644 --- a/esphome/components/ili9341/ili9341_display.cpp +++ b/esphome/components/ili9341/ili9341_display.cpp @@ -263,5 +263,13 @@ void ILI9341TFT24::initialize() { this->fill_internal_(Color::BLACK); } +// 24_TFT rotated display +void ILI9341TFT24R::initialize() { + this->init_lcd_(INITCMD_TFT); + this->width_ = 320; + this->height_ = 240; + this->fill_internal_(Color::BLACK); +} + } // namespace ili9341 } // namespace esphome diff --git a/esphome/components/ili9341/ili9341_display.h b/esphome/components/ili9341/ili9341_display.h index e568eead40..3fbc144ac2 100644 --- a/esphome/components/ili9341/ili9341_display.h +++ b/esphome/components/ili9341/ili9341_display.h @@ -12,6 +12,7 @@ namespace ili9341 { enum ILI9341Model { M5STACK = 0, TFT_24, + TFT_24R, }; enum ILI9341ColorMode { @@ -102,5 +103,12 @@ class ILI9341TFT24 : public ILI9341Display { public: void initialize() override; }; + +//----------- ILI9341_24_TFT rotated display -------------- +class ILI9341TFT24R : public ILI9341Display { + public: + void initialize() override; +}; + } // namespace ili9341 } // namespace esphome