You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,18 +21,18 @@ use those two get functionalities simultaniously.
21
21
22
22
Function "ring_buffer_get_by_index" supports two kind of access types:
23
23
24
-
1. NORMAL ACCESS: classical aproach, where index is a positive
24
+
1.**NORMAL ACCESS: classical aproach**, where index is a positive
25
25
number and simple represants buffer index. This approach
26
26
has no information about time stamps of values inside buffer.
27
27
Range: [0, size)
28
28
29
-
2. INVERS ACCESS: chronologically aproach, where index is a negative number.
29
+
2.**INVERS ACCESS: chronologically aproach**, where index is a negative number.
30
30
Meaning that "-1" value will always returns latest value in
31
31
buffer and "-size" index value will return oldest value
32
-
in buffer. This feature becomes very handy when performing
33
-
digital filtering where ring buffer can represants sample
32
+
in buffer. ***This feature becomes very handy when performing
33
+
digital filtering (convolution) where ring buffer can represants sample
34
34
window and thus easy access from oldest to latest sample
35
-
can be achieved with invers access.
35
+
can be achieved with invers access.***
36
36
Range of index: [-size, -1]
37
37
38
38
@@ -41,21 +41,28 @@ Function "ring_buffer_get_by_index" supports two kind of access types:
41
41
42
42
This module needs only ANSI C standard libraries.
43
43
44
-
## API
44
+
## Multientry Limitations
45
+
46
+
Guidance for multi-entry usage:
47
+
-**It is recomented to use ring_buffer between two task/interrupts/cores in provider/consumer manner.** Meaning one task/interrupt/core is writing to ring_buffer and other task/interrupt/core is reading from it.
48
+
-**It is not recommended for two or more task/interrupt/core to read/write to same ring_buffer instance!**
|**ring_buffer_init**| Initialization of ring buffer | ring_buffer_status_t ring_buffer_init(p_ring_buffer_t * p_ring_buffer, const uint32_t size, const ring_buffer_attr_t * const p_attr) |
56
+
|**ring_buffer_is_init**| Get initialization flag | ring_buffer_status_t ring_buffer_is_init(p_ring_buffer_t buf_inst, bool * const p_is_init) |
57
+
|**ring_buffer_add**| Add element to ring buffer in FIFO form | ring_buffer_status_t ring_buffer_add(p_ring_buffer_t buf_inst, const void * const p_item) |
58
+
|**ring_buffer_get**| Get element from ring buffer in FIFO form | ring_buffer_status_t ring_buffer_get(p_ring_buffer_t buf_inst, void * const p_item) |
59
+
|**ring_buffer_get_by_index**| Get element from ring buffer without any side effects. Access by index. | ring_buffer_status_t ring_buffer_get_by_index(p_ring_buffer_t buf_inst, void * const p_item, const int32_t idx) |
60
+
|**ring_buffer_reset**| Reset ring buffer | ring_buffer_status_t ring_buffer_reset(p_ring_buffer_t buf_inst) |
61
+
|**ring_buffer_get_name**| Get ring buffer name | ring_buffer_status_t ring_buffer_get_name(p_ring_buffer_t buf_inst, char * const p_name)|
62
+
|**ring_buffer_get_taken**| Get number of taken space of elements inside a buffer | ring_buffer_status_t ring_buffer_get_taken(p_ring_buffer_t buf_inst, uint32_t * const p_taken)|
63
+
|**ring_buffer_get_free**| Get number of free space of elements inside a buffer | ring_buffer_status_t ring_buffer_get_free(p_ring_buffer_t buf_inst, uint32_t * const p_free)|
64
+
|**ring_buffer_get_size**| Get size of all items inside ring buffer | ring_buffer_status_t ring_buffer_get_size(p_ring_buffer_t buf_inst, uint32_t * const p_size)|
65
+
|**ring_buffer_get_item_size**| Get item size in bytes | ring_buffer_status_t ring_buffer_get_item_size(p_ring_buffer_t buf_inst, uint32_t * const p_item_size)|
59
66
60
67
61
68
NOTE: Detailed description of functions can be found in doxygen (doc/**ring_buffer_Vx_x_x.zip**)!
0 commit comments