mirror of
https://github.com/esphome/esphome.git
synced 2024-12-28 17:37:44 +01:00
support rotated ILI9341 (ILI9342) (#3526)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
parent
612822490b
commit
dd470d4197
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user