Generic cyclic buffer library.
More...
Generic cyclic buffer library.
◆ GUI_BUFFER_INITIALIZED
| #define GUI_BUFFER_INITIALIZED 0x01 |
◆ GUI_BUFFER_MALLOC
| #define GUI_BUFFER_MALLOC 0x02 |
Buffer uses malloc for memory
◆ gui_buffer_free()
Free memory for buffer allocated using dynamic memory allocation.
- Note
- This function has sense only if dynamic allocation was used for memory buffer
- Parameters
-
◆ gui_buffer_getfree()
Gets number of free elements in buffer.
- Parameters
-
- Returns
- Number of free elements in buffer
◆ gui_buffer_getfull()
Gets number of elements in buffer.
- Parameters
-
- Returns
- Number of elements in buffer
◆ gui_buffer_init()
| uint8_t gui_buffer_init |
( |
gui_buff_t * |
buff, |
|
|
uint32_t |
size, |
|
|
void * |
buff_ptr |
|
) |
| |
Initializes buffer structure for work.
- Parameters
-
| buff | Pointer to gui_buff_t structure to initialize |
| size | Size of buffer in units of bytes |
| buff_ptr | Pointer to array for buffer storage. Its length should be equal to |
| Size | parameter. If NULL is passed as parameter, internal memory management will be used to allocate memory |
- Returns
- buff initialization status:
- 0: buff initialized OK
- > 0: buff initialization error. Malloc has failed with allocation
◆ gui_buffer_read()
| uint32_t gui_buffer_read |
( |
gui_buff_t * |
buff, |
|
|
void * |
data, |
|
|
uint32_t |
count |
|
) |
| |
Reads data from buffer.
- Parameters
-
| buff | Pointer to gui_buff_t structure |
| data | Pointer to data where read values will be stored |
| count | Number of elements of type unsigned char to read |
- Returns
- Number of elements read from buffer
◆ gui_buffer_reset()
Resets (clears) buffer pointers.
- Parameters
-
◆ gui_buffer_write()
| uint32_t gui_buffer_write |
( |
gui_buff_t * |
buff, |
|
|
const void * |
data, |
|
|
uint32_t |
count |
|
) |
| |
Writes data to buffer.
- Parameters
-
| buff | Pointer to gui_buff_t structure |
| data | Pointer to data to be written |
| count | Number of elements of type unsigned char to write |
- Returns
- Number of elements written in buffer