Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Xifo< xifo_dtype > Class Template Reference
Circular Buffer object. More...
#include <xIFO.h>
Public Member Functions | |
| Xifo (uint32_t size) | |
| Initialise xifo. | |
| Xifo (uint32_t size, xifo_dtype *sp) | |
| Initialise xifo. | |
| ~Xifo (void) | |
| Deinitialise (and deallocate) buffer xifo. | |
| void | clear (void) |
| Clear buffer memory pool. | |
| void | reset (void) |
| Reset buffer. | |
| uint32_t | write (xifo_dtype data) |
| Write to buffer. | |
| xifo_dtype | read_lr (uint32_t index) |
| Read from buffer (lr) Least Recent oriented (fifo) | |
| xifo_dtype | pop_lr () |
| Pop (lr) least recent from buffer (fifo) | |
| xifo_dtype | read_mr (uint32_t index) |
| Read from buffer (mr) Most Recent oriented (filo) | |
| xifo_dtype | pop_mr () |
| Pop (mr) most recent from buffer (filo) | |
| uint32_t | size () |
| Get buffer size. | |
| uint32_t | used () |
| Get number of used elements. | |
| uint32_t | full () |
| Get full flag. | |
| uint32_t | free () |
| Get number of free elements. | |
Detailed Description
template<class xifo_dtype>
class Xifo< xifo_dtype >
Circular Buffer object.
This class holds the object of a circular buffer
Definition at line 75 of file xIFO.h.
Constructor & Destructor Documentation
| Xifo | ( | uint32_t | size ) |
| Xifo | ( | uint32_t | size, |
| xifo_dtype * | sp | ||
| ) |
| ~Xifo | ( | void | ) |
Member Function Documentation
| void clear | ( | void | ) |
| xifo_dtype pop_lr | ( | ) |
Pop (lr) least recent from buffer (fifo)
- Note:
- Buffer state will be altered
- Warning:
- Consider this opertaion as atomic!
Read and remove the least recently added from the buffer. Using this results in a fifo type of buffer.
- Parameters:
-
[in] c Pointer to xifo_SIZETYPE_tused for configuration.
- Returns:
- Contents of element or 0 if failed (element can hold 0)
| xifo_dtype pop_mr | ( | ) |
Pop (mr) most recent from buffer (filo)
- Note:
- Buffer state will be altered
- Warning:
- Consider this opertaion as atomic!
Read and remove the most recently added from the buffer. Using this results in a stack type of buffer.
- Parameters:
-
[in] c Pointer to xifo_SIZETYPE_tused for configuration.
- Returns:
- Contents of element or 0 if failed (element can hold 0)
| xifo_dtype read_lr | ( | uint32_t | index ) |
Read from buffer (lr) Least Recent oriented (fifo)
- Note:
- Buffer state will be preserved
- Warning:
- Consider this opertaion as atomic!
Read n elements from the oldest element to the most recent. As for index[0] the least recently added element is returned. And for index[count] the most recent element is returned. This makes it possible to peek in fifo.
- Parameters:
-
[in] c Pointer to xifo_SIZETYPE_tused for configuration.[in] index Index relative from least recent
- Returns:
- Contents of element or 0 if failed (element can hold 0)
| xifo_dtype read_mr | ( | uint32_t | index ) |
Read from buffer (mr) Most Recent oriented (filo)
- Note:
- Buffer state will be preserved
- Warning:
- Consider this opertaion as atomic!
Read n elements back in time. As for index[0] the most recently added element is returned. And for index[count] the oldest element is returned. This makes it possible to keep history. For DSP application.
- Parameters:
-
[in] c Pointer to xifo_SIZETYPE_tused for configuration.[in] index Index relative from most recent
- Returns:
- Contents of element or 0 if failed (element can hold 0)
| void reset | ( | void | ) |
| uint32_t write | ( | xifo_dtype | data ) |
Write to buffer.
- Note:
- Readpointer is automatically set to the last added element.
- Warning:
- Consider this opertaion as atomic!
Adds a value to the buffer. Automatically overwrites oldest elements when full.
- Parameters:
-
[in] c Pointer to xifo_SIZETYPE_tused for configuration.[in] data Data to add to buffer
- Returns:
- Number of free buffer elements
Generated on Mon Jul 18 2022 08:08:14 by
1.7.2