FastLED 3.10.8
Loading...
Searching...
No Matches
leds.cpp.hpp
Go to the documentation of this file.
1
2
3#include "fl/gfx/leds.h"
4#include "crgb.h"
5#include "fl/stl/assert.h"
6#include "fl/math/xymap.h"
7#include "fl/stl/noexcept.h"
8
9namespace fl {
10
12
14 if (!mXyMap.has(x, y)) {
15 return empty();
16 }
17 return mLeds[mXyMap(x, y)];
18}
19
21 static CRGB empty_led;
22 return empty_led;
23}
24
25const CRGB &Leds::operator()(int x, int y) const FL_NO_EXCEPT {
26 if (!mXyMap.has(x, y)) {
27 return empty();
28 }
29 return mLeds[mXyMap(x, y)];
30}
31
33 FASTLED_ASSERT(mXyMap.isSerpentine() || mXyMap.isLineByLine(),
34 "XYMap is not serpentine or line by line");
35 return &mLeds[mXyMap(0, y)];
36}
38 FASTLED_ASSERT(mXyMap.isSerpentine() || mXyMap.isLineByLine(),
39 "XYMap is not serpentine or line by line");
40 return &mLeds[mXyMap(0, y)];
41}
42
45
46
47
48} // namespace fl
CRGB leds[1]
fl::size width() const FL_NO_EXCEPT
Definition leds.h:30
fl::span< CRGB > mLeds
Definition leds.h:57
fl::size height() const FL_NO_EXCEPT
Definition leds.h:31
Leds(CRGB *leds, u16 width, u16 height) FL_NO_EXCEPT
Definition leds.cpp.hpp:43
CRGB * operator[](int x) FL_NO_EXCEPT
Definition leds.cpp.hpp:32
XYMap mXyMap
Definition leds.h:56
const XYMap & xymap() const FL_NO_EXCEPT
Definition leds.h:41
CRGB & operator()(int x, int y) FL_NO_EXCEPT
Definition leds.cpp.hpp:13
static CRGB & empty() FL_NO_EXCEPT
Definition leds.cpp.hpp:20
static XYMap constructRectangularGrid(u16 width, u16 height, u16 offset=0) FL_NO_EXCEPT
Definition xymap.cpp.hpp:36
Defines the 8-bit red, green, and blue (RGB) pixel type in the fl namespace.
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38