diff --git a/CMakeLists.txt b/CMakeLists.txt index 9947ae802d..6ebc992074 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST sensors/sc101iot.c sensors/sc030iot.c sensors/sc031gs.c + sensors/mega_ccm.c ) list(APPEND priv_include_dirs diff --git a/Kconfig b/Kconfig index de706e0e89..2285e43b11 100755 --- a/Kconfig +++ b/Kconfig @@ -117,6 +117,13 @@ menu "Camera configuration" Enable this option if you want to use the SC031GS. Disable this option to save memory. + config MEGA_CCM_SUPPORT + bool "Support MEGA CCM 5MP" + default y + help + Enable this option if you want to use the MEGA CCM. + Disable this option to save memory. + choice SCCB_HARDWARE_I2C_PORT bool "I2C peripheral to use for SCCB" default SCCB_HARDWARE_I2C_PORT1 diff --git a/driver/esp_camera.c b/driver/esp_camera.c index e39b597fa1..7c693a6957 100644 --- a/driver/esp_camera.c +++ b/driver/esp_camera.c @@ -69,6 +69,9 @@ #if CONFIG_SC031GS_SUPPORT #include "sc031gs.h" #endif +#if CONFIG_MEGA_CCM_SUPPORT +#include "mega_ccm.h" +#endif #if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG) #include "esp32-hal-log.h" @@ -143,6 +146,9 @@ static const sensor_func_t g_sensors[] = { #if CONFIG_SC031GS_SUPPORT {sc031gs_detect, sc031gs_init}, #endif +#if CONFIG_MEGA_CCM_SUPPORT + {mega_ccm_detect, mega_ccm_init}, +#endif }; static esp_err_t camera_probe(const camera_config_t *config, camera_model_t *out_camera_model) diff --git a/driver/include/sensor.h b/driver/include/sensor.h index 6ab12a21aa..f57e4e26a9 100755 --- a/driver/include/sensor.h +++ b/driver/include/sensor.h @@ -31,6 +31,7 @@ typedef enum { SC101IOT_PID = 0xda4a, SC030IOT_PID = 0x9a46, SC031GS_PID = 0x0031, + MEGA_CCM_PID =0x039E, } camera_pid_t; typedef enum { @@ -48,6 +49,7 @@ typedef enum { CAMERA_SC101IOT, CAMERA_SC030IOT, CAMERA_SC031GS, + CAMERA_MEGA_CCM, CAMERA_MODEL_MAX, CAMERA_NONE, } camera_model_t; @@ -67,6 +69,7 @@ typedef enum { SC101IOT_SCCB_ADDR = 0x68,// 0xd0 >> 1 SC030IOT_SCCB_ADDR = 0x68,// 0xd0 >> 1 SC031GS_SCCB_ADDR = 0x30, + MEGA_CCM_SCCB_ADDR = 0x1F, // 0x3E >> 1 } camera_sccb_addr_t; typedef enum { @@ -84,10 +87,12 @@ typedef enum { typedef enum { FRAMESIZE_96X96, // 96x96 FRAMESIZE_QQVGA, // 160x120 + FRAMESIZE_128X128, // 128x128 FRAMESIZE_QCIF, // 176x144 FRAMESIZE_HQVGA, // 240x176 FRAMESIZE_240X240, // 240x240 FRAMESIZE_QVGA, // 320x240 + FRAMESIZE_320X320, // 320x320 FRAMESIZE_CIF, // 400x296 FRAMESIZE_HVGA, // 480x320 FRAMESIZE_VGA, // 640x480 @@ -106,6 +111,7 @@ typedef enum { FRAMESIZE_WQXGA, // 2560x1600 FRAMESIZE_P_FHD, // 1080x1920 FRAMESIZE_QSXGA, // 2560x1920 + FRAMESIZE_5MP, // 2592x1944 FRAMESIZE_INVALID } framesize_t; diff --git a/driver/sensor.c b/driver/sensor.c index 23071f6c2c..e0acbfc26d 100644 --- a/driver/sensor.c +++ b/driver/sensor.c @@ -17,15 +17,18 @@ const camera_sensor_info_t camera_sensor[CAMERA_MODEL_MAX] = { {CAMERA_SC101IOT, "SC101IOT", SC101IOT_SCCB_ADDR, SC101IOT_PID, FRAMESIZE_HD, false}, {CAMERA_SC030IOT, "SC030IOT", SC030IOT_SCCB_ADDR, SC030IOT_PID, FRAMESIZE_VGA, false}, {CAMERA_SC031GS, "SC031GS", SC031GS_SCCB_ADDR, SC031GS_PID, FRAMESIZE_VGA, false}, + {CAMERA_MEGA_CCM, "MEGA_CCM", MEGA_CCM_SCCB_ADDR, MEGA_CCM_PID, FRAMESIZE_5MP, true}, }; const resolution_info_t resolution[FRAMESIZE_INVALID] = { { 96, 96, ASPECT_RATIO_1X1 }, /* 96x96 */ + { 128, 128, ASPECT_RATIO_1X1 }, /* 128x128 */ { 160, 120, ASPECT_RATIO_4X3 }, /* QQVGA */ { 176, 144, ASPECT_RATIO_5X4 }, /* QCIF */ { 240, 176, ASPECT_RATIO_4X3 }, /* HQVGA */ { 240, 240, ASPECT_RATIO_1X1 }, /* 240x240 */ { 320, 240, ASPECT_RATIO_4X3 }, /* QVGA */ + { 320, 320, ASPECT_RATIO_1X1 }, /* 320x320 */ { 400, 296, ASPECT_RATIO_4X3 }, /* CIF */ { 480, 320, ASPECT_RATIO_3X2 }, /* HVGA */ { 640, 480, ASPECT_RATIO_4X3 }, /* VGA */ @@ -44,6 +47,7 @@ const resolution_info_t resolution[FRAMESIZE_INVALID] = { { 2560, 1600, ASPECT_RATIO_16X10 }, /* WQXGA */ { 1088, 1920, ASPECT_RATIO_9X16 }, /* Portrait FHD */ { 2560, 1920, ASPECT_RATIO_4X3 }, /* QSXGA */ + { 2592, 1944, ASPECT_RATIO_4X3 }, /* 5MP */ }; camera_sensor_info_t *esp_camera_sensor_get_info(sensor_id_t *id) diff --git a/examples/camera_example/main/CMakeLists.txt b/examples/camera_example/main/CMakeLists.txt index 0811eaadb5..b3b4892124 100644 --- a/examples/camera_example/main/CMakeLists.txt +++ b/examples/camera_example/main/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS take_picture.c PRIV_INCLUDE_DIRS . - PRIV_REQUIRES nvs_flash) + PRIV_REQUIRES nvs_flash esp_psram) diff --git a/examples/camera_example/main/take_picture.c b/examples/camera_example/main/take_picture.c index 115b10f0ee..a3b42299c0 100644 --- a/examples/camera_example/main/take_picture.c +++ b/examples/camera_example/main/take_picture.c @@ -7,6 +7,8 @@ // 1. Board setup (Uncomment): // #define BOARD_WROVER_KIT // #define BOARD_ESP32CAM_AITHINKER +// #define BOARD_WROVER_KIT 1 + #define BOARD_ESP32S3CAM /** * 2. Kconfig setup @@ -45,7 +47,7 @@ #include "esp_camera.h" -#define BOARD_WROVER_KIT 1 + // WROVER-KIT PIN Map #ifdef BOARD_WROVER_KIT @@ -93,6 +95,24 @@ #endif +#ifdef BOARD_ESP32S3CAM +#define CAM_PIN_PWDN 38 +#define CAM_PIN_RESET -1 +#define CAM_PIN_VSYNC 6 +#define CAM_PIN_HREF 7 +#define CAM_PIN_PCLK 13 +#define CAM_PIN_XCLK 15 +#define CAM_PIN_SIOD 4 +#define CAM_PIN_SIOC 5 +#define CAM_PIN_D0 11 +#define CAM_PIN_D1 9 +#define CAM_PIN_D2 8 +#define CAM_PIN_D3 10 +#define CAM_PIN_D4 12 +#define CAM_PIN_D5 18 +#define CAM_PIN_D6 17 +#define CAM_PIN_D7 16 +#endif static const char *TAG = "example:take_picture"; #if ESP_CAMERA_SUPPORTED @@ -120,8 +140,8 @@ static camera_config_t camera_config = { .ledc_timer = LEDC_TIMER_0, .ledc_channel = LEDC_CHANNEL_0, - .pixel_format = PIXFORMAT_RGB565, //YUV422,GRAYSCALE,RGB565,JPEG - .frame_size = FRAMESIZE_QVGA, //QQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates. + .pixel_format = PIXFORMAT_JPEG, //YUV422,GRAYSCALE,RGB565,JPEG + .frame_size = FRAMESIZE_HD, //QQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates. .jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality .fb_count = 1, //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode. diff --git a/sensors/mega_ccm.c b/sensors/mega_ccm.c new file mode 100644 index 0000000000..159c3922be --- /dev/null +++ b/sensors/mega_ccm.c @@ -0,0 +1,407 @@ +// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "sccb.h" +#include "mega_ccm.h" +#include "mega_ccm_regs.h" +#include "mega_ccm_settings.h" + +#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG) +#include "esp32-hal-log.h" +#else +#include "esp_log.h" +static const char *TAG = "mega_ccm"; +#endif + +#define H8(v) ((v)>>8) +#define L8(v) ((v)&0xff) + +//#define REG_DEBUG_ON + + +static int read_reg(uint8_t slv_addr, const uint16_t reg){ + int ret = SCCB_Read16(slv_addr, reg); +#ifdef REG_DEBUG_ON + if (ret < 0) { + ESP_LOGE(TAG, "READ REG 0x%04x FAILED: %d", reg, ret); + } +#endif + return ret; +} + +static int write_reg(uint8_t slv_addr, const uint16_t reg, uint8_t value){ + int ret = 0; + ret = SCCB_Write16(slv_addr, reg, value); + return ret; +} + + +static int reset(sensor_t *sensor) +{ + int ret; + ret = write_reg(sensor->slv_addr, CAMERA_RST_REG, 0x00); + ret += write_reg(sensor->slv_addr, CAMERA_RST_REG, 0x01); + vTaskDelay(1000 / portTICK_PERIOD_MS); + return ret; +} + +static int set_pixformat(sensor_t *sensor, pixformat_t pixformat) +{ + int ret = 0; + switch (pixformat) { + case PIXFORMAT_JPEG: + ret = write_reg(sensor->slv_addr, PIXEL_FMT_REG, 0x01); + break; + case PIXFORMAT_RGB565: + ret = write_reg(sensor->slv_addr, PIXEL_FMT_REG, 0x02); + break; + case PIXFORMAT_YUV422: + ret = write_reg(sensor->slv_addr, PIXEL_FMT_REG, 0x03); + break; + default: + ESP_LOGW(TAG, "unsupport format"); + ret = -1; + break; + } + if (ret == 0) { + sensor->pixformat = pixformat; + ESP_LOGD(TAG, "Set pixformat to: %u", pixformat); + } + + return ret; +} + +static int set_framesize(sensor_t *sensor, framesize_t framesize) +{ + ESP_LOGI(TAG, "set_framesize"); + int ret = 0; + if (framesize > FRAMESIZE_5MP) { + ESP_LOGW(TAG, "Invalid framesize: %u", framesize); + framesize = FRAMESIZE_5MP; + } + sensor->status.framesize = framesize; + uint16_t w = resolution[framesize].width; + uint16_t h = resolution[framesize].height; + switch (framesize){ + case FRAMESIZE_QVGA: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x01); //320x240 + ret += write_reg(sensor->slv_addr, SYSTEM_CLK_DIV_REG, 0x02); // set system clk + ret += write_reg(sensor->slv_addr, SYSTEM_PLL_DIV_REG, 0x01); // set system pll + break; + case FRAMESIZE_VGA: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x02); //640x480 + ret += write_reg(sensor->slv_addr, SYSTEM_CLK_DIV_REG, 0x02); // set system clk + ret += write_reg(sensor->slv_addr, SYSTEM_PLL_DIV_REG, 0x01); // set system pll + break; + case FRAMESIZE_HD: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x03); //1280x720 + ret += write_reg(sensor->slv_addr, SYSTEM_CLK_DIV_REG, 0x02); // set system clk + ret += write_reg(sensor->slv_addr, SYSTEM_PLL_DIV_REG, 0x01); // set system pll + break; + case FRAMESIZE_UXGA: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x04); //1600x1200 + ret += write_reg(sensor->slv_addr, SYSTEM_CLK_DIV_REG, 0x02); // set system clk + ret += write_reg(sensor->slv_addr, SYSTEM_PLL_DIV_REG, 0x01); // set system pll + break; + case FRAMESIZE_FHD: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x05); //1920x1080 + ret += write_reg(sensor->slv_addr, SYSTEM_CLK_DIV_REG, 0x02); // set system clk + ret += write_reg(sensor->slv_addr, SYSTEM_PLL_DIV_REG, 0x01); // set system pll + break; + case FRAMESIZE_5MP: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x06); //2592x1944 + break; + case FRAMESIZE_96X96: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x07); //96x96 + break; + case FRAMESIZE_128X128: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x08); //128x128 + break; + case FRAMESIZE_320X320: + ret = write_reg(sensor->slv_addr, RESOLUTION_REG, 0x09); //320x320 + break; + default: + ESP_LOGW(TAG, "unsupport framesize"); + ret = -1; + break; + } + if (ret == 0) { + ESP_LOGD(TAG, "Set framesize to: %ux%u", w, h); + } + return ret; +} + +static int set_hmirror(sensor_t *sensor, int enable) +{ + int ret = 0; + sensor->status.hmirror = enable; + ret = write_reg(sensor->slv_addr, IMAGE_MIRROR_REG, enable); + if (ret == 0) { + ESP_LOGD(TAG, "Set h-mirror to: %d", enable); + } + return ret; +} + +static int set_vflip(sensor_t *sensor, int enable) +{ + int ret = 0; + sensor->status.vflip = enable; + ret = write_reg(sensor->slv_addr, IMAGE_FLIP_REG, enable); + if (ret == 0) { + ESP_LOGD(TAG, "Set v-flip to: %d", enable); + } + return ret; +} +static int set_quality(sensor_t *sensor, int qs) +{ + int ret = 0; + ret = write_reg(sensor->slv_addr, IMAGE_QUALITY_REG, qs); + if (ret == 0) { + sensor->status.quality = qs; + ESP_LOGD(TAG, "Set quality to: %d", qs); + } + return ret; +} + + +static int set_brightness(sensor_t *sensor, int level) +{ + int ret = 0; + if(level < 0) { + level = 0; + } else if(level > 8) { + level = 8; + } + ret = write_reg(sensor->slv_addr, BRIGHTNESS_REG, level); + if (ret == 0) { + ESP_LOGD(TAG, "Set brightness to: %d", level); + sensor->status.brightness = level; + } + return ret; +} + +static int set_contrast (sensor_t *sensor, int level) +{ + int ret = 0; + if(level < 0) { + level = 0; + } else if(level > 6) { + level = 6; + } + ret = write_reg(sensor->slv_addr, CONTRAST_REG, level); + if (ret == 0) { + ESP_LOGD(TAG, "Set contrast to: %d", level); + sensor->status.contrast = level; + } + return ret; +} + +static int set_saturation (sensor_t *sensor, int level) +{ + int ret = 0; + if(level < 0) { + level = 0; + } else if(level > 6) { + level = 6; + } + ret = write_reg(sensor->slv_addr, SATURATION_REG, level); + if (ret == 0) { + ESP_LOGD(TAG, "Set saturation to: %d", level); + sensor->status.saturation = level; + } + return ret; +} +static int set_agc_mode (sensor_t *sensor, int enable) +{ + int ret = 0; + ret = write_reg(sensor->slv_addr, AGC_MODE_REG, enable); + if (ret == 0) { + ESP_LOGD(TAG, "Set agc mode to: %d", enable); + sensor->status.aec = enable; + } + return ret; +} + + +static int set_wb_mode (sensor_t *sensor, int mode) +{ + int ret = 0; + if(mode < 0) { + mode = 0; + } else if(mode > 5) { + mode = 5; + } + ret = write_reg(sensor->slv_addr, AWB_MODE_REG, mode); + if (ret == 0) { + ESP_LOGD(TAG, "Set wb_mode to: %d", mode); + sensor->status.wb_mode = mode; + } + return ret; + +} + +static int set_special_effect (sensor_t *sensor, int effect) +{ + + int ret = 0; + if(effect < 0) { + effect = 0; + } else if(effect > 6) { + effect = 6; + } + ret = write_reg(sensor->slv_addr, SPECIAL_REG, effect); + if (ret == 0) { + ESP_LOGD(TAG, "Set special_effect to: %d", effect); + sensor->status.special_effect = effect; + } + return ret; + +} + + +static int analog_gain (sensor_t *sensor, int val) +{ + + int ret = 0; + ret = write_reg(sensor->slv_addr, MANUAL_AGC_REG, val); + if (ret == 0) { + ESP_LOGD(TAG, "Set analog gain to: %d", val); + } + return ret; + +} + + +static int exposure_line (sensor_t *sensor, int val) +{ + + int ret = 0; + ret = write_reg(sensor->slv_addr, MANUAL_EXP_H_REG, val>>8); + ret += write_reg(sensor->slv_addr, MANUAL_EXP_L_REG, val>>8); + if (ret == 0) { + ESP_LOGD(TAG, "Set exposure_line to: %d", val); + } + return ret; + +} + + +static int init_status(sensor_t *sensor) +{ + sensor->status.brightness = 0; + sensor->status.contrast = 0; + sensor->status.saturation = 0; + sensor->status.sharpness = 0; + sensor->status.denoise = 0; + sensor->status.ae_level = 0; + sensor->status.gainceiling = 0; + sensor->status.awb = 0; + sensor->status.dcw = 0; + sensor->status.agc = 0; + sensor->status.aec = 0; + sensor->status.hmirror = 0; + sensor->status.vflip = 0; + sensor->status.colorbar = 0; + sensor->status.bpc = 0; + sensor->status.wpc = 0; + sensor->status.raw_gma = 0; + sensor->status.lenc = 0; + sensor->status.quality = 0; + sensor->status.special_effect = 0; + sensor->status.wb_mode = 0; + sensor->status.awb_gain = 0; + sensor->status.agc_gain = 0; + sensor->status.aec_value = 0; + sensor->status.aec2 = 0; + return 0; +} + +static int set_dummy(sensor_t *sensor, int val) +{ + ESP_LOGW(TAG, "Unsupported"); + return -1; +} +static int set_gainceiling_dummy(sensor_t *sensor, gainceiling_t val) +{ + ESP_LOGW(TAG, "Unsupported"); + return -1; +} + +int mega_ccm_detect(int slv_addr, sensor_id_t *id) +{ + if (MEGA_CCM_SCCB_ADDR == slv_addr) { + uint8_t h = read_reg(slv_addr, SENSOR_ID_HIGH); + uint8_t l = read_reg(slv_addr, SENSOR_ID_LOW); + uint16_t PID = (h<<8) | l; + if (MEGA_CCM_PID == PID) { + id->PID = PID; + return PID; + } else { + ESP_LOGI(TAG, "Mismatch PID=0x%x", PID); + } + } + return 0; +} + +int mega_ccm_init(sensor_t *sensor) +{ + sensor->init_status = init_status; + sensor->reset = reset; + sensor->set_pixformat = set_pixformat; + sensor->set_framesize = set_framesize; + sensor->set_contrast = set_contrast; + sensor->set_brightness = set_brightness; + sensor->set_saturation = set_saturation; + sensor->set_sharpness = set_dummy; + sensor->set_denoise = set_dummy; + sensor->set_gainceiling = set_gainceiling_dummy; + sensor->set_quality = set_quality; + sensor->set_colorbar = set_dummy; + sensor->set_whitebal = set_dummy; + sensor->set_gain_ctrl = set_dummy; + sensor->set_exposure_ctrl = set_dummy; + sensor->set_hmirror = set_hmirror; + sensor->set_vflip = set_vflip; + + sensor->set_aec2 = set_agc_mode; + sensor->set_awb_gain = set_dummy; + sensor->set_agc_gain = analog_gain; + sensor->set_aec_value = exposure_line; + + sensor->set_special_effect = set_special_effect; + sensor->set_wb_mode = set_wb_mode; + sensor->set_ae_level = set_dummy; + + sensor->set_dcw = set_dummy; + sensor->set_bpc = set_dummy; + sensor->set_wpc = set_dummy; + + sensor->set_raw_gma = set_dummy; + sensor->set_lenc = set_dummy; + + sensor->get_reg = NULL; + sensor->set_reg = NULL; + sensor->set_res_raw = NULL; + sensor->set_pll = NULL; + sensor->set_xclk = NULL; + + ESP_LOGD(TAG, "MEGA_CCM Attached"); + return 0; +} diff --git a/sensors/private_include/mega_ccm.h b/sensors/private_include/mega_ccm.h new file mode 100644 index 0000000000..bbad247b53 --- /dev/null +++ b/sensors/private_include/mega_ccm.h @@ -0,0 +1,31 @@ +/* + * + * MEGA_CCM driver. + * + */ +#ifndef __MEGA_CCM_H__ +#define __MEGA_CCM_H__ + +#include "sensor.h" + +/** + * @brief Detect sensor pid + * + * @param slv_addr SCCB address + * @param id Detection result + * @return + * 0: Can't detect this sensor + * Nonzero: This sensor has been detected + */ +int mega_ccm_detect(int slv_addr, sensor_id_t *id); + +/** + * @brief initialize sensor function pointers + * + * @param sensor pointer of sensor + * @return + * Always 0 + */ +int mega_ccm_init(sensor_t *sensor); + +#endif // __MEGA_CCM_H__ diff --git a/sensors/private_include/mega_ccm_regs.h b/sensors/private_include/mega_ccm_regs.h new file mode 100644 index 0000000000..dbd51dd274 --- /dev/null +++ b/sensors/private_include/mega_ccm_regs.h @@ -0,0 +1,43 @@ +/* + * MEGA_CCM register definitions. + */ +#ifndef __MEGA_CCM_REG_REGS_H__ +#define __MEGA_CCM_REG_REGS_H__ + +#define ID_BASE 0x0000 +#define SENSOR_BASE 0x0100 +#define SYS_CLK_BASE 0x0200 +#define BYPASS_BASE 0XFFF0 + +#define SENSOR_ID_HIGH ID_BASE | 0x00 +#define SENSOR_ID_LOW ID_BASE | 0x01 +#define FIRMWARE_VER ID_BASE | 0x02 + +#define CAMERA_RST_REG SENSOR_BASE|0x02 + + +#define PIXEL_FMT_REG SENSOR_BASE|0x20 +#define RESOLUTION_REG SENSOR_BASE|0x21 +#define BRIGHTNESS_REG SENSOR_BASE|0x22 +#define CONTRAST_REG SENSOR_BASE|0x23 +#define SATURATION_REG SENSOR_BASE|0x24 +#define EXP_COMPENSATE_REG SENSOR_BASE|0x25 +#define AWB_MODE_REG SENSOR_BASE|0x26 +#define SPECIAL_REG SENSOR_BASE|0x27 +#define SHARPNESS_REG SENSOR_BASE|0x28 +#define FOCUS_REG SENSOR_BASE|0x29 +#define IMAGE_QUALITY_REG SENSOR_BASE|0x2A +#define IMAGE_FLIP_REG SENSOR_BASE|0x2B +#define IMAGE_MIRROR_REG SENSOR_BASE|0x2C + + +#define AGC_MODE_REG SENSOR_BASE|0x30 +#define MANUAL_AGC_REG SENSOR_BASE|0x31 +#define MANUAL_EXP_H_REG SENSOR_BASE|0x33 +#define MANUAL_EXP_L_REG SENSOR_BASE|0x34 + + +#define SYSTEM_CLK_DIV_REG SYS_CLK_BASE|0x00 +#define SYSTEM_PLL_DIV_REG SYS_CLK_BASE|0x01 + +#endif //__MEGA_CCM_REG_REGS_H__ diff --git a/sensors/private_include/mega_ccm_settings.h b/sensors/private_include/mega_ccm_settings.h new file mode 100644 index 0000000000..ff8e1866d6 --- /dev/null +++ b/sensors/private_include/mega_ccm_settings.h @@ -0,0 +1,19 @@ +#ifndef _GC032A_SETTINGS_H_ +#define _GC032A_SETTINGS_H_ + +#include +#include +#include "esp_attr.h" +#include "mega_ccm_regs.h" + + +#define REG_DLY 0xffff +#define REGLIST_TAIL 0x0000 + +static const uint16_t mega_ccm_default_regs[][2] = { + {0x0120, 0x01 }, // JPEG + {0x0121, 0x01 }, // 320X240 + {REGLIST_TAIL, 0x00}, +}; + +#endif