FastLED 3.9.15
Loading...
Searching...
No Matches
lane.h
Go to the documentation of this file.
1#pragma once
2
5
6#include "fl/stl/stdint.h"
7#include "fl/stl/span.h"
8#include "fl/stl/vector.h"
9
10namespace fl {
11namespace spi {
12
13// Forward declaration
14class MultiLaneDevice;
15
16// ============================================================================
17// Lane - Single lane in a multi-lane SPI device
18// ============================================================================
19
24class Lane {
25public:
30 void write(const u8* data, size_t size);
31
36 fl::span<u8> getBuffer(size_t size);
37
40 size_t id() const { return mLaneId; }
41
44 size_t bufferSize() const { return mBuffer.size(); }
45
47 void clear() { mBuffer.clear(); }
48
49private:
50 friend class MultiLaneDevice;
51
55 Lane(size_t lane_id, MultiLaneDevice* parent);
56
60
61 size_t mLaneId;
62 fl::vector<u8> mBuffer; // Buffered data for this lane
63};
64
65} // namespace spi
66} // namespace fl
Lane(size_t lane_id, MultiLaneDevice *parent)
Construct lane (called by MultiLaneDevice)
Definition lane.cpp.hpp:8
size_t bufferSize() const
Get current buffer size.
Definition lane.h:44
void clear()
Clear the lane's buffer.
Definition lane.h:47
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
size_t id() const
Get lane ID.
Definition lane.h:40
Multi-lane SPI device (1-8 independent LED strips)
unsigned char u8
Definition stdint.h:131
Base definition for an LED controller.
Definition crgb.hpp:179