lv_circle_buf.h
API reference for lv_circle_buf.h
Functions
lv_circle_buf_create
Create a circle buffer
lv_circle_buf_t * lv_circle_buf_create(uint32_t capacity, uint32_t element_size)| Name | Type | Description |
|---|---|---|
capacity | uint32_t | the maximum number of elements in the buffer |
element_size | uint32_t | the size of an element in bytes |
Returns: lv_circle_buf_t * — pointer to the created buffer
lv_circle_buf_create_from_buf
Create a circle buffer from an existing buffer
lv_circle_buf_t * lv_circle_buf_create_from_buf(void *buf, uint32_t capacity, uint32_t element_size)| Name | Type | Description |
|---|---|---|
buf | void * | pointer to a buffer |
capacity | uint32_t | the maximum number of elements in the buffer |
element_size | uint32_t | the size of an element in bytes |
Returns: lv_circle_buf_t * — pointer to the created buffer
lv_circle_buf_create_from_array
Create a circle buffer from an existing array
lv_circle_buf_t * lv_circle_buf_create_from_array(const lv_array_t *array)| Name | Type | Description |
|---|---|---|
array | const lv_array_t * | pointer to an array |
Returns: lv_circle_buf_t * — pointer to the created buffer
lv_circle_buf_resize
Resize the buffer
lv_result_t lv_circle_buf_resize(lv_circle_buf_t *circle_buf, uint32_t capacity)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to a buffer |
capacity | uint32_t | the new capacity of the buffer |
Returns: lv_result_t — LV_RESULT_OK: the buffer is resized; LV_RESULT_INVALID: the buffer is not resized
lv_circle_buf_destroy
Destroy a circle buffer
void lv_circle_buf_destroy(lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
lv_circle_buf_size
Get the size of the buffer
uint32_t lv_circle_buf_size(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: uint32_t — the number of elements in the buffer
lv_circle_buf_capacity
Get the capacity of the buffer
uint32_t lv_circle_buf_capacity(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: uint32_t — the maximum number of elements in the buffer
lv_circle_buf_remain
Get the remaining space in the buffer
uint32_t lv_circle_buf_remain(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: uint32_t — the number of elements that can be written to the buffer
lv_circle_buf_is_empty
Check if the buffer is empty
bool lv_circle_buf_is_empty(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: bool — true: the buffer is empty; false: the buffer is not empty
lv_circle_buf_is_full
Check if the buffer is full
bool lv_circle_buf_is_full(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: bool — true: the buffer is full; false: the buffer is not full
lv_circle_buf_reset
Reset the buffer
void lv_circle_buf_reset(lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
lv_circle_buf_head
Get the head of the buffer
void * lv_circle_buf_head(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: void * — pointer to the head of the buffer
lv_circle_buf_tail
Get the tail of the buffer
void * lv_circle_buf_tail(const lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
Returns: void * — pointer to the tail of the buffer
lv_circle_buf_read
Read a value
lv_result_t lv_circle_buf_read(lv_circle_buf_t *circle_buf, void *data)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
data | void * | pointer to a variable to store the read value |
Returns: lv_result_t — LV_RESULT_OK: the value is read; LV_RESULT_INVALID: the value is not read
lv_circle_buf_write
Write a value
lv_result_t lv_circle_buf_write(lv_circle_buf_t *circle_buf, const void *data)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
data | const void * | pointer to the value to write |
Returns: lv_result_t — LV_RESULT_OK: the value is written; LV_RESULT_INVALID: the value is not written
lv_circle_buf_fill
Fill the buffer with values
uint32_t lv_circle_buf_fill(lv_circle_buf_t *circle_buf, uint32_t count, lv_circle_buf_fill_cb_t fill_cb, void *user_data)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
count | uint32_t | the number of values to fill |
fill_cb | lv_circle_buf_fill_cb_t | the callback function to fill the buffer |
user_data | void * |
Returns: uint32_t — the number of values filled
lv_circle_buf_skip
Skip a value
lv_result_t lv_circle_buf_skip(lv_circle_buf_t *circle_buf)| Name | Type | Description |
|---|---|---|
circle_buf | lv_circle_buf_t * | pointer to buffer |
Returns: lv_result_t — LV_RESULT_OK: the value is skipped; LV_RESULT_INVALID: the value is not skipped
lv_circle_buf_peek
Peek a value
lv_result_t lv_circle_buf_peek(const lv_circle_buf_t *circle_buf, void *data)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
data | void * | pointer to a variable to store the peeked value |
Returns: lv_result_t — LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked
lv_circle_buf_peek_at
Peek a value at an index
lv_result_t lv_circle_buf_peek_at(const lv_circle_buf_t *circle_buf, uint32_t index, void *data)| Name | Type | Description |
|---|---|---|
circle_buf | const lv_circle_buf_t * | pointer to buffer |
index | uint32_t | the index of the value to peek, if the index is greater than the size of the buffer, it will return looply. |
data | void * | pointer to a variable to store the peeked value |
Returns: lv_result_t — LV_RESULT_OK: the value is peeked; LV_RESULT_INVALID: the value is not peeked
Typedefs
lv_circle_buf_fill_cb_t
typedef bool(* lv_circle_buf_fill_cb_t) (void *buf, uint32_t buff_len, int32_t index, void *user_data)Used by 1 function
lv_circle_buf_fill— paramfill_cb
Dependencies
Indirect dependencies
How is this guide?
Last updated on