menu "M5Stack Tab5 Configuration"
  config M5STACK_TAB5_INTERRUPT_STACK_SIZE
  int "Interrupt stack size"
  default 4096
  help
    Size of the stack used for the interrupt handler. Used by the touch
    callback and other interrupt handlers.

  config M5STACK_TAB5_INTERRUPT_PRIORITY
  int "Interrupt task priority"
  default 0
  range 0 25
  help
    FreeRTOS priority of the GPIO interrupt handler task (0 = lowest). Raise it
    if interrupt callbacks must run promptly relative to other tasks.

  config M5STACK_TAB5_INTERRUPT_CORE_ID
  int "Interrupt task core ID"
  default -1
  range -1 1
  help
    Core to pin the GPIO interrupt handler task to (-1 = not pinned to any core).

  config M5STACK_TAB5_AUDIO_TASK_STACK_SIZE
  int "Audio task stack size"
  default 8192
  help
    Size of the stack used for the audio processing task.

  config M5STACK_TAB5_ST7121_HW_ROTATION
    bool "ST7121: apply 0/180 rotation in the panel (EXPERIMENTAL)"
    default n
    help
      Route 0/180-degree display rotation to the ST7121 panel itself (MADCTL
      GS/SS scan-direction flip) instead of the PPA/software rotation in the
      flush path. EXPERIMENTAL: verified NOT working on at least some ST7121
      Tab5 units - the 180-degree orientation renders corrupted, most likely
      because the TDDI gate/source mux tables programmed at init (command
      0xAC block) are matched to the normal scan direction and a MADCTL GS
      flip alone reorders gate scanning without swapping them. Leave disabled
      (the default) to keep the known-good PPA rotation for all orientations;
      enable only to experiment on your unit.

  config M5STACK_TAB5_ROTATION_SOFTWARE_FALLBACK
    bool "Keep a software fallback for display rotation"
    default y
    help
      Display rotation normally runs on the PPA, which rotates each flushed
      area straight into the panel framebuffer. When the PPA is unavailable
      (its client or completion callback could not be registered, or an
      operation fails) the area is instead rotated on the CPU into a scratch
      buffer the size of the LVGL draw buffer (1.8 MB of PSRAM with the
      example's full-frame draw buffers). That scratch buffer is allocated
      the first time the fallback is needed, so on a board where the PPA
      works it costs nothing. Disable to never allocate it: rotation is then
      PPA-only, and a rotated flush with no PPA available is dropped with an
      error instead of being rotated in software.

  config M5STACK_TAB5_DPI_NUM_FBS
  int "Number of DPI frame buffers"
  default 1
  range 1 3
  help
    How many frame buffers the MIPI-DSI DPI panel driver allocates in PSRAM
    (esp_lcd_dpi_panel_config_t::num_fbs). Each one is 720 x 1280 RGB565 =
    1.8 MB of PSRAM, so every buffer beyond the first costs 1.8 MB.
    With 1 (the default) LVGL renders into separate draw buffers and the BSP
    copies each flushed area into the one frame buffer the panel scans out.
    With 2 or 3 the application can render straight into the frame buffers
    and switch whole frames instead of copying them: see
    M5StackTab5::frame_buffers() and
    DisplayConfig::render_to_frame_buffers_enabled. LVGL's DIRECT mode uses
    at most two of them (buffers 1 and 0); a third only serves an
    application that drives the frame buffers itself. Extra buffers without
    DIRECT mode buy nothing: LVGL keeps copying into the scanned-out buffer.

endmenu
