#include <SFBByteBuffer.h>
Public Member Functions | |
SFBTxByteBuffer (u8(&buffer)[BYTE_BUFFER_BYTES]) | |
void | resetBG () |
Called in background to reset a tx buffer. | |
void | storeByteBG (u8 data) |
Called in background to store a byte at new end of tx buf, if possible. | |
bool | canStoreBytesBG (u32 count) |
Called in background to check if count more bytes can be stored at new end of tx buf, without a buffer overrun. | |
bool | shipBytesBG () |
Called in background to either start the transmission of, or discard, all bytes stored via storeByteBG since the last call on shipBytesBG or resetBG. | |
int | fetchByteIL () |
Called at interrupt level to fetch next byte from old end of tx buf, if any. |
An SFBTxByteBuffer promises to BG that its spaceAvailable() will never decrease during IL processing. So if BG observes that spaceAvailable() is large enough to do something (e.g., store one byte), BG can then go ahead and perform that action without locking or disabling interrupts.
int SFBTxByteBuffer::fetchByteIL | ( | ) |
Called at interrupt level to fetch next byte from old end of tx buf, if any.
Returns -1 if no bytes available.
bool SFBTxByteBuffer::shipBytesBG | ( | ) |
Called in background to either start the transmission of, or discard, all bytes stored via storeByteBG since the last call on shipBytesBG or resetBG.
If the buffer overflowed during one or more of those storeByteBG calls, then all pending bytes will be discarded, otherwise all pending bytes will be released for transmission.
true
if all pending bytes were released for transmission, and false
if all pending bytes were discarded. void SFBTxByteBuffer::storeByteBG | ( | u8 | data | ) |
Called in background to store a byte at new end of tx buf, if possible.
Note that bytes stored in this manner will not actually ship until the next shipBytesBG call.