diff --git a/CMakeLists.txt b/CMakeLists.txt index bbddc48..385c6dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ set(COMPONENT_SRCS driver/twi.c driver/xclk.c sensors/ov2640.c + sensors/ov3660.c sensors/ov7725.c conversions/yuv.c conversions/to_jpg.cpp diff --git a/Kconfig b/Kconfig index 56934a0..8d3af00 100755 --- a/Kconfig +++ b/Kconfig @@ -27,5 +27,20 @@ config SCCB_HARDWARE_I2C help Enable this option if you want to use hardware I2C to control the camera. Disable this option to use software I2C. + +choice CAMERA_TASK_PINNED_TO_CORE + bool "Camera task pinned to core" + default CAMERA_CORE0 + help + Pin the camera handle task to a certain core(0/1). It can also be done automatically choosing NO_AFFINITY. + + config CAMERA_CORE0 + bool "CORE0" + config CAMERA_CORE1 + bool "CORE1" + config CAMERA_NO_AFFINITY + bool "NO_AFFINITY" + +endchoice endmenu diff --git a/driver/camera.c b/driver/camera.c index 142e678..6058b1c 100755 --- a/driver/camera.c +++ b/driver/camera.c @@ -968,7 +968,7 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera vTaskDelay(10 / portTICK_PERIOD_MS); gpio_set_level(config->pin_reset, 1); vTaskDelay(10 / portTICK_PERIOD_MS); -#if CONFIG_OV2640_SUPPORT +#if (CONFIG_OV2640_SUPPORT && !CONFIG_OV3660_SUPPORT) } else { //reset OV2640 SCCB_Write(0x30, 0xFF, 0x01);//bank sensor @@ -1176,7 +1176,14 @@ esp_err_t camera_init(const camera_config_t* config) } //ToDo: core affinity? - if (!xTaskCreatePinnedToCore(&dma_filter_task, "dma_filter", 4096, NULL, 10, &s_state->dma_filter_task, 1)) { +#if CONFIG_CAMERA_CORE0 + if (!xTaskCreatePinnedToCore(&dma_filter_task, "dma_filter", 4096, NULL, 10, &s_state->dma_filter_task, 0)) +#elif CONFIG_CAMERA_CORE1 + if (!xTaskCreatePinnedToCore(&dma_filter_task, "dma_filter", 4096, NULL, 10, &s_state->dma_filter_task, 1)) +#else + if (!xTaskCreate(&dma_filter_task, "dma_filter", 4096, NULL, 10, &s_state->dma_filter_task)) +#endif + { ESP_LOGE(TAG, "Failed to create DMA filter task"); err = ESP_ERR_NO_MEM; goto fail; diff --git a/driver/sccb.c b/driver/sccb.c index 1e37512..892eb5b 100755 --- a/driver/sccb.c +++ b/driver/sccb.c @@ -41,7 +41,7 @@ int SCCB_Init(int pin_sda, int pin_scl) { ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl); #ifdef CONFIG_SCCB_HARDWARE_I2C - log_i("SCCB_Init start"); + //log_i("SCCB_Init start"); i2c_config_t conf; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = pin_sda; diff --git a/sensors/ov3660.c b/sensors/ov3660.c index fe29d1f..f59011d 100755 --- a/sensors/ov3660.c +++ b/sensors/ov3660.c @@ -6,7 +6,6 @@ * OV3660 driver. * */ -#include "Arduino.h" #include #include #include @@ -98,7 +97,7 @@ static int write_regs(uint8_t slv_addr, const uint16_t (*regs)[2]) int i = 0, ret = 0; while (!ret && regs[i][0] != REGLIST_TAIL) { if (regs[i][0] == REG_DLY) { - delay(regs[i][1]); + vTaskDelay(regs[i][1] / portTICK_PERIOD_MS); } else { ret = write_reg(slv_addr, regs[i][0], regs[i][1]); }