Skip to content
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
6 changes: 6 additions & 0 deletions FIFO.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,9 @@ static void fifo_copy_to(fifo_t fifo, const void *item)
fifo->writeoffset = 0;
}
}

int fifo_count(fifo_t fifo){
uint8_t fifo_len;
fifo_len = fifo->storedbytes/fifo->itemsize;
return fifo_len;
}
7 changes: 7 additions & 0 deletions FIFO.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ extern "C" {
*/
bool fifo_discard(fifo_t fifo, uint16_t count, enum fifo_side side);

/*!
* @brief this function returns the number of elements in the FIFO
* @param fifo pointer to the FIFO
* @return the number of elements in the FIFO
*/
int fifo_count(fifo_t fifo);

#ifdef __cplusplus
}
#endif
Expand Down