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