Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mega ccm driver support #701

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions driver/esp_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions driver/include/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef enum {
SC101IOT_PID = 0xda4a,
SC030IOT_PID = 0x9a46,
SC031GS_PID = 0x0031,
MEGA_CCM_PID =0x039E,
} camera_pid_t;

typedef enum {
Expand All @@ -48,6 +49,7 @@ typedef enum {
CAMERA_SC101IOT,
CAMERA_SC030IOT,
CAMERA_SC031GS,
CAMERA_MEGA_CCM,
CAMERA_MODEL_MAX,
CAMERA_NONE,
} camera_model_t;
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -106,6 +111,7 @@ typedef enum {
FRAMESIZE_WQXGA, // 2560x1600
FRAMESIZE_P_FHD, // 1080x1920
FRAMESIZE_QSXGA, // 2560x1920
FRAMESIZE_5MP, // 2592x1944
FRAMESIZE_INVALID
} framesize_t;

Expand Down
4 changes: 4 additions & 0 deletions driver/sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/camera_example/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
idf_component_register(SRCS take_picture.c
PRIV_INCLUDE_DIRS .
PRIV_REQUIRES nvs_flash)
PRIV_REQUIRES nvs_flash esp_psram)
21 changes: 20 additions & 1 deletion examples/camera_example/main/take_picture.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// 1. Board setup (Uncomment):
// #define BOARD_WROVER_KIT
// #define BOARD_ESP32CAM_AITHINKER
// #define BOARD_ESP32S3_WROOM

/**
* 2. Kconfig setup
Expand Down Expand Up @@ -92,7 +93,25 @@
#define CAM_PIN_PCLK 22

#endif

// ESP32S3 (WROOM) PIN Map
#ifdef BOARD_ESP32S3_WROOM
#define CAM_PIN_PWDN 38
#define CAM_PIN_RESET -1 //software reset will be performed
#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
ArduCAM marked this conversation as resolved.
Show resolved Hide resolved
static const char *TAG = "example:take_picture";

#if ESP_CAMERA_SUPPORTED
Expand Down
Loading