mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 12:06:26 +01:00
[core] Ring buffer write functions use const pointer parameter (#7750)
This commit is contained in:
parent
e6a1254e65
commit
b367c01b4b
@ -46,7 +46,7 @@ size_t RingBuffer::read(void *data, size_t len, TickType_t ticks_to_wait) {
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
size_t RingBuffer::write(void *data, size_t len) {
|
||||
size_t RingBuffer::write(const void *data, size_t len) {
|
||||
size_t free = this->free();
|
||||
if (free < len) {
|
||||
size_t needed = len - free;
|
||||
@ -56,7 +56,7 @@ size_t RingBuffer::write(void *data, size_t len) {
|
||||
return xStreamBufferSend(this->handle_, data, len, 0);
|
||||
}
|
||||
|
||||
size_t RingBuffer::write_without_replacement(void *data, size_t len, TickType_t ticks_to_wait) {
|
||||
size_t RingBuffer::write_without_replacement(const void *data, size_t len, TickType_t ticks_to_wait) {
|
||||
return xStreamBufferSend(this->handle_, data, len, ticks_to_wait);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class RingBuffer {
|
||||
* @param len Number of bytes to write
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
size_t write(void *data, size_t len);
|
||||
size_t write(const void *data, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Writes to the ring buffer without overwriting oldest data.
|
||||
@ -50,7 +50,7 @@ class RingBuffer {
|
||||
* @param ticks_to_wait Maximum number of FreeRTOS ticks to wait (default: 0)
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
size_t write_without_replacement(void *data, size_t len, TickType_t ticks_to_wait = 0);
|
||||
size_t write_without_replacement(const void *data, size_t len, TickType_t ticks_to_wait = 0);
|
||||
|
||||
/**
|
||||
* @brief Returns the number of available bytes in the ring buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user