Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions boards/shields/st_b_cams_imx_mb1854/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ST_B_CAMS_IMX_MB1854 configuration

# Copyright (c) 2025 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0

if VIDEO_STM32_DCMIPP

config VIDEO_STM32_DCMIPP_SENSOR_PIXEL_FORMAT
default "pRAA"

config VIDEO_STM32_DCMIPP_SENSOR_WIDTH
default 2592

config VIDEO_STM32_DCMIPP_SENSOR_HEIGHT
default 1944

endif # VIDEO_STM32_DCMIPP
3 changes: 0 additions & 3 deletions boards/shields/st_b_cams_imx_mb1854/boards/stm32n6570_dk.conf

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CONFIG_VIDEO_FRAME_WIDTH=800
CONFIG_VIDEO_FRAME_HEIGHT=480
CONFIG_VIDEO_PIXEL_FORMAT="RGBP"
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=800000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2
CONFIG_MAIN_STACK_SIZE=2048
26 changes: 26 additions & 0 deletions samples/drivers/video/capture_to_lvgl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ mainmenu "Video capture to LVGL sample application"

menu "Video capture configuration"

config VIDEO_SOURCE_CROP_LEFT
int "Crop area left value"
default 0
help
Left value of the crop area within the video source.

config VIDEO_SOURCE_CROP_TOP
int "Crop area top value"
default 0
help
Top value of the crop area within the video source.

config VIDEO_SOURCE_CROP_WIDTH
int "Crop area width value"
default 0
help
Width value of the crop area within the video source.
If set to 0, the crop is not applied.

config VIDEO_SOURCE_CROP_HEIGHT
int "Crop area height value"
default 0
help
Height value of the crop area within the video source.
If set to 0, the crop is not applied.

config VIDEO_WIDTH
int "Define the width of the video"
default 320
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_VIDEO_WIDTH=800
CONFIG_VIDEO_HEIGHT=480
CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=800000
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2
CONFIG_MAIN_STACK_SIZE=4096
45 changes: 43 additions & 2 deletions samples/drivers/video/capture_to_lvgl/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ int main(void)
struct video_format fmt;
struct video_caps caps;
enum video_buf_type type = VIDEO_BUF_TYPE_OUTPUT;
struct video_selection sel = {
.type = VIDEO_BUF_TYPE_OUTPUT,
};
size_t bsize;
int i = 0;
int err;

display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
if (!device_is_ready(display_dev)) {
Expand Down Expand Up @@ -66,11 +70,50 @@ int main(void)
return 0;
}

/* Set the crop setting if necessary */
#if CONFIG_VIDEO_SOURCE_CROP_WIDTH && CONFIG_VIDEO_SOURCE_CROP_HEIGHT
sel.target = VIDEO_SEL_TGT_CROP;
sel.rect.left = CONFIG_VIDEO_SOURCE_CROP_LEFT;
sel.rect.top = CONFIG_VIDEO_SOURCE_CROP_TOP;
sel.rect.width = CONFIG_VIDEO_SOURCE_CROP_WIDTH;
sel.rect.height = CONFIG_VIDEO_SOURCE_CROP_HEIGHT;
if (video_set_selection(video_dev, &sel)) {
LOG_ERR("Unable to set selection crop");
return 0;
}
LOG_INF("Selection crop set to (%u,%u)/%ux%u",
sel.rect.left, sel.rect.top, sel.rect.width, sel.rect.height);
#endif

/* Set format */
fmt.width = CONFIG_VIDEO_WIDTH;
fmt.height = CONFIG_VIDEO_HEIGHT;
fmt.pixelformat = VIDEO_PIX_FMT_RGB565;

/*
* Check (if possible) if targeted size is same as crop
* and if compose is necessary
*/
sel.target = VIDEO_SEL_TGT_CROP;
err = video_get_selection(video_dev, &sel);
if (err < 0 && err != -ENOSYS) {
LOG_ERR("Unable to get selection crop");
return 0;
}

if (err == 0 && (sel.rect.width != fmt.width || sel.rect.height != fmt.height)) {
sel.target = VIDEO_SEL_TGT_COMPOSE;
sel.rect.left = 0;
sel.rect.top = 0;
sel.rect.width = fmt.width;
sel.rect.height = fmt.height;
err = video_set_selection(video_dev, &sel);
if (err < 0 && err != -ENOSYS) {
LOG_ERR("Unable to set selection compose");
return 0;
}
}

if (video_set_format(video_dev, &fmt)) {
LOG_ERR("Unable to set up video format");
return 0;
Expand Down Expand Up @@ -134,8 +177,6 @@ int main(void)
/* Grab video frames */
vbuf->type = type;
while (1) {
int err;

err = video_dequeue(video_dev, &vbuf, K_FOREVER);
if (err) {
LOG_ERR("Unable to dequeue video buf");
Expand Down