packages:
  lvgl: !include lvgl-package.yaml
  spi: !include ../../test_build_components/common/spi/esp32-idf.yaml
  i2c: !include ../../test_build_components/common/i2c/esp32-idf.yaml

sensor:
  - platform: rotary_encoder
    name: "Rotary Encoder"
    id: encoder
    pin_a: 3
    pin_b: 1
    internal: true

binary_sensor:
  - platform: gpio
    id: pushbutton
    name: Pushbutton
    pin:
      number: 0
      inverted: true
      ignore_strapping_warning: true

display:
  - platform: mipi_spi
    spi_id: spi_bus
    model: st7789v
    id: second_display
    dimensions:
      width: 240
      height: 320
    transform:
      swap_xy: false
      mirror_x: true
      mirror_y: true
    data_rate: 80MHz
    cs_pin: GPIO20
    dc_pin:
      number: GPIO15
      ignore_strapping_warning: true
    auto_clear_enabled: false
    invert_colors: false
    update_interval: never

  - platform: mipi_spi
    spi_id: spi_bus
    model: st7789v
    id: tft_display
    dimensions:
      width: 240
      height: 320
    transform:
      swap_xy: false
      mirror_x: true
      mirror_y: true
    data_rate: 80MHz
    cs_pin: GPIO22
    dc_pin: GPIO21
    auto_clear_enabled: false
    invert_colors: false
    update_interval: never

lvgl:
  update_when_display_idle: true
  displays:
    - tft_display
    - second_display
  encoders:
    sensor: encoder
    enter_button: pushbutton
    group: general
    initial_focus: lv_roller
  on_draw_start:
    - logger.log: draw started
  on_draw_end:
    - logger.log: draw ended
    - lvgl.pause:
    - component.update: tft_display
    - delay: 60s
    - lvgl.resume:

<<: !include common.yaml
