Skip to content

Commit

Permalink
samples: subsys: video: add capture to lcd sample
Browse files Browse the repository at this point in the history
Add sample application to capture an image frame from a camera
and send it for display on the LCD.

Signed-off-by: Charles Dias <[email protected]>
  • Loading branch information
CharlesDias committed Apr 27, 2024
1 parent 2765d23 commit 72cae10
Show file tree
Hide file tree
Showing 6 changed files with 3,182 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/subsys/video/capture_to_lcd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(video_capture)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
12 changes: 12 additions & 0 deletions samples/subsys/video/capture_to_lcd/boards/mini_stm32h743.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2024 Charles Dias <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
#

CONFIG_CLOCK_STM32_MCO1_SRC_HSI48=y
CONFIG_CLOCK_STM32_MCO1_DIV=4

CONFIG_LOG_BUFFER_SIZE=2048

CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=102400
169 changes: 169 additions & 0 deletions samples/subsys/video/capture_to_lcd/boards/mini_stm32h743.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*
* Copyright (c) 2024 Charles Dias <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*
*/

/ {
aliases {
ov-cam = &ov2640;
};
};

&pll {
div-m = <5>;
mul-n = <96>;
div-p = <2>;
div-q = <2>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};

&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(240)>;
d1cpre = <1>;
hpre = <1>;
d1ppre = <2>;
d2ppre1 = <2>;
d2ppre2 = <2>;
d3ppre = <2>;
};

&i2c1 {
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9 &mco1_pa8>;
pinctrl-names = "default";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;

ov2640: ov2640@30 {
compatible = "ovti,ov2640";
reg = <0x30>;
status = "okay";
supply-gpios = <&gpioa 7 GPIO_ACTIVE_HIGH>;
clock-rate-control = <0x80>;

port {
ov2640_ep_out: endpoint {
remote-endpoint = <&dcmi_ep_in>;
};
};
};
};

&dcmi {
status = "okay";
sensor = <&ov2640>;
pinctrl-0 = <&dcmi_hsync_pa4 &dcmi_pixclk_pa6 &dcmi_vsync_pb7
&dcmi_d0_pc6 &dcmi_d1_pc7 &dcmi_d2_pe0 &dcmi_d3_pe1
&dcmi_d4_pe4 &dcmi_d5_pd3 &dcmi_d6_pe5 &dcmi_d7_pe6>;
pinctrl-names = "default";
bus-width = <8>;
hsync-active = <0>;
vsync-active = <0>;
pixelclk-active = <1>;
dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC |
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS |
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>;

port {
dcmi_ep_in: endpoint {
remote-endpoint = <&ov2640_ep_out>;
};
};
};

&dma1 {
status = "okay";
};

&dmamux1 {
status = "okay";
};

&pinctrl{

mco1_pa8: mco1_pa8 {
pinmux = <STM32_PINMUX('A', 8, AF0)>;
slew-rate = "very-high-speed";
};

/* DCMI_HSYNC */

/omit-if-no-ref/ dcmi_hsync_pa4: dcmi_hsync_pa4 {
pinmux = <STM32_PINMUX('A', 4, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_PIXCLK */

/omit-if-no-ref/ dcmi_pixclk_pa6: dcmi_pixclk_pa6 {
pinmux = <STM32_PINMUX('A', 6, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_VSYNC */

/omit-if-no-ref/ dcmi_vsync_pb7: dcmi_vsync_pb7 {
pinmux = <STM32_PINMUX('B', 7, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D0 */

/omit-if-no-ref/ dcmi_d0_pc6: dcmi_d0_pc6 {
pinmux = <STM32_PINMUX('C', 6, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D1 */

/omit-if-no-ref/ dcmi_d1_pc7: dcmi_d1_pc7 {
pinmux = <STM32_PINMUX('C', 7, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D2 */

/omit-if-no-ref/ dcmi_d2_pe0: dcmi_d2_pe0 {
pinmux = <STM32_PINMUX('E', 0, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D3 */

/omit-if-no-ref/ dcmi_d3_pe1: dcmi_d3_pe1 {
pinmux = <STM32_PINMUX('E', 1, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D4 */

/omit-if-no-ref/ dcmi_d4_pe4: dcmi_d4_pe4 {
pinmux = <STM32_PINMUX('E', 4, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D5 */

/omit-if-no-ref/ dcmi_d5_pd3: dcmi_d5_pd3 {
pinmux = <STM32_PINMUX('D', 3, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D6 */

/omit-if-no-ref/ dcmi_d6_pe5: dcmi_d6_pe5 {
pinmux = <STM32_PINMUX('E', 5, AF13)>;
slew-rate = "very-high-speed";
};

/* DCMI_D7 */

/omit-if-no-ref/ dcmi_d7_pe6: dcmi_d7_pe6 {
pinmux = <STM32_PINMUX('E', 6, AF13)>;
slew-rate = "very-high-speed";
};
};
20 changes: 20 additions & 0 deletions samples/subsys/video/capture_to_lcd/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CONFIG_VIDEO=y
CONFIG_VIDEO_SW_GENERATOR=y

CONFIG_PRINTK=y
CONFIG_LOG=y

CONFIG_MAIN_STACK_SIZE=4096

CONFIG_DISPLAY=y
CONFIG_DISPLAY_LOG_LEVEL_ERR=y

CONFIG_LVGL=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_LABEL=y
CONFIG_LV_USE_BTN=y
CONFIG_LV_USE_ARC=y
CONFIG_LV_USE_IMG=y
CONFIG_LV_FONT_MONTSERRAT_14=y
CONFIG_LV_Z_MEM_POOL_SIZE=16384
Loading

0 comments on commit 72cae10

Please sign in to comment.