Skip to content

Commit

Permalink
Adds esp_camera_return_all() (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterdebie committed Apr 20, 2023
1 parent fac9509 commit 1cb6af8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions driver/cam_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,9 @@ void cam_give(camera_fb_t *dma_buffer)
}
}
}

void cam_give_all(void) {
for (int x = 0; x < cam_obj->frame_cnt; x++) {
cam_obj->frames[x].en = 1;
}
}
8 changes: 8 additions & 0 deletions driver/esp_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,11 @@ esp_err_t esp_camera_load_from_nvs(const char *key)
return ret;
}
}

void esp_camera_return_all(void) {
if (s_state == NULL) {
return;
}
cam_give_all();
}

6 changes: 6 additions & 0 deletions driver/include/esp_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ esp_err_t esp_camera_save_to_nvs(const char *key);
*/
esp_err_t esp_camera_load_from_nvs(const char *key);

/**
* @brief Return all frame buffers to be reused again.
*/
void esp_camera_return_all(void);


#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions driver/private_include/cam_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ camera_fb_t *cam_take(TickType_t timeout);

void cam_give(camera_fb_t *dma_buffer);

void cam_give_all(void);

#ifdef __cplusplus
}
#endif

0 comments on commit 1cb6af8

Please sign in to comment.