reverted "SCCB configured externally"

This commit is contained in:
apiesse
2020-05-14 13:25:12 +02:00
parent d109e5cc19
commit f69786ba75
4 changed files with 25 additions and 31 deletions

View File

@@ -959,7 +959,7 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
camera_enable_out_clock(config);
ESP_LOGD(TAG, "Initializing SSCB");
SCCB_Init(config->pin_sccb_sda, config->pin_sccb_scl, config->sccb_external);
SCCB_Init(config->pin_sscb_sda, config->pin_sscb_scl);
if(config->pin_pwdn >= 0) {
ESP_LOGD(TAG, "Resetting camera by power down line");
@@ -968,7 +968,7 @@ esp_err_t camera_probe(const camera_config_t* config, camera_model_t* out_camera
conf.mode = GPIO_MODE_OUTPUT;
gpio_config(&conf);
// careful, logic is inverted compared to reset pin
// carefull, logic is inverted compared to reset pin
gpio_set_level(config->pin_pwdn, 1);
vTaskDelay(10 / portTICK_PERIOD_MS);
gpio_set_level(config->pin_pwdn, 0);
@@ -1256,14 +1256,9 @@ esp_err_t camera_init(const camera_config_t* config)
vsync_intr_disable();
err = gpio_install_isr_service(ESP_INTR_FLAG_LEVEL1 | ESP_INTR_FLAG_IRAM);
if (err != ESP_OK) {
if (err != ESP_ERR_INVALID_STATE) {
ESP_LOGE(TAG, "gpio_install_isr_service failed (%x)", err);
goto fail;
}
else {
ESP_LOGW(TAG, "gpio_install_isr_service already installed");
}
}
err = gpio_isr_handler_add(s_state->config.pin_vsync, &vsync_isr, NULL);
if (err != ESP_OK) {
ESP_LOGE(TAG, "vsync_isr_handler_add failed (%x)", err);

View File

@@ -18,8 +18,8 @@
.pin_pwdn = PIN_PWDN,
.pin_reset = PIN_RESET,
.pin_xclk = PIN_XCLK,
.pin_sccb_sda = PIN_SIOD,
.pin_sccb_scl = PIN_SIOC,
.pin_sscb_sda = PIN_SIOD,
.pin_sscb_scl = PIN_SIOC,
.pin_d7 = PIN_D7,
.pin_d6 = PIN_D6,
.pin_d5 = PIN_D5,
@@ -81,8 +81,8 @@ typedef struct {
int pin_pwdn; /*!< GPIO pin for camera power down line */
int pin_reset; /*!< GPIO pin for camera reset line */
int pin_xclk; /*!< GPIO pin for camera XCLK line */
int pin_sccb_sda; /*!< GPIO pin for camera SDA line */
int pin_sccb_scl; /*!< GPIO pin for camera SCL line */
int pin_sscb_sda; /*!< GPIO pin for camera SDA line */
int pin_sscb_scl; /*!< GPIO pin for camera SCL line */
int pin_d7; /*!< GPIO pin for camera D7 line */
int pin_d6; /*!< GPIO pin for camera D6 line */
int pin_d5; /*!< GPIO pin for camera D5 line */
@@ -105,8 +105,6 @@ typedef struct {
int jpeg_quality; /*!< Quality of JPEG output. 0-63 lower means higher quality */
size_t fb_count; /*!< Number of frame buffers to be allocated. If more than one, then each frame will be acquired (double speed) */
int sccb_external; /*!< Hardware SCCB interface configured externally */
} camera_config_t;
/**

View File

@@ -9,8 +9,8 @@
#ifndef __SCCB_H__
#define __SCCB_H__
#include <stdint.h>
int SCCB_Init(int pin_sda, int pin_scl, int external);
uint8_t SCCB_Probe(void);
int SCCB_Init(int pin_sda, int pin_scl);
uint8_t SCCB_Probe();
uint8_t SCCB_Read(uint8_t slv_addr, uint8_t reg);
uint8_t SCCB_Write(uint8_t slv_addr, uint8_t reg, uint8_t data);
uint8_t SCCB_Read16(uint8_t slv_addr, uint16_t reg);

View File

@@ -19,6 +19,8 @@
static const char* TAG = "sccb";
#endif
//#undef CONFIG_SCCB_HARDWARE_I2C
#define LITTLETOBIG(x) ((x<<8)|(x>>8))
#ifdef CONFIG_SCCB_HARDWARE_I2C
@@ -41,11 +43,11 @@ static uint8_t ESP_SLAVE_ADDR = 0x3c;
#include "twi.h"
#endif
int SCCB_Init(int pin_sda, int pin_scl, int external)
int SCCB_Init(int pin_sda, int pin_scl
{
ESP_LOGI(TAG, "pin_sda %d pin_scl %d external %d \n", pin_sda, pin_scl, external);
ESP_LOGI(TAG, "pin_sda %d pin_scl %d \n", pin_sda, pin_scl);
#ifdef CONFIG_SCCB_HARDWARE_I2C
if (external == 0) {
//log_i("SCCB_Init start");
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = pin_sda;
@@ -56,14 +58,13 @@ int SCCB_Init(int pin_sda, int pin_scl, int external)
i2c_param_config(SCCB_I2C_PORT, &conf);
i2c_driver_install(SCCB_I2C_PORT, conf.mode, 0, 0, 0);
}
#else
twi_init(pin_sda, pin_scl);
#endif
return 0;
}
uint8_t SCCB_Probe(void)
uint8_t SCCB_Probe()
{
#ifdef CONFIG_SCCB_HARDWARE_I2C
uint8_t slave_addr = 0x0;