Skip to content

Commit

Permalink
add camera deinit api
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitshaoxiang committed Apr 7, 2024
1 parent b565ffa commit 03f811d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/utility/Camera_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ static camera_config_t camera_config = {
.fb_count = 2,
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
.sccb_i2c_port = 0,
.sccb_i2c_port = 1,
};

bool Camera_Class::begin() {
config = &camera_config;
esp_err_t err = esp_camera_init(&camera_config);
if (err != ESP_OK) {
return false;
Expand All @@ -41,6 +42,14 @@ bool Camera_Class::begin() {
return true;
}

bool Camera_Class::deinit() {
esp_err_t err = esp_camera_deinit();
if (err != ESP_OK) {
return false;
}
return true;
}

bool Camera_Class::get() {
fb = esp_camera_fb_get();
if (!fb) {
Expand Down
1 change: 1 addition & 0 deletions src/utility/Camera_Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Camera_Class {
bool begin();
bool get();
bool free();
bool deinit();
};

#endif
2 changes: 1 addition & 1 deletion src/utility/RTC8563_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static std::uint8_t byteToBcd2(std::uint8_t value) {
}

bool RTC8563_Class::begin() {
_i2c.begin(&Wire1, 12, 14);
_i2c.begin(&Wire, 12, 14);
_i2c.writeByte(BM8563_I2C_ADDR, 0x00, 0x00);
return _i2c.writeByte(BM8563_I2C_ADDR, 0x0E, 0x03);
;
Expand Down

0 comments on commit 03f811d

Please sign in to comment.