feat(isp): Update hue for esp32p4eco5

This commit is contained in:
Chen Chen
2025-09-03 12:05:52 +08:00
parent 37855ef350
commit 0e84ce7e69
8 changed files with 17 additions and 8 deletions

View File

@@ -27,8 +27,8 @@ typedef struct {
* Range 0 ~ 1, decimal value should be 0~127, default 1
*/
uint32_t color_hue; /*!< The color hue value, based on the color wheel.
* 0 degrees represents red, 120 degrees represents green, and 240 degrees represents blue. 360 degrees overlaps with 0 degrees
* Range 0 ~ 360, default 0.
* 0 degrees represents red, 120 degrees represents green, and 240 degrees represents blue.
* Range 0 ~ 359, default 0.
*/
int color_brightness; /*!< The color brightness value.
* Range -128 ~ 127, default 0.

View File

@@ -10,6 +10,7 @@
#include "esp_attr.h"
#include "hal/misc.h"
#include "hal/assert.h"
#include "hal/config.h"
#include "hal/hal_utils.h"
#include "hal/isp_types.h"
#include "hal/color_types.h"
@@ -109,7 +110,7 @@ extern "C" {
---------------------------------------------------------------*/
#define ISP_LL_COLOR_CONTRAST_MAX 0xff
#define ISP_LL_COLOR_SATURATION_MAX 0xff
#define ISP_LL_COLOR_HUE_MAX 360
#define ISP_LL_COLOR_HUE_MAX 359
#define ISP_LL_COLOR_BRIGNTNESS_MIN -128
#define ISP_LL_COLOR_BRIGNTNESS_MAX 127
@@ -958,7 +959,10 @@ static inline void isp_ll_color_set_saturation(isp_dev_t *hw, isp_color_saturati
*/
static inline void isp_ll_color_set_hue(isp_dev_t *hw, uint32_t color_hue)
{
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->color_ctrl, color_hue, color_hue);
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->color_ctrl, color_hue, color_hue & 0xFF);
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300
hw->color_hue_ctrl.color_hue_h = (color_hue >> 8) & 0x01;
#endif
}
/**

View File

@@ -90,7 +90,7 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id);
typedef struct {
isp_color_contrast_t color_contrast; ///< The color contrast value, range 0~1, decimal value should be 0~127
isp_color_saturation_t color_saturation; ///< The color saturation value, range 0~1, decimal value should be 0~127
uint32_t color_hue; ///< The color hue angle value, range 0-360
uint32_t color_hue; ///< The color hue angle value, range 0-359
int color_brightness; ///< The color brightness value, range -128~127
} isp_hal_color_cfg_t;

View File

@@ -196,7 +196,11 @@ void isp_hal_color_config(isp_hal_context_t *hal, const isp_hal_color_cfg_t *con
if (config) {
isp_ll_color_set_contrast(hal->hw, config->color_contrast);
isp_ll_color_set_saturation(hal->hw, config->color_saturation);
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300
isp_ll_color_set_hue(hal->hw, config->color_hue);
#else
isp_ll_color_set_hue(hal->hw, (config->color_hue * 256) / 360);
#endif
isp_ll_color_set_brigntness(hal->hw, (int8_t)config->color_brightness);
} else {
isp_color_contrast_t color_contrast_default = {

View File

@@ -1642,7 +1642,7 @@ typedef union {
*/
uint32_t color_saturation:8;
/** color_hue : R/W; bitpos: [15:8]; default: 0;
* this field configures the color hue angle
* this field configures the color hue angle lower 8 bits
*/
uint32_t color_hue:8;
/** color_contrast : R/W; bitpos: [23:16]; default: 128;

View File

@@ -565,7 +565,7 @@ Calling :cpp:func:`esp_isp_color_configure` to configure color function, you can
{IDF_TARGET_SOC_ISP_COLOR_SATURATION_MAX:default="1.0", esp32p4="1.0"}
{IDF_TARGET_SOC_ISP_COLOR_SATURATION_DEFAULT:default="1.0", esp32p4="1.0"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_MAX:default="360", esp32p4="360"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_MAX:default="359", esp32p4="359"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_DEFAULT:default="0", esp32p4="0"}
{IDF_TARGET_SOC_ISP_COLOR_BRIGHTNESS_MIN:default="-127", esp32p4="-127"}

View File

@@ -565,7 +565,7 @@ ISP 色彩控制器
{IDF_TARGET_SOC_ISP_COLOR_SATURATION_MAX:default="1.0", esp32p4="1.0"}
{IDF_TARGET_SOC_ISP_COLOR_SATURATION_DEFAULT:default="1.0", esp32p4="1.0"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_MAX:default="360", esp32p4="360"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_MAX:default="359", esp32p4="359"}
{IDF_TARGET_SOC_ISP_COLOR_HUE_DEFAULT:default="0", esp32p4="0"}
{IDF_TARGET_SOC_ISP_COLOR_BRIGHTNESS_MIN:default="-127", esp32p4="-127"}

View File

@@ -3,3 +3,4 @@ CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_SPIRAM_SPEED_200M=y
CONFIG_CAMERA_SC2336=y
CONFIG_CAMERA_OV5647=y
CONFIG_CAMERA_OV5647_ENABLE_MOTOR_BY_GPIO0=y