fifo_read

Description

This function returns the next available byte from the FIFO. If the FIFO is empty the value fifo_error is returned instead. The order in which data is written to and read from a FIFO is strictly preserved and is refered to as first in first out order.

Definition

int fifo_read(FIFO *fifo)

Library

LIB/fifo_lib.bas

Usage

	int	ch

	ch = fifo_read(&xfifo)

	if ch >= 0 then
		// ch is a valid byte taken from the FIFO

		process(ch)
	else
		// ch is the fifo_error condition which
		// indicates the fifo was empty

		do_something_because_fifo_empty()
	endif
On entry:
fifo is a pointer to a FIFO or an array initalised for use as a FIFO.
On exit:
return the next byte available from fifo (removing it). If fifo is empty the value fifo_error is returned instead.