21 if (!
available(bytesToRead) || dst ==
nullptr) {
22 FASTLED_WARN(
"ByteStreamMemory::read: !available(bytesToRead): "
29 fl::size bytesRead = 0;
31 while (bytesRead < actualBytesToRead) {
32 fl::u8 &b = dst[bytesRead];
45 if (src ==
nullptr ||
mReadBuffer.capacity() == 0) {
47 "ByteStreamMemory::write: src == nullptr");
49 "ByteStreamMemory::write: mReadBuffer.capacity() == 0");
54 for (fl::size i = 0; i < n; ++i) {
56 FASTLED_WARN(
"ByteStreamMemory::write: mReadBuffer.full(): "
67 fl::size bytes_written =
write(
reinterpret_cast<const fl::u8 *
>(src), n * 3);
68 fl::size pixels_written = bytes_written / 3;
69 return pixels_written;
ByteStreamMemory(fl::u32 size_buffer)
~ByteStreamMemory() override
fl::size write(const fl::u8 *src, fl::size n)
CircularBuffer< fl::u8 > mReadBuffer
bool available(fl::size n) const override
fl::size writeCRGB(const CRGB *src, fl::size n)
fl::size read(fl::u8 *dst, fl::size bytesToRead) override
Implements the FastLED namespace macros.
Representation of an RGB pixel (Red, Green, Blue)