mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 12:40:42 +00:00
btstack_ring_buffer: add btstack_ring_buffer_reset to reset it to initial state/empty
This commit is contained in:
parent
5797104aef
commit
40adb62dab
@ -12,6 +12,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
### Added
|
||||
### Changed
|
||||
|
||||
## Changes September 2020
|
||||
|
||||
### Fixed
|
||||
|
||||
### Added
|
||||
- `btstack_ring_buffer`: add `btstack_ring_buffer_reset` to reset it to initial state/empty
|
||||
|
||||
### Changed
|
||||
|
||||
## Changes August 2020
|
||||
|
||||
### Fixed
|
||||
|
@ -54,8 +54,12 @@
|
||||
void btstack_ring_buffer_init(btstack_ring_buffer_t * ring_buffer, uint8_t * storage, uint32_t storage_size){
|
||||
ring_buffer->storage = storage;
|
||||
ring_buffer->size = storage_size;
|
||||
btstack_ring_buffer_reset(ring_buffer);
|
||||
}
|
||||
|
||||
void btstack_ring_buffer_reset(btstack_ring_buffer_t * ring_buffer){
|
||||
ring_buffer->last_read_index = 0;
|
||||
ring_buffer->last_written_index = 0;
|
||||
ring_buffer->last_written_index = 0;
|
||||
ring_buffer->full = 0;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,12 @@ typedef struct btstack_ring_buffer {
|
||||
*/
|
||||
void btstack_ring_buffer_init(btstack_ring_buffer_t * ring_buffer, uint8_t * storage, uint32_t storage_size);
|
||||
|
||||
/**
|
||||
* Reset ring buffer to initial state (empty)
|
||||
* @param ring_buffer object
|
||||
*/
|
||||
void btstack_ring_buffer_reset(btstack_ring_buffer_t * ring_buffer);
|
||||
|
||||
/**
|
||||
* Check if ring buffer is empty
|
||||
* @param ring_buffer object
|
||||
|
Loading…
x
Reference in New Issue
Block a user