Go to the source code of this file.
Classes | |
struct | ring_buf_t |
Functions | |
int | ringBufClear (ring_buf_t *rbuf) |
Clear the entire buffer. More... | |
int | ringBufEmpty (const ring_buf_t *rbuf) |
This function returns 1 if the buffer is empty, 0 if not empty. More... | |
int | ringBufFind (const ring_buf_t *rbuf, const unsigned char *str, int len) |
This function finds the index of the first matching string in the ring buffer. Returns -1 if not found. More... | |
int | ringBufFree (const ring_buf_t *rbuf) |
This function returns the number of bytes free in UART Rx buffer. Important: Buffer size is one less than init buffer size so pointers don't wrap. More... | |
void | ringBufInit (ring_buf_t *rbuf, unsigned char *buf, int bufSize, int wordSize) |
Initialize ring buffer pointers. More... | |
int | ringBufPeek (const ring_buf_t *rbuf, unsigned char *buf, int len, int offset) |
This function reads data from the ring buffer without removing any data. Same as ringBufPop without moving pointers. More... | |
int | ringBufRead (ring_buf_t *rbuf, unsigned char *buf, int len) |
This function reads data from the ring buffer. More... | |
int | ringBufReadToChar (ring_buf_t *rbuf, unsigned char *buf, int len, unsigned char character) |
This function returns everything up to and including the first occurrence of a character. If the character is not found, then nothing (zero) is returned. More... | |
int | ringBufReadToChar2 (ring_buf_t *rbuf, unsigned char *buf, int len, unsigned char character1, unsigned char character2) |
This function returns everything up to and including the first occurrence of a character. If the character is not found, then nothing (zero) is returned. More... | |
int | ringBufRemove (ring_buf_t *rbuf, int len) |
This function removes data from the ring buffer. More... | |
int | ringBufUsed (const ring_buf_t *rbuf) |
This function returns the number of bytes currently in ring buffer. More... | |
int | ringBufWrite (ring_buf_t *rbuf, unsigned char *buf, int numBytes) |
This function writes data to the ring buffer. More... | |
int ringBufClear | ( | ring_buf_t * | rbuf | ) |
Clear the entire buffer.
Definition at line 467 of file ring_buffer.c.
int ringBufEmpty | ( | const ring_buf_t * | rbuf | ) |
This function returns 1 if the buffer is empty, 0 if not empty.
Definition at line 481 of file ring_buffer.c.
int ringBufFind | ( | const ring_buf_t * | rbuf, |
const unsigned char * | str, | ||
int | len | ||
) |
This function finds the index of the first matching string in the ring buffer. Returns -1 if not found.
rbuf | Ring buffer struct pointer. |
len | Length of data to attempt reading. |
str | Character string to search for. |
Definition at line 387 of file ring_buffer.c.
int ringBufFree | ( | const ring_buf_t * | rbuf | ) |
This function returns the number of bytes free in UART Rx buffer. Important: Buffer size is one less than init buffer size so pointers don't wrap.
Definition at line 61 of file ring_buffer.c.
void ringBufInit | ( | ring_buf_t * | rbuf, |
unsigned char * | buf, | ||
int | bufSize, | ||
int | wordSize | ||
) |
Initialize ring buffer pointers.
Definition at line 29 of file ring_buffer.c.
int ringBufPeek | ( | const ring_buf_t * | rbuf, |
unsigned char * | buf, | ||
int | len, | ||
int | offset | ||
) |
This function reads data from the ring buffer without removing any data. Same as ringBufPop without moving pointers.
rbuf | Ring buffer struct pointer. |
buf | Buffer to copy data to. |
len | Length of data to attempt reading. |
Definition at line 188 of file ring_buffer.c.
int ringBufRead | ( | ring_buf_t * | rbuf, |
unsigned char * | buf, | ||
int | len | ||
) |
This function reads data from the ring buffer.
rbuf | Ring buffer struct pointer. |
buf | Buffer to copy data to. |
len | Length of data to attempt reading. |
Definition at line 136 of file ring_buffer.c.
int ringBufReadToChar | ( | ring_buf_t * | rbuf, |
unsigned char * | buf, | ||
int | len, | ||
unsigned char | character | ||
) |
This function returns everything up to and including the first occurrence of a character. If the character is not found, then nothing (zero) is returned.
rbuf | Ring buffer struct pointer. |
buf | Buffer to copy data to. |
len | Length of data to attempt reading. |
character | Value to search for. |
Definition at line 288 of file ring_buffer.c.
int ringBufReadToChar2 | ( | ring_buf_t * | rbuf, |
unsigned char * | buf, | ||
int | len, | ||
unsigned char | character1, | ||
unsigned char | character2 | ||
) |
This function returns everything up to and including the first occurrence of a character. If the character is not found, then nothing (zero) is returned.
rbuf | Ring buffer struct pointer. |
buf | Buffer to copy data to. |
len | Length of data to attempt reading. |
character1 | Value to search for. |
character2 | Value to search for. |
Definition at line 306 of file ring_buffer.c.
int ringBufRemove | ( | ring_buf_t * | rbuf, |
int | len | ||
) |
This function removes data from the ring buffer.
rbuf | Ring buffer struct pointer. |
len | Number of bytes to remove. |
Definition at line 432 of file ring_buffer.c.
int ringBufUsed | ( | const ring_buf_t * | rbuf | ) |
This function returns the number of bytes currently in ring buffer.
Definition at line 43 of file ring_buffer.c.
int ringBufWrite | ( | ring_buf_t * | rb, |
unsigned char * | buf, | ||
int | numBytes | ||
) |
This function writes data to the ring buffer.
rbuf | Ring buffer struct pointer. |
buf | Buffer to copy data from. |
len | Length of data to copy. |
Definition at line 76 of file ring_buffer.c.