# camera_preview **Repository Path**: dsqiu/camera_preview ## Basic Information - **Project Name**: camera_preview - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: ingenic-master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-11 - **Last Updated**: 2025-04-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Feedback 摄像头采集数据屏幕回显 ## 一、介绍 ### 1.1概述 ​ 该模块功能为,从 camera 端采集数据通过dpu进行数据转换,将数据发送到屏幕显示端,测试时屏幕为spi 屏幕,最终屏幕会呈现 camera 采集的数据内容。 ​ camera 的采集数据格式为:yuv422(yuyv) ​ spi 屏幕的显示数据格式为:rgb565 ### 1.2 目录结构 ```c . ├── app // lvgl 应用 ├── Build.mk //工程编译文件 ├── CMakeLists.txt // cmake 编译文件 ├── component // lvgl 源码部分 ├── hal // hal 支持源码 ├── include // 头文件 ├── main // 主程序 └── README.md // 文档 ``` ## 二、配置内容 ### 2.1 dts 配置 **spi 相关配置** ```c &spi0 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pb_tx>; spi-max-frequency = <50000000>; num-cs = <1>; cs-gpios = <0>; /* cs-gpios = <0>, <0>; */ /* cs-gpios = <&gpb 17 GPIO_ACTIVE_HIGH INGENIC_GPIO_NOBIAS>, <&gpb 16 GPIO_ACTIVE_HIGH INGENI*/ ingenic,chnl = <0>; ingenic,allow_cs_same = <1>; ingenic,bus_num = <0>; ingenic,has_dma_support = <1>; ingenic,spi-src-clk = <1>;/*0.ext; 1.ssi*/ /* Add SPI interface device */ st7789p3_spirgb_misc@0 { compatible = "ingenic,st7789p3_spirgb_misc"; status = "okay"; spi-max-frequency = <25000000>; // 25M clk reg = <0>; te-gpio = <&gpb 25 IRQ_TYPE_EDGE_FALLING INGENIC_GPIO_NOBIAS>; ingenic,rst-gpio = <&gpb 27 GPIO_ACTIVE_LOW INGENIC_GPIO_NOBIAS>; ingenic,lcd-dcx-gpio = <&gpb 1 GPIO_ACTIVE_HIGH INGENIC_GPIO_NOBIAS>; // ingenic,pintest-gpio = <&gpb 4 GPIO_ACTIVE_HIGH INGENIC_GPIO_NOBIAS>; // ingenic,cs-gpio = <&gpb 0 GPIO_ACTIVE_LOW INGENIC_GPIO_NOBIAS>; }; }; ``` **dpu 配置** ​ `ingenic,layer-framesize` 至少要大于等于最大分辨率尺寸。 ``` &dpu { status = "okay"; ingenic,disable-rdma-fb = <0>; ingenic,rot_angle = <0>; /*Defines the init state of composer fb export infomations.*/ ingenic,layer-exported = <0 1 1 0>; ingenic,layer-frames = <3 1 1 2>; ingenic,layer-framesize = <1728 1280>, <1728 1280>, <720 1080>, <320 240>; /*Max framesize for each layer.*/ layer,color_mode = <4 6 1 0>; /*src fmt,*/ layer,src-size = <720 1280>, <720 1280>, <720 1280>, <240 200>; /*Layer src size should smaller than framesize*/ layer,target-size = <720 1280>, <720 1280>, <720 1280>, <240 200>; /*Target Size should smaller than src_size.*/ layer,target-pos = <0 640>, <0 640>, <0 0>, <0 0>; /*target pos , the start point of the target panel.*/ layer,enable = <1 1 1 1>; /*layer enabled or disabled.*/ ingenic,logo-pan-layer = <2>; /*on which layer should init logo pan on.*/ layer,z_order = <1 2 3 0>; memory-region=<&reserved_memory>; lane2_pn_swap; lane3_pn_swap; }; ``` ### 2.2 kernel 配置 ```` symbol: STAGE_PANEL_ST7789P3 [=y] │ Type : tristate │ Defined at module_drivers/drivers/video/fbdev/ingenic/fb_stage_wip/displays/Kconfig:290 │ Prompt: spi panel st7789p3 240*320 │ Depends on: FB_INGENIC [=y] && FB_INGENIC_STAGE_WIP [=y] && FB_INGENIC_DISPLAYS_STAGE_WIP [=y] │ Location: │ -> Ingenic device-drivers Configurations │ -> [LCD] Panel/Touchscreen Drivers │ -> Ingenic Framebuffer Driver for stage wip (FB_INGENIC_STAGE_WIP [=y]) │ -> display stage wip Supported lcd panels (FB_INGENIC_DISPLAYS_STAGE_WIP [=y]) Symbol: FB_INGENIC_NR_FRAMES [=2] │ Type :integer │ Defined at module_drivers/drivers/video/fbdev/ingenic/Kconfig:27 │ Prompt: how many framessupport │ Depends on: FB_INGENIC [=y] │ Location: │ -> Ingenic device-drivers Configurations │ -> [LCD] Panel/Touchscreen Drivers │ -> Ingenic Framebuffer Driver (FB_INGENIC [=y]) Symbol: NOT_USE_LCD_INTERFACE [=y] │ Type :bool │ Defined at module_drivers/drivers/video/fbdev/ingenic/fb_stage_wip/Kconfig:27 │ Prompt: not use lcd interface, using fb frameworks │ Depends on: FB_INGENIC [=y] && FB_INGENIC_STAGE_WIP [=y] │ Location: │ -> Ingenic device-drivers Configurations │ -> [LCD] Panel/Touchscreen Drivers │ -> Ingenic Framebuffer Driver for stage wip (FB_INGENIC_STAGE_WIP [=y]) ```` ### 2.3 impp 配置 该 impp 使用的为 price_impp 库。 需要作出如下修改 ``` // 修改为 565 fmt dpu_osd.framedesc.func_desc.osd_frame.wback_fmt = IMPP_PIX_FMT_RGB_565; // 修改为 565 fmt osd->framedesc.func_desc.osd_frame.wback_fmt = osd->rotated == ROTATED_0 ? IMPP_PIX_FMT_RGB_565 : IMPP_PIX_FMT_ROTATE; ``` ## 三、编译 编译: make lvgl-feedback 清除: make lvgl-feedback-clean 最后编译出 feedback 应用,该应用依赖 impp-pricebase 编译出的 libimpp.so 。impp-pricebase 的编译会在 make feedback 阶段进行执行。 ## 四、执行 连接usb摄像头到开发板。 在 串口执行 cam_feedback ,观察屏幕是否有摄像头采集的内容。