diff --git a/components/esp_driver_isp/include/driver/isp_color.h b/components/esp_driver_isp/include/driver/isp_color.h index 5549fdeab3..904b90e48f 100644 --- a/components/esp_driver_isp/include/driver/isp_color.h +++ b/components/esp_driver_isp/include/driver/isp_color.h @@ -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. diff --git a/components/hal/esp32p4/include/hal/isp_ll.h b/components/hal/esp32p4/include/hal/isp_ll.h index 4c07d91fe1..37d5cd9fc5 100644 --- a/components/hal/esp32p4/include/hal/isp_ll.h +++ b/components/hal/esp32p4/include/hal/isp_ll.h @@ -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 } /** diff --git a/components/hal/include/hal/isp_hal.h b/components/hal/include/hal/isp_hal.h index a8eb6b502d..104e5f71db 100644 --- a/components/hal/include/hal/isp_hal.h +++ b/components/hal/include/hal/isp_hal.h @@ -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; diff --git a/components/hal/isp_hal.c b/components/hal/isp_hal.c index 6dc1cad264..e4952ae610 100644 --- a/components/hal/isp_hal.c +++ b/components/hal/isp_hal.c @@ -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 = { diff --git a/components/soc/esp32p4/register/hw_ver3/soc/isp_struct.h b/components/soc/esp32p4/register/hw_ver3/soc/isp_struct.h index 5503928513..0b5f24914c 100644 --- a/components/soc/esp32p4/register/hw_ver3/soc/isp_struct.h +++ b/components/soc/esp32p4/register/hw_ver3/soc/isp_struct.h @@ -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; diff --git a/docs/en/api-reference/peripherals/isp.rst b/docs/en/api-reference/peripherals/isp.rst index 80ec3d5cce..3fe63db30f 100644 --- a/docs/en/api-reference/peripherals/isp.rst +++ b/docs/en/api-reference/peripherals/isp.rst @@ -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"} diff --git a/docs/zh_CN/api-reference/peripherals/isp.rst b/docs/zh_CN/api-reference/peripherals/isp.rst index 78b1f0b83c..ce6ed436be 100644 --- a/docs/zh_CN/api-reference/peripherals/isp.rst +++ b/docs/zh_CN/api-reference/peripherals/isp.rst @@ -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"} diff --git a/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults b/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults index 6192f176b4..ca5a4e969b 100644 --- a/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults +++ b/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults @@ -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