Skip to content

Commit 03f811d

Browse files
committed
add camera deinit api
1 parent b565ffa commit 03f811d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/utility/Camera_Class.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ static camera_config_t camera_config = {
2929
.fb_count = 2,
3030
.fb_location = CAMERA_FB_IN_PSRAM,
3131
.grab_mode = CAMERA_GRAB_WHEN_EMPTY,
32-
.sccb_i2c_port = 0,
32+
.sccb_i2c_port = 1,
3333
};
3434

3535
bool Camera_Class::begin() {
36+
config = &camera_config;
3637
esp_err_t err = esp_camera_init(&camera_config);
3738
if (err != ESP_OK) {
3839
return false;
@@ -41,6 +42,14 @@ bool Camera_Class::begin() {
4142
return true;
4243
}
4344

45+
bool Camera_Class::deinit() {
46+
esp_err_t err = esp_camera_deinit();
47+
if (err != ESP_OK) {
48+
return false;
49+
}
50+
return true;
51+
}
52+
4453
bool Camera_Class::get() {
4554
fb = esp_camera_fb_get();
4655
if (!fb) {

src/utility/Camera_Class.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Camera_Class {
3838
bool begin();
3939
bool get();
4040
bool free();
41+
bool deinit();
4142
};
4243

4344
#endif

src/utility/RTC8563_Class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static std::uint8_t byteToBcd2(std::uint8_t value) {
2929
}
3030

3131
bool RTC8563_Class::begin() {
32-
_i2c.begin(&Wire1, 12, 14);
32+
_i2c.begin(&Wire, 12, 14);
3333
_i2c.writeByte(BM8563_I2C_ADDR, 0x00, 0x00);
3434
return _i2c.writeByte(BM8563_I2C_ADDR, 0x0E, 0x03);
3535
;

0 commit comments

Comments
 (0)