Skip to content

GC0308: add explicit constructor to enable custom camera configs #69

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions src/utility/GC0308.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ static camera_config_t camera_config = {
.sccb_i2c_port = -1,
};

bool GC0308::begin()
GC0308::GC0308() {
fb = nullptr;
sensor = nullptr;
config = &camera_config;
}

bool GC0308::begin(camera_config_t* _config)
{
M5.In_I2C.release();
esp_err_t err = esp_camera_init(&camera_config);
if (_config) {
config = _config;
}
esp_err_t err = esp_camera_init(config);
if (err != ESP_OK) {
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion src/utility/GC0308.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class GC0308 {
camera_fb_t* fb;
sensor_t* sensor;
camera_config_t* config;
bool begin();

GC0308();
bool begin(camera_config_t* _config = nullptr);
bool get();
bool free();
};
Expand Down