mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
example(isp): added isp af example
This commit is contained in:
@@ -17,7 +17,7 @@ The subsections below give only absolutely necessary information. For full steps
|
||||
|
||||
This example requires:
|
||||
|
||||
- OV5647 camera sensor with VCM (Voice Coil Motor). The VCM used in this example is DW9714.
|
||||
- OV5647 camera sensor
|
||||
- ILI9881C LCD screen
|
||||
- ESP32P4 devkit
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "camera_dsi_main.c" "example_dsi_init.c"
|
||||
idf_component_register(SRCS "camera_dsi_main.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd
|
||||
REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd dsi_init
|
||||
)
|
||||
|
||||
@@ -12,8 +12,20 @@ menu "Example Configuration"
|
||||
help
|
||||
Example used LDO voltage, in mV
|
||||
|
||||
choice EXAMPLE_MIPI_CSI_VRES
|
||||
bool "Set MIPI CSI verticol resolution"
|
||||
choice EXAMPLE_MIPI_CSI_DISP_HRES
|
||||
bool "Set MIPI CSI horizontal resolution"
|
||||
default EXAMPLE_MIPI_CSI_HRES_800
|
||||
|
||||
config EXAMPLE_MIPI_CSI_HRES_800
|
||||
bool "800"
|
||||
endchoice
|
||||
|
||||
config EXAMPLE_MIPI_CSI_DISP_HRES
|
||||
int
|
||||
default 800 if EXAMPLE_MIPI_CSI_HRES_800
|
||||
|
||||
choice EXAMPLE_MIPI_CSI_DISP_VRES
|
||||
bool "Set MIPI CSI vertical resolution"
|
||||
default EXAMPLE_MIPI_CSI_VRES_640
|
||||
|
||||
config EXAMPLE_MIPI_CSI_VRES_640
|
||||
@@ -22,4 +34,8 @@ menu "Example Configuration"
|
||||
bool "1280"
|
||||
endchoice
|
||||
|
||||
config EXAMPLE_MIPI_CSI_DISP_VRES
|
||||
int
|
||||
default 640 if EXAMPLE_MIPI_CSI_VRES_640
|
||||
default 1280 if EXAMPLE_MIPI_CSI_VRES_1280
|
||||
endmenu
|
||||
|
||||
@@ -55,9 +55,9 @@ void app_main(void)
|
||||
example_dsi_resource_alloc(&ili9881c_ctrl_panel, &mipi_dpi_panel, &frame_buffer);
|
||||
|
||||
//---------------Necessary variable config------------------//
|
||||
frame_buffer_size = EXAMPLE_MIPI_CSI_DISP_HSIZE * EXAMPLE_MIPI_DSI_IMAGE_VSIZE * EXAMPLE_RGB565_BITS_PER_PIXEL / 8;
|
||||
frame_buffer_size = CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES * EXAMPLE_MIPI_DSI_IMAGE_VSIZE * EXAMPLE_RGB565_BITS_PER_PIXEL / 8;
|
||||
|
||||
ESP_LOGD(TAG, "EXAMPLE_MIPI_CSI_DISP_HSIZE: %d, EXAMPLE_MIPI_DSI_IMAGE_VSIZE: %d, bits per pixel: %d", EXAMPLE_MIPI_CSI_DISP_HSIZE, EXAMPLE_MIPI_DSI_IMAGE_VSIZE, 8);
|
||||
ESP_LOGD(TAG, "CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES: %d, EXAMPLE_MIPI_DSI_IMAGE_VSIZE: %d, bits per pixel: %d", CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES, EXAMPLE_MIPI_DSI_IMAGE_VSIZE, 8);
|
||||
ESP_LOGD(TAG, "frame_buffer_size: %zu", frame_buffer_size);
|
||||
ESP_LOGD(TAG, "frame_buffer: %p", frame_buffer);
|
||||
|
||||
@@ -89,12 +89,8 @@ void app_main(void)
|
||||
//---------------CSI Init------------------//
|
||||
esp_cam_ctlr_csi_config_t csi_config = {
|
||||
.ctlr_id = 0,
|
||||
.h_res = EXAMPLE_MIPI_CSI_DISP_HSIZE,
|
||||
#if CONFIG_EXAMPLE_MIPI_CSI_VRES_640
|
||||
.v_res = EXAMPLE_MIPI_CSI_DISP_VSIZE_640P,
|
||||
#else
|
||||
.v_res = EXAMPLE_MIPI_CSI_DISP_VSIZE_1280P,
|
||||
#endif
|
||||
.h_res = CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES,
|
||||
.v_res = CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES,
|
||||
.lane_bit_rate_mbps = EXAMPLE_MIPI_CSI_LANE_BITRATE_MBPS,
|
||||
.input_data_color_type = MIPI_CSI_COLOR_RAW8,
|
||||
.output_data_color_type = MIPI_CSI_COLOR_RGB565,
|
||||
@@ -129,12 +125,8 @@ void app_main(void)
|
||||
.output_data_color_type = ISP_COLOR_RGB565,
|
||||
.has_line_start_packet = false,
|
||||
.has_line_end_packet = false,
|
||||
.h_res = EXAMPLE_MIPI_CSI_DISP_HSIZE,
|
||||
#if CONFIG_EXAMPLE_MIPI_CSI_VRES_640
|
||||
.v_res = EXAMPLE_MIPI_CSI_DISP_VSIZE_640P,
|
||||
#else
|
||||
.v_res = EXAMPLE_MIPI_CSI_DISP_VSIZE_1280P,
|
||||
#endif
|
||||
.h_res = CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES,
|
||||
.v_res = CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES,
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_isp_new_processor(&isp_config, &isp_proc));
|
||||
ESP_ERROR_CHECK(esp_isp_enable(isp_proc));
|
||||
@@ -174,7 +166,6 @@ void app_main(void)
|
||||
|
||||
esp_cam_sensor_format_t *cam_cur_fmt = NULL;
|
||||
for (int i = 0; i < cam_fmt_array.count; i++) {
|
||||
|
||||
#if CONFIG_EXAMPLE_MIPI_CSI_VRES_640
|
||||
if (!strcmp(parray[i].name, "MIPI_2lane_24Minput_RAW8_800x640_50fps")) {
|
||||
cam_cur_fmt = (esp_cam_sensor_format_t *) & (parray[i].name);
|
||||
|
||||
@@ -12,24 +12,11 @@ extern "C" {
|
||||
|
||||
#define EXAMPLE_RGB565_BITS_PER_PIXEL 16
|
||||
#define EXAMPLE_MIPI_SCCB_FREQ (100000)
|
||||
#define EXAMPLE_MIPI_SCCB_SCL_IO (34)
|
||||
#define EXAMPLE_MIPI_SCCB_SDA_IO (31)
|
||||
#define EXAMPLE_MIPI_CSI_DISP_HSIZE 800
|
||||
#define EXAMPLE_MIPI_CSI_DISP_VSIZE_640P 640
|
||||
#define EXAMPLE_MIPI_CSI_DISP_VSIZE_1280P 1280
|
||||
#define EXAMPLE_MIPI_CSI_640P 1
|
||||
#define EXAMPLE_MIPI_SCCB_SCL_IO (8)
|
||||
#define EXAMPLE_MIPI_SCCB_SDA_IO (7)
|
||||
#define EXAMPLE_MIPI_IDI_CLOCK_RATE (50000000)
|
||||
#define EXAMPLE_MIPI_CSI_LANE_BITRATE_MBPS 200 //line_rate = pclk * 4
|
||||
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HSIZE 800
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VSIZE 1280
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HSYNC 40
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HBP 140
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HFP 40
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VSYNC 4
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VBP 16
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VFP 16
|
||||
|
||||
#define EXAMPLE_OV5647_DEV_ADDR 0x36
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3,3 +3,5 @@ dependencies:
|
||||
espressif/esp_lcd_ili9881c: "*"
|
||||
idf:
|
||||
version: ">=5.3.0"
|
||||
dsi_init:
|
||||
path: ${IDF_PATH}/examples/peripherals/camera/components/dsi_init
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
idf_component_register(SRCS "example_dsi_init.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES esp_lcd
|
||||
)
|
||||
@@ -6,14 +6,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_lcd_mipi_dsi.h"
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_lcd_ili9881c.h"
|
||||
#include "esp_ldo_regulator.h"
|
||||
#include "esp_cache.h"
|
||||
#include "example_dsi_init.h"
|
||||
#include "example_config.h"
|
||||
|
||||
void example_dsi_resource_alloc(esp_lcd_panel_handle_t *ili9881c_ctrl_panel, esp_lcd_panel_handle_t *mipi_dpi_panel, void **frame_buffer)
|
||||
{
|
||||
@@ -10,6 +10,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HSIZE 800
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VSIZE 1280
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HSYNC 40
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HBP 140
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_HFP 40
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VSYNC 4
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VBP 16
|
||||
#define EXAMPLE_MIPI_DSI_IMAGE_VFP 16
|
||||
|
||||
/**
|
||||
* @brief DSI init function
|
||||
*
|
||||
@@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
espressif/esp_lcd_ili9881c: "^0.2.0"
|
||||
idf:
|
||||
version: ">=5.3.0"
|
||||
Reference in New Issue
Block a user