FastLED 3.10.8
Loading...
Searching...
No Matches
lane.cpp.hpp
Go to the documentation of this file.
2#include "fl/log/log.h"
3#include "fl/log/log.h"
4#include "fl/stl/noexcept.h"
5
6namespace fl {
7namespace spi {
8
9Lane::Lane(size_t lane_id, MultiLaneDevice* parent)
10 FL_NO_EXCEPT : mLaneId(lane_id) {
11 (void)parent; // Unused parameter (reserved for future use)
12}
13
14void Lane::write(const u8* data, size_t size) FL_NO_EXCEPT {
15 if (!data || size == 0) {
16 FL_WARN("Lane " << mLaneId << ": Invalid data or size");
17 return;
18 }
19
20 // Resize buffer to fit new data
21 mBuffer.resize(size);
22
23 // Copy data into buffer
24 for (size_t i = 0; i < size; i++) {
25 mBuffer[i] = data[i];
26 }
27
28 FL_DBG("Lane " << mLaneId << ": Buffered " << size << " bytes");
29}
30
32 // Resize buffer to requested size
33 mBuffer.resize(size);
34
35 // Return span to buffer
36 return mBuffer;
37}
38
42
43} // namespace spi
44} // namespace fl
Lane(size_t lane_id, MultiLaneDevice *parent) FL_NO_EXCEPT
Construct lane (called by MultiLaneDevice)
Definition lane.cpp.hpp:9
friend class MultiLaneDevice
Definition lane.h:51
fl::span< u8 > getBuffer(size_t size) FL_NO_EXCEPT
Get direct buffer access for zero-copy writes.
Definition lane.cpp.hpp:31
fl::span< const u8 > data() const FL_NO_EXCEPT
Get const access to buffer data.
Definition lane.cpp.hpp:39
size_t mLaneId
Definition lane.h:62
fl::vector< u8 > mBuffer
Definition lane.h:63
void write(const u8 *data, size_t size) FL_NO_EXCEPT
Write data to this lane's buffer.
Definition lane.cpp.hpp:14
Lane class for multi-lane SPI devices.
#define FL_WARN(...)
Definition log.h:437
#define FL_DBG
Definition log.h:553
Centralized logging categories for FastLED hardware interfaces and subsystems.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179