Skip to content

Commit 1cb6af8

Browse files
author
Wouter de Bie
authored
Adds esp_camera_return_all() (#519)
1 parent fac9509 commit 1cb6af8

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

driver/cam_hal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,9 @@ void cam_give(camera_fb_t *dma_buffer)
506506
}
507507
}
508508
}
509+
510+
void cam_give_all(void) {
511+
for (int x = 0; x < cam_obj->frame_cnt; x++) {
512+
cam_obj->frames[x].en = 1;
513+
}
514+
}

driver/esp_camera.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,11 @@ esp_err_t esp_camera_load_from_nvs(const char *key)
476476
return ret;
477477
}
478478
}
479+
480+
void esp_camera_return_all(void) {
481+
if (s_state == NULL) {
482+
return;
483+
}
484+
cam_give_all();
485+
}
486+

driver/include/esp_camera.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ esp_err_t esp_camera_save_to_nvs(const char *key);
231231
*/
232232
esp_err_t esp_camera_load_from_nvs(const char *key);
233233

234+
/**
235+
* @brief Return all frame buffers to be reused again.
236+
*/
237+
void esp_camera_return_all(void);
238+
239+
234240
#ifdef __cplusplus
235241
}
236242
#endif

driver/private_include/cam_hal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ camera_fb_t *cam_take(TickType_t timeout);
5555

5656
void cam_give(camera_fb_t *dma_buffer);
5757

58+
void cam_give_all(void);
59+
5860
#ifdef __cplusplus
5961
}
6062
#endif

0 commit comments

Comments
 (0)