Add choice for selecting affinited core
This commit is contained in:
15
Kconfig
15
Kconfig
@@ -27,5 +27,20 @@ config SCCB_HARDWARE_I2C
|
|||||||
help
|
help
|
||||||
Enable this option if you want to use hardware I2C to control the camera.
|
Enable this option if you want to use hardware I2C to control the camera.
|
||||||
Disable this option to use software I2C.
|
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
|
endmenu
|
||||||
|
|||||||
@@ -968,7 +968,7 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
|
|||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(config->pin_reset, 1);
|
gpio_set_level(config->pin_reset, 1);
|
||||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
#if CONFIG_OV2640_SUPPORT
|
#if (CONFIG_OV2640_SUPPORT && !CONFIG_OV3660_SUPPORT)
|
||||||
} else {
|
} else {
|
||||||
//reset OV2640
|
//reset OV2640
|
||||||
SCCB_Write(0x30, 0xFF, 0x01);//bank sensor
|
SCCB_Write(0x30, 0xFF, 0x01);//bank sensor
|
||||||
@@ -1176,7 +1176,14 @@ esp_err_t camera_init(const camera_config_t* config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ToDo: core affinity?
|
//ToDo: core affinity?
|
||||||
if (!xTaskCreatePinnedToCore(&dma_filter_task, "dma_filter", 4096, NULL, 10, &s_state->dma_filter_task, 0)) {
|
#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");
|
ESP_LOGE(TAG, "Failed to create DMA filter task");
|
||||||
err = ESP_ERR_NO_MEM;
|
err = ESP_ERR_NO_MEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -17,11 +17,9 @@
|
|||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
|
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
|
||||||
#include "Arduino.h"
|
|
||||||
#include "esp32-hal-log.h"
|
#include "esp32-hal-log.h"
|
||||||
#else
|
#else
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#define delay(x)
|
|
||||||
static const char *TAG = "ov3660";
|
static const char *TAG = "ov3660";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -99,7 +97,7 @@ static int write_regs(uint8_t slv_addr, const uint16_t (*regs)[2])
|
|||||||
int i = 0, ret = 0;
|
int i = 0, ret = 0;
|
||||||
while (!ret && regs[i][0] != REGLIST_TAIL) {
|
while (!ret && regs[i][0] != REGLIST_TAIL) {
|
||||||
if (regs[i][0] == REG_DLY) {
|
if (regs[i][0] == REG_DLY) {
|
||||||
delay(regs[i][1]);
|
vTaskDelay(regs[i][1] / portTICK_PERIOD_MS);
|
||||||
} else {
|
} else {
|
||||||
ret = write_reg(slv_addr, regs[i][0], regs[i][1]);
|
ret = write_reg(slv_addr, regs[i][0], regs[i][1]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user