forked from haraldwolff/avr-fw-modules
14 lines
220 B
C
14 lines
220 B
C
|
#include <hwo/fifo.h>
|
||
|
#include <sys/atomic.h>
|
||
|
|
||
|
uint8_t fifo_avail(FIFO* fifo)
|
||
|
{
|
||
|
ATOMIC
|
||
|
|
||
|
if (fifo->pWrite < fifo->pRead)
|
||
|
return fifo->size - fifo->pRead + fifo->pWrite;
|
||
|
else
|
||
|
return fifo->pWrite - fifo->pRead;
|
||
|
};
|
||
|
|