diff --git a/examples/peripherals/camera/camera_dsi/README.md b/examples/peripherals/camera/camera_dsi/README.md index c078a675f3..817f78674d 100644 --- a/examples/peripherals/camera/camera_dsi/README.md +++ b/examples/peripherals/camera/camera_dsi/README.md @@ -17,10 +17,17 @@ The subsections below give only absolutely necessary information. For full steps This example requires: -- OV5647 camera sensor -- ILI9881C LCD screen +- SC2336 or OV5647 camera sensor +- EK79007 or ILI9881C LCD screen - ESP32P4 devkit +**Note:** For EK79007 you will need to connect following pins: +- 5V - 5V +- GND - GND +- RST_LCD - 3V3 + +You can also connect camera sensors and LCD screens from other vendors to the ESP chip, you can find corresponding camera or LCD drivers from [ESP Component Registry](https://components.espressif.com), or design your own customized drivers. + GND GND ┌────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────┐ @@ -40,7 +47,7 @@ This example requires: │ ├──────────────────────┤ │ DSI DATA 1N │ │ │ │ │ ├───────────────────────────┤ │ │ │ CSI DATA 1N │ ESP32-P4 │ │ │ - │ OV5647 ├──────────────────────┤ │ DSI CLK N │ ILI9881C │ + │ Camera ├──────────────────────┤ │ DSI CLK N │ LCD Screen │ │ │ │ ├───────────────────────────┤ │ │ │ CSI CLK N │ │ │ │ │ ├──────────────────────┤ │ DSI CLK P │ │ diff --git a/examples/peripherals/camera/camera_dsi/components/dsi_init/Kconfig.projbuild b/examples/peripherals/camera/camera_dsi/components/dsi_init/Kconfig.projbuild index c67e3516ad..6e81a71006 100644 --- a/examples/peripherals/camera/camera_dsi/components/dsi_init/Kconfig.projbuild +++ b/examples/peripherals/camera/camera_dsi/components/dsi_init/Kconfig.projbuild @@ -1,25 +1,48 @@ menu "Example DSI Configuration" + + choice EXAMPLE_LCD_PATTERN + prompt "Select MIPI LCD model" + default EXAMPLE_LCD_PATTERN_EK79007 + help + Select LCD controller model. + + config EXAMPLE_LCD_PATTERN_EK79007 + bool "EK79007" + config EXAMPLE_LCD_PATTERN_ILI9881C + bool "ILI9881C" + endchoice + choice EXAMPLE_MIPI_DSI_DISP_HRES bool "Set MIPI CSI horizontal resolution" + default EXAMPLE_MIPI_DSI_DISP_HRES_800 if EXAMPLE_LCD_PATTERN_ILI9881C + default EXAMPLE_MIPI_DSI_DISP_HRES_1024 if EXAMPLE_LCD_PATTERN_EK79007 default EXAMPLE_MIPI_DSI_DISP_HRES_800 config EXAMPLE_MIPI_DSI_DISP_HRES_800 bool "800" + config EXAMPLE_MIPI_DSI_DISP_HRES_1024 + bool "1024" endchoice config EXAMPLE_MIPI_DSI_DISP_HRES int default 800 if EXAMPLE_MIPI_DSI_DISP_HRES_800 + default 1024 if EXAMPLE_MIPI_DSI_DISP_HRES_1024 choice EXAMPLE_MIPI_DSI_DISP_VRES bool "Set MIPI CSI vertical resolution" + default EXAMPLE_MIPI_DSI_DISP_VRES_1280 if EXAMPLE_LCD_PATTERN_ILI9881C + default EXAMPLE_MIPI_DSI_DISP_VRES_600 if EXAMPLE_LCD_PATTERN_EK79007 default EXAMPLE_MIPI_DSI_DISP_VRES_1280 + config EXAMPLE_MIPI_DSI_DISP_VRES_600 + bool "600" config EXAMPLE_MIPI_DSI_DISP_VRES_1280 bool "1280" endchoice config EXAMPLE_MIPI_DSI_DISP_VRES int + default 600 if EXAMPLE_MIPI_DSI_DISP_VRES_600 default 1280 if EXAMPLE_MIPI_DSI_DISP_VRES_1280 endmenu diff --git a/examples/peripherals/camera/camera_dsi/components/dsi_init/example_dsi_init.c b/examples/peripherals/camera/camera_dsi/components/dsi_init/example_dsi_init.c index d660820791..9424c27960 100644 --- a/examples/peripherals/camera/camera_dsi/components/dsi_init/example_dsi_init.c +++ b/examples/peripherals/camera/camera_dsi/components/dsi_init/example_dsi_init.c @@ -10,10 +10,11 @@ #include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_io.h" #include "esp_lcd_ili9881c.h" +#include "esp_lcd_ek79007.h" #include "example_dsi_init.h" #include "example_dsi_init_config.h" -void example_dsi_resource_alloc(esp_lcd_panel_handle_t *ili9881c_ctrl_panel, esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_panel_io_handle_t *mipi_dbi_io, esp_lcd_panel_handle_t *mipi_dpi_panel, void **frame_buffer) +void example_dsi_resource_alloc(esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_panel_io_handle_t *mipi_dbi_io, esp_lcd_panel_handle_t *mipi_dpi_panel, void **frame_buffer) { //---------------DSI resource allocation------------------// esp_lcd_dsi_bus_config_t bus_config = { @@ -31,16 +32,9 @@ void example_dsi_resource_alloc(esp_lcd_panel_handle_t *ili9881c_ctrl_panel, esp }; ESP_ERROR_CHECK(esp_lcd_new_panel_io_dbi(*mipi_dsi_bus, &dbi_config, mipi_dbi_io)); - esp_lcd_panel_dev_config_t lcd_dev_config = { - .bits_per_pixel = 16, - .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, - .reset_gpio_num = -1, - }; - ESP_ERROR_CHECK(esp_lcd_new_panel_ili9881c(*mipi_dbi_io, &lcd_dev_config, ili9881c_ctrl_panel)); - esp_lcd_dpi_panel_config_t dpi_config = { .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = 80, + .dpi_clock_freq_mhz = EXAMPLE_MIPI_DSI_DPI_CLK_MHZ, .virtual_channel = 0, .pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565, .video_timing = { @@ -54,17 +48,45 @@ void example_dsi_resource_alloc(esp_lcd_panel_handle_t *ili9881c_ctrl_panel, esp .vsync_front_porch = EXAMPLE_MIPI_DSI_IMAGE_VFP, }, }; - ESP_ERROR_CHECK(esp_lcd_new_panel_dpi(*mipi_dsi_bus, &dpi_config, mipi_dpi_panel)); + +#if CONFIG_EXAMPLE_LCD_PATTERN_ILI9881C + ili9881c_vendor_config_t vendor_config = { + .mipi_config = { + .dsi_bus = *mipi_dsi_bus, + .dpi_config = &dpi_config, + .lane_num = 2, + }, + }; + esp_lcd_panel_dev_config_t lcd_dev_config = { + .reset_gpio_num = -1, + .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, + .bits_per_pixel = 16, + .vendor_config = &vendor_config, + }; + ESP_ERROR_CHECK(esp_lcd_new_panel_ili9881c(*mipi_dbi_io, &lcd_dev_config, mipi_dpi_panel)); +#elif CONFIG_EXAMPLE_LCD_PATTERN_EK79007 + ek79007_vendor_config_t vendor_config = { + .mipi_config = { + .dsi_bus = *mipi_dsi_bus, + .dpi_config = &dpi_config, + }, + }; + esp_lcd_panel_dev_config_t lcd_dev_config = { + .reset_gpio_num = -1, + .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, + .bits_per_pixel = 16, + .vendor_config = &vendor_config, + }; + ESP_ERROR_CHECK(esp_lcd_new_panel_ek79007(*mipi_dbi_io, &lcd_dev_config, mipi_dpi_panel)); +#endif + ESP_ERROR_CHECK(esp_lcd_dpi_panel_get_frame_buffer(*mipi_dpi_panel, 1, frame_buffer)); } -void example_dsi_ili9881c_panel_init(esp_lcd_panel_handle_t ili9881c_ctrl_panel) +void example_dpi_panel_reset(esp_lcd_panel_handle_t mipi_dpi_panel) { - //---------------DSI Panel Init------------------// - ESP_ERROR_CHECK(esp_lcd_panel_reset(ili9881c_ctrl_panel)); - ESP_ERROR_CHECK(esp_lcd_panel_init(ili9881c_ctrl_panel)); - // turn on display - ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(ili9881c_ctrl_panel, true)); + //---------------DPI Panel Reset------------------// + ESP_ERROR_CHECK(esp_lcd_panel_reset(mipi_dpi_panel)); } void example_dpi_panel_init(esp_lcd_panel_handle_t mipi_dpi_panel) @@ -73,10 +95,9 @@ void example_dpi_panel_init(esp_lcd_panel_handle_t mipi_dpi_panel) ESP_ERROR_CHECK(esp_lcd_panel_init(mipi_dpi_panel)); } -void example_dsi_resource_destroy(esp_lcd_panel_handle_t ili9881c_ctrl_panel, esp_lcd_dsi_bus_handle_t mipi_dsi_bus, esp_lcd_panel_io_handle_t mipi_dbi_io, esp_lcd_panel_handle_t mipi_dpi_panel) +void example_dsi_resource_destroy(esp_lcd_dsi_bus_handle_t mipi_dsi_bus, esp_lcd_panel_io_handle_t mipi_dbi_io, esp_lcd_panel_handle_t mipi_dpi_panel) { ESP_ERROR_CHECK(esp_lcd_panel_del(mipi_dpi_panel)); - ESP_ERROR_CHECK(esp_lcd_panel_del(ili9881c_ctrl_panel)); ESP_ERROR_CHECK(esp_lcd_panel_io_del(mipi_dbi_io)); ESP_ERROR_CHECK(esp_lcd_del_dsi_bus(mipi_dsi_bus)); } diff --git a/examples/peripherals/camera/camera_dsi/components/dsi_init/idf_component.yml b/examples/peripherals/camera/camera_dsi/components/dsi_init/idf_component.yml index 3d1a63b550..74648de8a9 100644 --- a/examples/peripherals/camera/camera_dsi/components/dsi_init/idf_component.yml +++ b/examples/peripherals/camera/camera_dsi/components/dsi_init/idf_component.yml @@ -1,4 +1,5 @@ dependencies: - esp_lcd_ili9881c: "~0.2.0" + esp_lcd_ili9881c: "^1.0.0" + esp_lcd_ek79007: "^1.0.0" idf: version: ">=5.3.0" diff --git a/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init.h b/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init.h index d495e5d6ce..433c3d0881 100644 --- a/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init.h +++ b/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init.h @@ -8,7 +8,6 @@ #include "esp_lcd_mipi_dsi.h" #include "esp_lcd_panel_ops.h" -#include "esp_lcd_ili9881c.h" #ifdef __cplusplus extern "C" { @@ -17,20 +16,19 @@ extern "C" { /** * @brief DSI init function * - * @param[out] ili9881c_ctrl_panel ILI9881C panel handle * @param[out] mipi_dsi_bus MIPI DSI bus handle * @param[out] mipi_dbi_io MIPI DBI io handle * @param[out] mipi_dpi_panel MIPI DPI panel handle * @param[out] frame_buffer frame buffer */ -void example_dsi_resource_alloc(esp_lcd_panel_handle_t *ili9881c_ctrl_panel, esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_panel_io_handle_t *mipi_dbi_io, esp_lcd_panel_handle_t *mipi_dpi_panel, void **frame_buffer); +void example_dsi_resource_alloc(esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_panel_io_handle_t *mipi_dbi_io, esp_lcd_panel_handle_t *mipi_dpi_panel, void **frame_buffer); /** - * @brief DSI ILI9881C panel init function + * @brief DPI panel reset function * - * @param[in] ili9881c_ctrl_panel ILI9881C panel handle + * @param[in] mipi_dpi_panel MIPI DPI panel handle */ -void example_dsi_ili9881c_panel_init(esp_lcd_panel_handle_t ili9881c_ctrl_panel); +void example_dpi_panel_reset(esp_lcd_panel_handle_t mipi_dpi_panel); /** * @brief DPI panel init function @@ -42,12 +40,11 @@ void example_dpi_panel_init(esp_lcd_panel_handle_t mipi_dpi_panel); /** * @brief Destroy DSI related resources * - * @param[in] ili9881c_ctrl_panel ILI9881C panel handle * @param[in] mipi_dsi_bus MIPI DSI bus handle * @param[in] mipi_dbi_io MIPI DBI io handle * @param[in] mipi_dpi_panel MIPI DPI panel handle */ -void example_dsi_resource_destroy(esp_lcd_panel_handle_t ili9881c_ctrl_panel, esp_lcd_dsi_bus_handle_t mipi_dsi_bus, esp_lcd_panel_io_handle_t mipi_dbi_io, esp_lcd_panel_handle_t mipi_dpi_panel); +void example_dsi_resource_destroy(esp_lcd_dsi_bus_handle_t mipi_dsi_bus, esp_lcd_panel_io_handle_t mipi_dbi_io, esp_lcd_panel_handle_t mipi_dpi_panel); #ifdef __cplusplus } diff --git a/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init_config.h b/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init_config.h index c804154298..b27fcb2239 100644 --- a/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init_config.h +++ b/examples/peripherals/camera/camera_dsi/components/dsi_init/include/example_dsi_init_config.h @@ -6,16 +6,31 @@ #pragma once +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif -#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 +#if CONFIG_EXAMPLE_LCD_PATTERN_ILI9881C +// FPS = 80000000/(40+140+40+800)/(4+16+16+1280) = 60Hz +#define EXAMPLE_MIPI_DSI_DPI_CLK_MHZ 80 +#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 +#elif CONFIG_EXAMPLE_LCD_PATTERN_EK79007 +// FPS = 48000000/(10+120+120+1024)/(1+20+10+600) = 60Hz +#define EXAMPLE_MIPI_DSI_DPI_CLK_MHZ 48 +#define EXAMPLE_MIPI_DSI_IMAGE_HSYNC 10 +#define EXAMPLE_MIPI_DSI_IMAGE_HBP 120 +#define EXAMPLE_MIPI_DSI_IMAGE_HFP 120 +#define EXAMPLE_MIPI_DSI_IMAGE_VSYNC 1 +#define EXAMPLE_MIPI_DSI_IMAGE_VBP 20 +#define EXAMPLE_MIPI_DSI_IMAGE_VFP 10 +#endif #ifdef __cplusplus } diff --git a/examples/peripherals/camera/camera_dsi/components/sensor_init/CMakeLists.txt b/examples/peripherals/camera/camera_dsi/components/sensor_init/CMakeLists.txt new file mode 100644 index 0000000000..6fb9927a89 --- /dev/null +++ b/examples/peripherals/camera/camera_dsi/components/sensor_init/CMakeLists.txt @@ -0,0 +1,3 @@ +idf_component_register(SRCS "example_sensor_init.c" + INCLUDE_DIRS "include" + ) diff --git a/examples/peripherals/camera/camera_dsi/components/sensor_init/example_sensor_init.c b/examples/peripherals/camera/camera_dsi/components/sensor_init/example_sensor_init.c new file mode 100644 index 0000000000..89346eee92 --- /dev/null +++ b/examples/peripherals/camera/camera_dsi/components/sensor_init/example_sensor_init.c @@ -0,0 +1,102 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include "sdkconfig.h" +#include "esp_attr.h" +#include "esp_log.h" +#include "esp_err.h" +#include "driver/i2c_master.h" +#include "esp_sccb_intf.h" +#include "esp_sccb_i2c.h" +#include "esp_cam_sensor.h" +#include "esp_cam_sensor_detect.h" +#include "example_sensor_init.h" +#include "example_sensor_init_config.h" + +static const char *TAG = "sensor_init"; + +void example_sensor_init(int i2c_port, i2c_master_bus_handle_t *out_i2c_bus_handle) +{ + esp_err_t ret = ESP_FAIL; + + //---------------I2C Init------------------// + i2c_master_bus_config_t i2c_bus_conf = { + .clk_source = I2C_CLK_SRC_DEFAULT, + .sda_io_num = EXAMPLE_CAM_SCCB_SDA_IO, + .scl_io_num = EXAMPLE_CAM_SCCB_SCL_IO, + .i2c_port = i2c_port, + .flags.enable_internal_pullup = true, + }; + i2c_master_bus_handle_t i2c_bus_handle = NULL; + ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_conf, &i2c_bus_handle)); + + //---------------SCCB Init------------------// + esp_sccb_io_handle_t sccb_io_handle = NULL; + esp_cam_sensor_config_t cam_config = { + .sccb_handle = sccb_io_handle, + .reset_pin = -1, + .pwdn_pin = -1, + .xclk_pin = -1, + .sensor_port = ESP_CAM_SENSOR_MIPI_CSI, + }; + + esp_cam_sensor_device_t *cam = NULL; + for (esp_cam_sensor_detect_fn_t *p = &__esp_cam_sensor_detect_fn_array_start; p < &__esp_cam_sensor_detect_fn_array_end; ++p) { + sccb_i2c_config_t i2c_config = { + .scl_speed_hz = EXAMPLE_CAM_SCCB_FREQ, + .device_address = p->sccb_addr, + .dev_addr_length = I2C_ADDR_BIT_LEN_7, + }; + ESP_ERROR_CHECK(sccb_new_i2c_io(i2c_bus_handle, &i2c_config, &cam_config.sccb_handle)); + + cam = (*(p->detect))(&cam_config); + if (cam) { + if (p->port != ESP_CAM_SENSOR_MIPI_CSI) { + ESP_LOGE(TAG, "detect a camera sensor with mismatched interface"); + return; + } + break; + } + ESP_ERROR_CHECK(esp_sccb_del_i2c_io(cam_config.sccb_handle)); + } + + if (!cam) { + ESP_LOGE(TAG, "failed to detect camera sensor"); + return; + } + + esp_cam_sensor_format_array_t cam_fmt_array = {0}; + esp_cam_sensor_query_format(cam, &cam_fmt_array); + const esp_cam_sensor_format_t *parray = cam_fmt_array.format_array; + for (int i = 0; i < cam_fmt_array.count; i++) { + ESP_LOGI(TAG, "fmt[%d].name:%s", i, parray[i].name); + } + + esp_cam_sensor_format_t *cam_cur_fmt = NULL; + for (int i = 0; i < cam_fmt_array.count; i++) { + if (!strcmp(parray[i].name, EXAMPLE_CAM_FORMAT)) { + cam_cur_fmt = (esp_cam_sensor_format_t *) & (parray[i].name); + } + } + + ret = esp_cam_sensor_set_format(cam, (const esp_cam_sensor_format_t *) cam_cur_fmt); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Format set fail"); + } else { + ESP_LOGI(TAG, "Format in use:%s", cam_cur_fmt->name); + } + int enable_flag = 1; + // Set sensor output stream + ret = esp_cam_sensor_ioctl(cam, ESP_CAM_SENSOR_IOC_S_STREAM, &enable_flag); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Start stream fail"); + } + ESP_ERROR_CHECK(ret); + + *out_i2c_bus_handle = i2c_bus_handle; +} diff --git a/examples/peripherals/camera/camera_dsi/components/sensor_init/idf_component.yml b/examples/peripherals/camera/camera_dsi/components/sensor_init/idf_component.yml new file mode 100644 index 0000000000..fbd8f4b028 --- /dev/null +++ b/examples/peripherals/camera/camera_dsi/components/sensor_init/idf_component.yml @@ -0,0 +1,4 @@ +dependencies: + espressif/esp_cam_sensor: "^0.5.1" + idf: + version: ">=5.3.0" diff --git a/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init.h b/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init.h new file mode 100644 index 0000000000..c2e1db3d31 --- /dev/null +++ b/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init.h @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "driver/i2c_master.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief SCCB Interface and Sensor Init + * + * @param[in] i2c_port I2C port + * @param[out] out_i2c_bus_handle I2C bus handle + */ +void example_sensor_init(int i2c_port, i2c_master_bus_handle_t *out_i2c_bus_handle); + +#ifdef __cplusplus +} +#endif diff --git a/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init_config.h b/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init_config.h new file mode 100644 index 0000000000..889122dbe1 --- /dev/null +++ b/examples/peripherals/camera/camera_dsi/components/sensor_init/include/example_sensor_init_config.h @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "sdkconfig.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define EXAMPLE_CAM_SCCB_FREQ (100000) +#define EXAMPLE_CAM_SCCB_SCL_IO (8) +#define EXAMPLE_CAM_SCCB_SDA_IO (7) + +#if CONFIG_EXAMPLE_MIPI_CSI_HRES_800 +#if CONFIG_EXAMPLE_MIPI_CSI_VRES_640 +#define EXAMPLE_CAM_FORMAT "MIPI_2lane_24Minput_RAW8_800x640_50fps" +#else +#define EXAMPLE_CAM_FORMAT "MIPI_2lane_24Minput_RAW8_800x1280_50fps" +#endif +#endif + +#if CONFIG_EXAMPLE_MIPI_CSI_HRES_1024 +#define EXAMPLE_CAM_FORMAT "MIPI_2lane_24Minput_RAW8_1024x600_30fps" +#endif + +#ifdef __cplusplus +} +#endif diff --git a/examples/peripherals/camera/camera_dsi/main/CMakeLists.txt b/examples/peripherals/camera/camera_dsi/main/CMakeLists.txt index e760975a48..545dc327d2 100644 --- a/examples/peripherals/camera/camera_dsi/main/CMakeLists.txt +++ b/examples/peripherals/camera/camera_dsi/main/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "camera_dsi_main.c" INCLUDE_DIRS "." - REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c dsi_init + REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c dsi_init sensor_init ) diff --git a/examples/peripherals/camera/camera_dsi/main/Kconfig.projbuild b/examples/peripherals/camera/camera_dsi/main/Kconfig.projbuild index 8117f6ef7b..98a42e128a 100644 --- a/examples/peripherals/camera/camera_dsi/main/Kconfig.projbuild +++ b/examples/peripherals/camera/camera_dsi/main/Kconfig.projbuild @@ -14,20 +14,25 @@ menu "Example Configuration" choice EXAMPLE_MIPI_CSI_DISP_HRES bool "Set MIPI CSI horizontal resolution" - default EXAMPLE_MIPI_CSI_HRES_800 + default EXAMPLE_MIPI_CSI_HRES_1024 config EXAMPLE_MIPI_CSI_HRES_800 bool "800" + config EXAMPLE_MIPI_CSI_HRES_1024 + bool "1024" endchoice config EXAMPLE_MIPI_CSI_DISP_HRES int default 800 if EXAMPLE_MIPI_CSI_HRES_800 + default 1024 if EXAMPLE_MIPI_CSI_HRES_1024 choice EXAMPLE_MIPI_CSI_DISP_VRES bool "Set MIPI CSI vertical resolution" - default EXAMPLE_MIPI_CSI_VRES_640 + default EXAMPLE_MIPI_CSI_VRES_600 + config EXAMPLE_MIPI_CSI_VRES_600 + bool "600" config EXAMPLE_MIPI_CSI_VRES_640 bool "640" config EXAMPLE_MIPI_CSI_VRES_1280 @@ -36,6 +41,7 @@ menu "Example Configuration" config EXAMPLE_MIPI_CSI_DISP_VRES int + default 600 if EXAMPLE_MIPI_CSI_VRES_600 default 640 if EXAMPLE_MIPI_CSI_VRES_640 default 1280 if EXAMPLE_MIPI_CSI_VRES_1280 endmenu diff --git a/examples/peripherals/camera/camera_dsi/main/camera_dsi_main.c b/examples/peripherals/camera/camera_dsi/main/camera_dsi_main.c index fa17cffaa0..ae8f0e2443 100644 --- a/examples/peripherals/camera/camera_dsi/main/camera_dsi_main.c +++ b/examples/peripherals/camera/camera_dsi/main/camera_dsi_main.c @@ -6,24 +6,21 @@ #include #include #include +#include "sdkconfig.h" #include "esp_attr.h" #include "esp_log.h" #include "freertos/FreeRTOS.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 "driver/i2c_master.h" #include "driver/isp.h" #include "esp_cam_ctlr_csi.h" #include "esp_cam_ctlr.h" -#include "esp_sccb_intf.h" -#include "esp_sccb_i2c.h" -#include "esp_cam_sensor.h" -#include "ov5647.h" #include "example_dsi_init.h" #include "example_dsi_init_config.h" +#include "example_sensor_init.h" #include "example_config.h" static const char *TAG = "cam_dsi"; @@ -36,7 +33,6 @@ void app_main(void) esp_err_t ret = ESP_FAIL; esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL; esp_lcd_panel_io_handle_t mipi_dbi_io = NULL; - esp_lcd_panel_handle_t ili9881c_ctrl_panel = NULL; esp_lcd_panel_handle_t mipi_dpi_panel = NULL; void *frame_buffer = NULL; size_t frame_buffer_size = 0; @@ -55,7 +51,7 @@ void app_main(void) * ISP convert to RGB565 */ //---------------DSI Init------------------// - example_dsi_resource_alloc(&ili9881c_ctrl_panel, &mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, &frame_buffer); + example_dsi_resource_alloc(&mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, &frame_buffer); //---------------Necessary variable config------------------// frame_buffer_size = CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES * CONFIG_EXAMPLE_MIPI_DSI_DISP_VRES * EXAMPLE_RGB565_BITS_PER_PIXEL / 8; @@ -69,25 +65,9 @@ void app_main(void) .buflen = frame_buffer_size, }; - //---------------I2C Init------------------// - i2c_master_bus_config_t i2c_bus_conf = { - .clk_source = I2C_CLK_SRC_DEFAULT, - .sda_io_num = EXAMPLE_MIPI_SCCB_SDA_IO, - .scl_io_num = EXAMPLE_MIPI_SCCB_SCL_IO, - .i2c_port = I2C_NUM_0, - .flags.enable_internal_pullup = true, - }; - i2c_master_bus_handle_t bus_handle = NULL; - ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_conf, &bus_handle)); - - //---------------SCCB Init------------------// - esp_sccb_io_handle_t ov5647_io_handle = NULL; - sccb_i2c_config_t i2c_config = { - .scl_speed_hz = EXAMPLE_MIPI_SCCB_FREQ, - .device_address = EXAMPLE_OV5647_DEV_ADDR, - .dev_addr_length = I2C_ADDR_BIT_LEN_7, - }; - ESP_ERROR_CHECK(sccb_new_i2c_io(bus_handle, &i2c_config, &ov5647_io_handle)); + //--------Camera Sensor and SCCB Init-----------// + i2c_master_bus_handle_t i2c_bus_handle = NULL; + example_sensor_init(I2C_NUM_0, &i2c_bus_handle); //---------------CSI Init------------------// esp_cam_ctlr_csi_config_t csi_config = { @@ -134,8 +114,8 @@ void app_main(void) ESP_ERROR_CHECK(esp_isp_new_processor(&isp_config, &isp_proc)); ESP_ERROR_CHECK(esp_isp_enable(isp_proc)); - //---------------DSI Panel Init------------------// - example_dsi_ili9881c_panel_init(ili9881c_ctrl_panel); + //---------------DPI Reset------------------// + example_dpi_panel_reset(mipi_dpi_panel); //init to all white memset(frame_buffer, 0xFF, frame_buffer_size); @@ -146,53 +126,6 @@ void app_main(void) return; } - esp_cam_sensor_config_t cam_config = { - .sccb_handle = ov5647_io_handle, - .reset_pin = -1, - .pwdn_pin = -1, - .xclk_pin = -1, - .sensor_port = ESP_CAM_SENSOR_MIPI_CSI, - }; - - esp_cam_sensor_device_t *cam = ov5647_detect(&cam_config); - if (!cam) { - ESP_LOGE(TAG, "failed to detect 5647"); - return; - } - - esp_cam_sensor_format_array_t cam_fmt_array = {0}; - esp_cam_sensor_query_format(cam, &cam_fmt_array); - const esp_cam_sensor_format_t *parray = cam_fmt_array.format_array; - for (int i = 0; i < cam_fmt_array.count; i++) { - ESP_LOGI(TAG, "fmt[%d].name:%s", i, parray[i].name); - } - - 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); - } -#else - if (!strcmp(parray[i].name, "MIPI_2lane_24Minput_RAW8_800x1280_50fps")) { - cam_cur_fmt = (esp_cam_sensor_format_t *) & (parray[i].name); - } -#endif - } - - ret = esp_cam_sensor_set_format(cam, (const esp_cam_sensor_format_t *) cam_cur_fmt); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Format set fail"); - } else { - ESP_LOGI(TAG, "Format in use:%s", cam_cur_fmt->name); - } - int enable_flag = 1; - // Set sensor output stream - ret = esp_cam_sensor_ioctl(cam, ESP_CAM_SENSOR_IOC_S_STREAM, &enable_flag); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Start stream fail"); - } - example_dpi_panel_init(mipi_dpi_panel); while (1) { diff --git a/examples/peripherals/camera/camera_dsi/main/example_config.h b/examples/peripherals/camera/camera_dsi/main/example_config.h index c72a6b02ea..8e5ad61cdf 100644 --- a/examples/peripherals/camera/camera_dsi/main/example_config.h +++ b/examples/peripherals/camera/camera_dsi/main/example_config.h @@ -11,13 +11,9 @@ extern "C" { #endif #define EXAMPLE_RGB565_BITS_PER_PIXEL 16 -#define EXAMPLE_MIPI_SCCB_FREQ (100000) -#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_OV5647_DEV_ADDR 0x36 #ifdef __cplusplus } #endif diff --git a/examples/peripherals/camera/camera_dsi/main/idf_component.yml b/examples/peripherals/camera/camera_dsi/main/idf_component.yml index ad2ccad8d6..363caa48c9 100644 --- a/examples/peripherals/camera/camera_dsi/main/idf_component.yml +++ b/examples/peripherals/camera/camera_dsi/main/idf_component.yml @@ -1,7 +1,7 @@ dependencies: - espressif/esp_cam_sensor: "^0.5.1" - espressif/esp_lcd_ili9881c: "~0.2.0" idf: version: ">=5.3.0" dsi_init: path: ${IDF_PATH}/examples/peripherals/camera/camera_dsi/components/dsi_init + sensor_init: + path: ${IDF_PATH}/examples/peripherals/camera/camera_dsi/components/sensor_init diff --git a/examples/peripherals/camera/camera_dsi/sdkconfig.defaults b/examples/peripherals/camera/camera_dsi/sdkconfig.defaults index 7c4a698932..6192f176b4 100644 --- a/examples/peripherals/camera/camera_dsi/sdkconfig.defaults +++ b/examples/peripherals/camera/camera_dsi/sdkconfig.defaults @@ -1,4 +1,5 @@ CONFIG_SPIRAM=y CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_SPIRAM_SPEED_200M=y +CONFIG_CAMERA_SC2336=y CONFIG_CAMERA_OV5647=y diff --git a/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt b/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt index 32c38fe02a..48af6aee24 100644 --- a/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt +++ b/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "isp_dsi_main.c" INCLUDE_DIRS "." - REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd dsi_init + REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd dsi_init sensor_init ) diff --git a/examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild b/examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild index 8117f6ef7b..98a42e128a 100644 --- a/examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild +++ b/examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild @@ -14,20 +14,25 @@ menu "Example Configuration" choice EXAMPLE_MIPI_CSI_DISP_HRES bool "Set MIPI CSI horizontal resolution" - default EXAMPLE_MIPI_CSI_HRES_800 + default EXAMPLE_MIPI_CSI_HRES_1024 config EXAMPLE_MIPI_CSI_HRES_800 bool "800" + config EXAMPLE_MIPI_CSI_HRES_1024 + bool "1024" endchoice config EXAMPLE_MIPI_CSI_DISP_HRES int default 800 if EXAMPLE_MIPI_CSI_HRES_800 + default 1024 if EXAMPLE_MIPI_CSI_HRES_1024 choice EXAMPLE_MIPI_CSI_DISP_VRES bool "Set MIPI CSI vertical resolution" - default EXAMPLE_MIPI_CSI_VRES_640 + default EXAMPLE_MIPI_CSI_VRES_600 + config EXAMPLE_MIPI_CSI_VRES_600 + bool "600" config EXAMPLE_MIPI_CSI_VRES_640 bool "640" config EXAMPLE_MIPI_CSI_VRES_1280 @@ -36,6 +41,7 @@ menu "Example Configuration" config EXAMPLE_MIPI_CSI_DISP_VRES int + default 600 if EXAMPLE_MIPI_CSI_VRES_600 default 640 if EXAMPLE_MIPI_CSI_VRES_640 default 1280 if EXAMPLE_MIPI_CSI_VRES_1280 endmenu diff --git a/examples/peripherals/isp/multi_pipelines/main/example_config.h b/examples/peripherals/isp/multi_pipelines/main/example_config.h index 628a441f56..00775fd4c4 100644 --- a/examples/peripherals/isp/multi_pipelines/main/example_config.h +++ b/examples/peripherals/isp/multi_pipelines/main/example_config.h @@ -12,12 +12,8 @@ extern "C" { #define EXAMPLE_RGB565_BITS_PER_PIXEL 16 #define EXAMPLE_MIPI_SCCB_FREQ (100000) -#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_OV5647_DEV_ADDR 0x36 #define EXAMPLE_DW9714_DEV_ADDR 0xC #ifdef __cplusplus } diff --git a/examples/peripherals/isp/multi_pipelines/main/idf_component.yml b/examples/peripherals/isp/multi_pipelines/main/idf_component.yml index eddc6c99e9..3ba04971a7 100644 --- a/examples/peripherals/isp/multi_pipelines/main/idf_component.yml +++ b/examples/peripherals/isp/multi_pipelines/main/idf_component.yml @@ -1,9 +1,10 @@ dependencies: espressif/esp_cam_sensor: "^0.5.*" - espressif/esp_lcd_ili9881c: "~0.2.0" idf: version: ">=5.3.0" isp_af_schemes: path: ${IDF_PATH}/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes dsi_init: path: ${IDF_PATH}/examples/peripherals/camera/camera_dsi/components/dsi_init + sensor_init: + path: ${IDF_PATH}/examples/peripherals/camera/camera_dsi/components/sensor_init diff --git a/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c b/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c index 17259e7ca5..15a9289cf6 100644 --- a/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c +++ b/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c @@ -7,12 +7,12 @@ #include #include #include +#include "sdkconfig.h" #include "freertos/FreeRTOS.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 "driver/i2c_master.h" @@ -23,9 +23,9 @@ #include "esp_sccb_intf.h" #include "esp_sccb_i2c.h" #include "esp_cam_sensor.h" -#include "ov5647.h" #include "example_dsi_init.h" #include "example_dsi_init_config.h" +#include "example_sensor_init.h" #include "example_config.h" static const char *TAG = "isp_dsi"; @@ -190,7 +190,6 @@ void app_main(void) esp_err_t ret = ESP_FAIL; esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL; esp_lcd_panel_io_handle_t mipi_dbi_io = NULL; - esp_lcd_panel_handle_t ili9881c_ctrl_panel = NULL; esp_lcd_panel_handle_t mipi_dpi_panel = NULL; void *frame_buffer = NULL; size_t frame_buffer_size = 0; @@ -209,7 +208,7 @@ void app_main(void) * ISP convert to RGB565 */ //---------------DSI Init------------------// - example_dsi_resource_alloc(&ili9881c_ctrl_panel, &mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, &frame_buffer); + example_dsi_resource_alloc(&mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, &frame_buffer); //---------------Necessary variable config------------------// frame_buffer_size = CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES * CONFIG_EXAMPLE_MIPI_DSI_DISP_VRES * EXAMPLE_RGB565_BITS_PER_PIXEL / 8; @@ -223,29 +222,18 @@ void app_main(void) .buflen = frame_buffer_size, }; - //---------------I2C Init------------------// - i2c_master_bus_config_t i2c_bus_conf = { - .clk_source = I2C_CLK_SRC_DEFAULT, - .sda_io_num = EXAMPLE_MIPI_SCCB_SDA_IO, - .scl_io_num = EXAMPLE_MIPI_SCCB_SCL_IO, - .i2c_port = I2C_NUM_0, - .flags.enable_internal_pullup = true, - }; - i2c_master_bus_handle_t bus_handle = NULL; - ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_conf, &bus_handle)); + //--------Camera Sensor and SCCB Init-----------// + i2c_master_bus_handle_t i2c_bus_handle = NULL; + example_sensor_init(I2C_NUM_0, &i2c_bus_handle); - //---------------SCCB Init------------------// - esp_sccb_io_handle_t ov5647_io_handle = NULL; + //---------------VCM SCCB Init------------------// + esp_sccb_io_handle_t dw9714_io_handle = NULL; sccb_i2c_config_t i2c_config = { .scl_speed_hz = EXAMPLE_MIPI_SCCB_FREQ, - .device_address = EXAMPLE_OV5647_DEV_ADDR, + .device_address = EXAMPLE_DW9714_DEV_ADDR, .dev_addr_length = I2C_ADDR_BIT_LEN_7, }; - ESP_ERROR_CHECK(sccb_new_i2c_io(bus_handle, &i2c_config, &ov5647_io_handle)); - - esp_sccb_io_handle_t dw9714_io_handle = NULL; - i2c_config.device_address = EXAMPLE_DW9714_DEV_ADDR; - ESP_ERROR_CHECK(sccb_new_i2c_io(bus_handle, &i2c_config, &dw9714_io_handle)); + ESP_ERROR_CHECK(sccb_new_i2c_io(i2c_bus_handle, &i2c_config, &dw9714_io_handle)); //---------------CSI Init------------------// esp_cam_ctlr_csi_config_t csi_config = { @@ -370,8 +358,8 @@ void app_main(void) }; xTaskCreatePinnedToCore(af_task, "af_task", 8192, &af_task_param, 5, NULL, 0); - //---------------DSI Panel Init------------------// - example_dsi_ili9881c_panel_init(ili9881c_ctrl_panel); + //---------------DPI Reset------------------// + example_dpi_panel_reset(mipi_dpi_panel); //init to all white memset(frame_buffer, 0xFF, frame_buffer_size); @@ -382,55 +370,6 @@ void app_main(void) return; } - esp_cam_sensor_config_t cam_config = { - .sccb_handle = ov5647_io_handle, - .reset_pin = -1, - .pwdn_pin = -1, - .xclk_pin = -1, - .sensor_port = ESP_CAM_SENSOR_MIPI_CSI, - }; - - esp_cam_sensor_device_t *cam = ov5647_detect(&cam_config); - if (!cam) { - ESP_LOGE(TAG, "failed to detect 5647"); - return; - } - - esp_cam_sensor_format_array_t cam_fmt_array = {0}; - esp_cam_sensor_query_format(cam, &cam_fmt_array); - const esp_cam_sensor_format_t *parray = cam_fmt_array.format_array; - for (int i = 0; i < cam_fmt_array.count; i++) { - ESP_LOGI(TAG, "fmt[%d].name:%s", i, parray[i].name); - } - - 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); - break; - } -#else - if (!strcmp(parray[i].name, "MIPI_2lane_24Minput_RAW8_800x1280_50fps")) { - cam_cur_fmt = (esp_cam_sensor_format_t *) & (parray[i].name); - break; - } -#endif - } - - ret = esp_cam_sensor_set_format(cam, (const esp_cam_sensor_format_t *) cam_cur_fmt); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Format set fail"); - } else { - ESP_LOGI(TAG, "Format in use:%s", cam_cur_fmt->name); - } - int enable_flag = 1; - // Set sensor output stream - ret = esp_cam_sensor_ioctl(cam, ESP_CAM_SENSOR_IOC_S_STREAM, &enable_flag); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Start stream fail"); - } - example_dpi_panel_init(mipi_dpi_panel); while (1) { diff --git a/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults b/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults index 7c4a698932..6192f176b4 100644 --- a/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults +++ b/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults @@ -1,4 +1,5 @@ CONFIG_SPIRAM=y CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_SPIRAM_SPEED_200M=y +CONFIG_CAMERA_SC2336=y CONFIG_CAMERA_OV5647=y diff --git a/examples/peripherals/ppa/ppa_dsi/main/idf_component.yml b/examples/peripherals/ppa/ppa_dsi/main/idf_component.yml index db2c573141..57233aaf32 100644 --- a/examples/peripherals/ppa/ppa_dsi/main/idf_component.yml +++ b/examples/peripherals/ppa/ppa_dsi/main/idf_component.yml @@ -1,5 +1,4 @@ dependencies: - espressif/esp_lcd_ili9881c: "~0.2.0" idf: version: ">=5.3.0" dsi_init: diff --git a/examples/peripherals/ppa/ppa_dsi/main/ppa_dsi_main.c b/examples/peripherals/ppa/ppa_dsi/main/ppa_dsi_main.c index 124bbaaca1..02d46d7fb7 100644 --- a/examples/peripherals/ppa/ppa_dsi/main/ppa_dsi_main.c +++ b/examples/peripherals/ppa/ppa_dsi/main/ppa_dsi_main.c @@ -12,7 +12,6 @@ #include "freertos/FreeRTOS.h" #include "esp_lcd_mipi_dsi.h" #include "esp_lcd_panel_ops.h" -#include "esp_lcd_ili9881c.h" #include "esp_ldo_regulator.h" #include "driver/ppa.h" #include "example_dsi_init.h" @@ -319,7 +318,6 @@ void app_main(void) uint16_t *pixels = NULL; esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL; esp_lcd_panel_io_handle_t mipi_dbi_io = NULL; - esp_lcd_panel_handle_t ili9881c_ctrl_panel = NULL; esp_lcd_panel_handle_t mipi_dpi_panel = NULL; //---------------MIPI LDO Init------------------// @@ -331,8 +329,8 @@ void app_main(void) ESP_ERROR_CHECK(esp_ldo_acquire_channel(&ldo_mipi_phy_config, &ldo_mipi_phy)); //---------------DSI Init------------------// - example_dsi_resource_alloc(&ili9881c_ctrl_panel, &mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, NULL); - example_dsi_ili9881c_panel_init(ili9881c_ctrl_panel); + example_dsi_resource_alloc(&mipi_dsi_bus, &mipi_dbi_io, &mipi_dpi_panel, NULL); + example_dpi_panel_reset(mipi_dpi_panel); example_dpi_panel_init(mipi_dpi_panel); //---------------Get Source image------------------// @@ -400,5 +398,5 @@ void app_main(void) ESP_ERROR_CHECK(ppa_unregister_client(ppa_srm_handle)); ESP_ERROR_CHECK(ppa_unregister_client(ppa_blend_handle)); ESP_ERROR_CHECK(ppa_unregister_client(ppa_fill_handle)); - example_dsi_resource_destroy(ili9881c_ctrl_panel, mipi_dsi_bus, mipi_dbi_io, mipi_dpi_panel); + example_dsi_resource_destroy(mipi_dsi_bus, mipi_dbi_io, mipi_dpi_panel); }