diff --git a/firmware/components/display.yaml b/firmware/components/display.yaml index 743aa57..604e5c5 100644 --- a/firmware/components/display.yaml +++ b/firmware/components/display.yaml @@ -1 +1,47 @@ -# placeholder — see task 3/4/5/6 +i2c: + - id: i2c_bus + sda: GPIO8 + scl: GPIO9 + scan: true + +ch422g: + - id: io_expander + i2c_id: i2c_bus + +touchscreen: + - platform: gt911 + id: touch_gt911 + i2c_id: i2c_bus + address: 0x5D # confirmed via Waveshare's documented I2C address map + interrupt_pin: GPIO4 + reset_pin: + ch422g: io_expander + number: 1 # EXIO1 = TP_RST, per Waveshare pinout + display: lcd_display + +display: + - platform: mipi_rgb + id: lcd_display + model: WAVESHARE-5-1024X600 # ESPHome's closest built-in preset: same ST7701 chip, data pins, + # and CH422G reset/enable wiring as this board's 1024x600 panel + dimensions: + width: 1024 + height: 600 + pad_width: 0 # the preset's default width/height (1024x600) don't match its inherited + pad_height: 0 # native_width/native_height (800x480 from the base 4.3" model), which makes + # ESPHome's offset math go negative unless pad is forced explicitly here + enable_pin: + - ch422g: io_expander + number: 2 # EXIO2 = DISP (backlight enable) — inherited from the base preset + - ch422g: io_expander + number: 6 # EXIO6 = LCD_VDD_EN (VCOM enable) — the built-in preset doesn't set + # this, but the Waveshare wiki confirms VCOM must be driven high on + # this board or the panel won't display correctly. Added explicitly. + lambda: |- + it.fill(Color::BLACK); + it.print(512, 300, id(font_label), TextAlign::CENTER, "Thermostat — Phase 1 OK"); + +font: + - file: "gfonts://Roboto" + id: font_label + size: 32