Skip to content

Commit

Permalink
samples: drivers: video: capture: don't apply format unless needed
Browse files Browse the repository at this point in the history
Do not apply format setting unless needed. Also, correct the check for
the RGB565 format setting- the zephyr display API treats RGB565 and
BGR565 as big endian, so the format needed here is BGR565.

Signed-off-by: Daniel DeGrasse <[email protected]>
  • Loading branch information
danieldegrasse committed Oct 7, 2024
1 parent 91f05c3 commit 3c18f31
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions samples/drivers/video/capture/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ static inline int display_setup(const struct device *const display_dev, const ui
/* Set display pixel format to match the one in use by the camera */
switch (pixfmt) {
case VIDEO_PIX_FMT_RGB565:
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_565);
if (capabilities.current_pixel_format != PIXEL_FORMAT_BGR_565) {
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_BGR_565);
}
break;
case VIDEO_PIX_FMT_XRGB32:
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888);
if (capabilities.current_pixel_format != PIXEL_FORMAT_ARGB_8888) {
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888);
}
break;
default:
return -ENOTSUP;
Expand Down

0 comments on commit 3c18f31

Please sign in to comment.