FastLED 3.10.8
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#include "fl/stl/noexcept.h"
10
11namespace fl {
12namespace spi {
13
14// Forward declaration
15class MultiLaneDevice;
16
17// ============================================================================
18// Lane - Single lane in a multi-lane SPI device
19// ============================================================================
20
25class Lane {
26public:
31 void write(const u8* data, size_t size) FL_NO_EXCEPT;
32
38
41 size_t id() const FL_NO_EXCEPT { return mLaneId; }
42
45 size_t bufferSize() const FL_NO_EXCEPT { return mBuffer.size(); }
46
48 void clear() FL_NO_EXCEPT { mBuffer.clear(); }
49
50private:
51 friend class MultiLaneDevice;
52
56 Lane(size_t lane_id, MultiLaneDevice* parent) FL_NO_EXCEPT;
57
61
62 size_t mLaneId;
63 fl::vector<u8> mBuffer; // Buffered data for this lane
64};
65
66} // namespace spi
67} // namespace fl
size_t bufferSize() const FL_NO_EXCEPT
Get current buffer size.
Definition lane.h:45
void clear() FL_NO_EXCEPT
Clear the lane's buffer.
Definition lane.h:48
Lane(size_t lane_id, MultiLaneDevice *parent) FL_NO_EXCEPT
Construct lane (called by MultiLaneDevice)
Definition lane.cpp.hpp:9
size_t id() const FL_NO_EXCEPT
Get lane ID.
Definition lane.h:41
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
Multi-lane SPI device (1-8 independent LED strips)
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.