lv_circle_buf.h

API reference for lv_circle_buf.h

Report on GitHub

Functions

lv_circle_buf_create

Create a circle buffer

 
lv_circle_buf_t * lv_circle_buf_create(uint32_t capacity, uint32_t element_size)
Parameters
NameTypeDescription
capacityuint32_tthe maximum number of elements in the buffer
element_sizeuint32_tthe 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)
Parameters
NameTypeDescription
bufvoid *pointer to a buffer
capacityuint32_tthe maximum number of elements in the buffer
element_sizeuint32_tthe 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)
Parameters
NameTypeDescription
arrayconst 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)
Parameters
NameTypeDescription
circle_buflv_circle_buf_t *pointer to a buffer
capacityuint32_tthe 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)
Parameters
NameTypeDescription
circle_buflv_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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_buflv_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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_bufconst 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)
Parameters
NameTypeDescription
circle_buflv_circle_buf_t *pointer to buffer
datavoid *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)
Parameters
NameTypeDescription
circle_buflv_circle_buf_t *pointer to buffer
dataconst 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)
Parameters
NameTypeDescription
circle_buflv_circle_buf_t *pointer to buffer
countuint32_tthe number of values to fill
fill_cblv_circle_buf_fill_cb_tthe callback function to fill the buffer
user_datavoid *

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)
Parameters
NameTypeDescription
circle_buflv_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)
Parameters
NameTypeDescription
circle_bufconst lv_circle_buf_t *pointer to buffer
datavoid *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)
Parameters
NameTypeDescription
circle_bufconst lv_circle_buf_t *pointer to buffer
indexuint32_tthe index of the value to peek, if the index is greater than the size of the buffer, it will return looply.
datavoid *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 — param fill_cb

Dependencies

How is this guide?

Last updated on

On this page