mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
feat(isp): support Crop driver on p4 rev3
Add support for crop driver on p4eco5 and update example in `isp/multi_pipelines`
This commit is contained in:
@@ -15,7 +15,14 @@
|
||||
#include "example_dsi_init_config.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
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)
|
||||
static const char *TAG = "example_dsi_init";
|
||||
|
||||
void example_dsi_resource_alloc(const example_dsi_alloc_config_t *config,
|
||||
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** fb0,
|
||||
void** fb1)
|
||||
{
|
||||
//---------------DSI resource allocation------------------//
|
||||
esp_lcd_dsi_bus_config_t bus_config = {
|
||||
@@ -32,7 +39,22 @@ void example_dsi_resource_alloc(esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_lcd_new_panel_io_dbi(*mipi_dsi_bus, &dbi_config, mipi_dbi_io));
|
||||
|
||||
// Use default config if not provided
|
||||
example_dsi_alloc_config_t default_config = EXAMPLE_DSI_ALLOC_CONFIG_DEFAULT();
|
||||
if (config == NULL) {
|
||||
config = &default_config;
|
||||
}
|
||||
|
||||
if (config->num_fbs < 1 || config->num_fbs > 2) {
|
||||
ESP_LOGE(TAG, "Invalid num_fbs: %d, must be 1 or 2", config->num_fbs);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t num_fbs = config->num_fbs;
|
||||
ESP_LOGI(TAG, "Allocating DSI resources with %d frame buffer(s)", num_fbs);
|
||||
|
||||
esp_lcd_dpi_panel_config_t dpi_config = {
|
||||
.num_fbs = num_fbs,
|
||||
.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT,
|
||||
.dpi_clock_freq_mhz = EXAMPLE_MIPI_DSI_DPI_CLK_MHZ,
|
||||
.virtual_channel = 0,
|
||||
@@ -83,7 +105,23 @@ void example_dsi_resource_alloc(esp_lcd_dsi_bus_handle_t *mipi_dsi_bus, esp_lcd_
|
||||
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));
|
||||
// Get frame buffer addresses
|
||||
if (fb0 != NULL) {
|
||||
if (num_fbs == 2) {
|
||||
if (fb1 != NULL) {
|
||||
ESP_ERROR_CHECK(esp_lcd_dpi_panel_get_frame_buffer(*mipi_dpi_panel, 2, fb0, fb1));
|
||||
ESP_LOGD(TAG, "Frame buffer[0] allocated at: %p", *fb0);
|
||||
ESP_LOGD(TAG, "Frame buffer[1] allocated at: %p", *fb1);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "num_fbs is 2 but fb1 is NULL, only getting fb0");
|
||||
ESP_ERROR_CHECK(esp_lcd_dpi_panel_get_frame_buffer(*mipi_dpi_panel, 1, fb0));
|
||||
ESP_LOGD(TAG, "Frame buffer[0] allocated at: %p", *fb0);
|
||||
}
|
||||
} else {
|
||||
ESP_ERROR_CHECK(esp_lcd_dpi_panel_get_frame_buffer(*mipi_dpi_panel, 1, fb0));
|
||||
ESP_LOGD(TAG, "Frame buffer[0] allocated at: %p", *fb0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void example_dpi_panel_reset(esp_lcd_panel_handle_t mipi_dpi_panel)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -14,14 +14,37 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief DSI init function
|
||||
*
|
||||
* @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
|
||||
* @brief DSI allocation configuration
|
||||
*/
|
||||
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);
|
||||
typedef struct {
|
||||
uint8_t num_fbs; /*!< Number of frame buffers (1-2). */
|
||||
} example_dsi_alloc_config_t;
|
||||
|
||||
/**
|
||||
* @brief Default DSI allocation configuration
|
||||
*/
|
||||
#define EXAMPLE_DSI_ALLOC_CONFIG_DEFAULT() { \
|
||||
.num_fbs = 1, \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DSI init function with configurable frame buffers
|
||||
*
|
||||
* @param[in] config DSI allocation configuration. If NULL, uses default (single buffer)
|
||||
* @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] fb0 Pointer to receive the address of frame buffer 0 (first frame buffer)
|
||||
* @param[out] fb1 Pointer to receive the address of frame buffer 1 (second frame buffer). If NULL, single buffer mode is used.
|
||||
*
|
||||
* @note The number of frame buffers allocated is determined by config->num_fbs. If config is NULL, single buffer mode is used.
|
||||
*/
|
||||
void example_dsi_resource_alloc(const example_dsi_alloc_config_t *config,
|
||||
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 **fb0,
|
||||
void **fb1);
|
||||
|
||||
/**
|
||||
* @brief DPI panel reset function
|
||||
|
||||
Reference in New Issue
Block a user