Skip to content

Commit 916696c

Browse files
committed
samples: subsys: input: draw_touch_events: set pixel format at runtime
Problem: On STM32U5G9J-DK1 + st_lcd_dsi_mb1835, the sample could BUS FAULT with SCREEN_WIDTH_TO_CROSS_DIM=25 and show only a horizontal line with 20. Root cause: The tile buffer BPP is derived from the devicetree pixel format (e.g., RGB888 = 3 BPP), but the driver may be using a different current pixel format. Fix: Explicitly set the driver pixel format to the DT-selected format at init. Signed-off-by: Charles Dias <[email protected]>
1 parent 2a09063 commit 916696c

File tree

1 file changed

+9
-0
lines changed
  • samples/subsys/input/draw_touch_events/src

1 file changed

+9
-0
lines changed

samples/subsys/input/draw_touch_events/src/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ int main(void)
126126
LOG_ERR("Unsupported BPP=%d", BPP);
127127
return 0;
128128
}
129+
130+
/* Ensure driver pixel format matches our buffer layout from DT */
131+
int rc = display_set_pixel_format(display_dev, PIXEL_FORMAT);
132+
133+
if (rc < 0) {
134+
LOG_WRN("display_set_pixel_format(%d) failed: %d, continuing with driver default",
135+
PIXEL_FORMAT, rc);
136+
}
137+
129138
fill_cross_buffer();
130139
display_blanking_off(display_dev);
131140

0 commit comments

Comments
 (0)