Merge pull request #27 from XiaochaoGONG/ov3660-support

adjust for non Arduino
This commit is contained in:
Me No Dev
2019-04-08 09:39:51 +02:00
committed by GitHub
5 changed files with 27 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ set(COMPONENT_SRCS
driver/twi.c driver/twi.c
driver/xclk.c driver/xclk.c
sensors/ov2640.c sensors/ov2640.c
sensors/ov3660.c
sensors/ov7725.c sensors/ov7725.c
conversions/yuv.c conversions/yuv.c
conversions/to_jpg.cpp conversions/to_jpg.cpp

15
Kconfig
View File

@@ -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

View File

@@ -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, 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"); ESP_LOGE(TAG, "Failed to create DMA filter task");
err = ESP_ERR_NO_MEM; err = ESP_ERR_NO_MEM;
goto fail; goto fail;

View File

@@ -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); ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl);
#ifdef CONFIG_SCCB_HARDWARE_I2C #ifdef CONFIG_SCCB_HARDWARE_I2C
log_i("SCCB_Init start"); //log_i("SCCB_Init start");
i2c_config_t conf; i2c_config_t conf;
conf.mode = I2C_MODE_MASTER; conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = pin_sda; conf.sda_io_num = pin_sda;

View File

@@ -6,7 +6,6 @@
* OV3660 driver. * OV3660 driver.
* *
*/ */
#include "Arduino.h"
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -98,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]);
} }