/* Initialises the FIFO buffer. 
This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */
bool fifo_read(fifo_t *f, void *p_buffer)
/* Initialises the FIFO buffer. 
This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */
bool fifo_read(fifo_t *f, void *p_buffer)
{
  if( !is_fifo_initalized(f) || fifo_isEmpty(f) )
  {
    return false;
  }
  mutex_lock(f);
  memcpy(p_buffer,
         f->buffer + (f->rd_idx * f->item_size),
         f->item_size);
  f->rd_idx = (f->rd_idx + 1) % f->depth;
  f->count--;
  mutex_unlock(f);
  return true;
}