![]() |
BLE5.2 1.0
开发文档说明
|
类 | |
| struct | ring_buffer |
类型定义 | |
| typedef uint32_t | ring_buffer_size_t |
| typedef struct ring_buffer | ring_buffer_t |
函数 | |
| void | ring_buffer_create (ring_buffer_t *rb, uint8_t *buffer, uint32_t size) |
| void | ring_buffer_queue (ring_buffer_t *rb, uint8_t data) |
| void | ring_buffer_queue_arr (ring_buffer_t *rb, uint8_t *data, ring_buffer_size_t size) |
| ring_buffer_size_t | ring_buffer_dequeue (ring_buffer_t *rb, uint8_t *data) |
| ring_buffer_size_t | ring_buffer_dequeue_arr (ring_buffer_t *rb, uint8_t *data, ring_buffer_size_t len) |
| ring_buffer_size_t | ring_buffer_peek (ring_buffer_t *rb, uint8_t *data, ring_buffer_size_t index) |
| ring_buffer_size_t | ring_buffer_is_empty (ring_buffer_t *rb) |
| ring_buffer_size_t | ring_buffer_is_full (ring_buffer_t *rb) |
| ring_buffer_size_t | ring_buffer_num_items (ring_buffer_t *rb) |
Prototypes and structures for the ring buffer module.
在文件 ringbuffer.h 中定义.
| typedef uint32_t ring_buffer_size_t |
The size of a ring buffer. Due to the design only RING_BUFFER_SIZE-1 items can be contained in the buffer. The buffer size must be a power of two. The type which is used to hold the size and the indicies of the buffer. Must be able to fit RING_BUFFER_SIZE .
在文件 ringbuffer.h 第 31 行定义.
| typedef struct ring_buffer ring_buffer_t |
Used as a modulo operator as a % b = (a & (b − 1)) where a is a positive index in the buffer and b is the (power of two) size of the buffer. Structure which holds a ring buffer. The buffer contains a buffer array as well as metadata for the ring buffer.
| void ring_buffer_create | ( | ring_buffer_t * | rb, |
| uint8_t * | buffer, | ||
| uint32_t | size | ||
| ) |
Initializes the ring buffer pointed to by buffer. This function can also be used to empty/reset the buffer.
| buffer | The ring buffer to initialize. |
在文件 ringbuffer.c 第 11 行定义.
| ring_buffer_size_t ring_buffer_dequeue | ( | ring_buffer_t * | rb, |
| uint8_t * | data | ||
| ) |
Returns the oldest byte in a ring buffer.
| buffer | The buffer from which the data should be returned. |
| data | A pointer to the location at which the data should be placed. |
在文件 ringbuffer.c 第 50 行定义.
| ring_buffer_size_t ring_buffer_dequeue_arr | ( | ring_buffer_t * | rb, |
| uint8_t * | data, | ||
| ring_buffer_size_t | len | ||
| ) |
Returns the len oldest bytes in a ring buffer.
| buffer | The buffer from which the data should be returned. |
| data | A pointer to the array at which the data should be placed. |
| len | The maximum number of bytes to return. |
在文件 ringbuffer.c 第 63 行定义.
|
inline |
Returns whether a ring buffer is empty.
| buffer | The buffer for which it should be returned whether it is empty. |
在文件 ringbuffer.h 第 139 行定义.
|
inline |
Returns whether a ring buffer is full.
| buffer | The buffer for which it should be returned whether it is full. |
在文件 ringbuffer.h 第 149 行定义.
|
inline |
Returns the number of items in a ring buffer.
| buffer | The buffer for which the number of items should be returned. |
在文件 ringbuffer.h 第 160 行定义.
| ring_buffer_size_t ring_buffer_peek | ( | ring_buffer_t * | rb, |
| uint8_t * | data, | ||
| ring_buffer_size_t | index | ||
| ) |
Peeks a ring buffer, i.e. returns an element without removing it.
| buffer | The buffer from which the data should be returned. |
| data | A pointer to the location at which the data should be placed. |
| index | The index to peek. |
在文件 ringbuffer.c 第 81 行定义.
| void ring_buffer_queue | ( | ring_buffer_t * | rb, |
| uint8_t | data | ||
| ) |
Adds a byte to a ring buffer.
| buffer | The buffer in which the data should be placed. |
| data | The byte to place. |
在文件 ringbuffer.c 第 25 行定义.
| void ring_buffer_queue_arr | ( | ring_buffer_t * | rb, |
| uint8_t * | data, | ||
| ring_buffer_size_t | size | ||
| ) |
Adds an array of bytes to a ring buffer.
| buffer | The buffer in which the data should be placed. |
| data | A pointer to the array of bytes to place in the queue. |
| size | The size of the array. |
在文件 ringbuffer.c 第 40 行定义.