Skip to content

esp_camera_available_frames implementation #723

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: master
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
5 changes: 5 additions & 0 deletions driver/cam_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,3 +535,8 @@ void cam_give_all(void) {
cam_obj->frames[x].en = 1;
}
}

bool cam_get_available_frames(void)
{
return 0 < uxQueueMessagesWaiting(cam_obj->frame_buffer_queue);
}
7 changes: 7 additions & 0 deletions driver/esp_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,10 @@ void esp_camera_return_all(void) {
cam_give_all();
}

bool esp_camera_available_frames(void)
{
if (s_state == NULL) {
return false;
}
return cam_get_available_frames();
}
5 changes: 5 additions & 0 deletions driver/include/esp_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ esp_err_t esp_camera_load_from_nvs(const char *key);
*/
void esp_camera_return_all(void);

/**
* @brief Check if there are available frames to be immediately acquired
*/
bool esp_camera_available_frames(void);


#ifdef __cplusplus
}
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 @@ -57,6 +57,8 @@ void cam_give(camera_fb_t *dma_buffer);

void cam_give_all(void);

bool cam_get_available_frames(void);

#ifdef __cplusplus
}
#endif