FastLED 3.9.15
Loading...
Searching...
No Matches
leds.cpp
Go to the documentation of this file.
1
2
3#include "fl/leds.h"
4#include "crgb.h"
5#include "fl/assert.h"
6#include "fl/xymap.h"
7
8namespace fl {
9
11
13 if (!mXyMap.has(x, y)) {
14 return empty();
15 }
16 return mLeds[mXyMap(x, y)];
17}
18
20 static CRGB empty_led;
21 return empty_led;
22}
23
24const CRGB &Leds::operator()(int x, int y) const {
25 if (!mXyMap.has(x, y)) {
26 return empty();
27 }
28 return mLeds[mXyMap(x, y)];
29}
30
32 FASTLED_ASSERT(mXyMap.isSerpentine() || mXyMap.isLineByLine(),
33 "XYMap is not serpentine or line by line");
34 return &mLeds[mXyMap(0, y)];
35}
36const CRGB *Leds::operator[](int y) const {
37 FASTLED_ASSERT(mXyMap.isSerpentine() || mXyMap.isLineByLine(),
38 "XYMap is not serpentine or line by line");
39 return &mLeds[mXyMap(0, y)];
40}
41
43 : Leds(leds, XYMap::constructRectangularGrid(width, height)) {}
44
45
46
47} // namespace fl
CRGB leds[NUM_LEDS]
int y
Definition simple.h:93
int x
Definition simple.h:92
const XYMap & xymap() const
Definition leds.h:39
fl::size width() const
Definition leds.h:28
CRGB & operator()(int x, int y)
Definition leds.cpp:12
Leds(CRGB *leds, u16 width, u16 height)
Definition leds.cpp:42
XYMap mXyMap
Definition leds.h:54
static CRGB & empty()
Definition leds.cpp:19
fl::size height() const
Definition leds.h:29
CRGB * operator[](int x)
Definition leds.cpp:31
CRGB * mLeds
Definition leds.h:55
Defines the red, green, and blue (RGB) pixel struct.
IMPORTANT!
Definition crgb.h:20
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86