FastLED 3.10.8
Loading...
Searching...
No Matches
clear.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/noexcept.h"
4
5#include "fl/gfx/leds.h"
6#include "fl/stl/stdint.h"
7
8
9namespace fl {
10
11template<typename T> class Grid;
12
13// Memory safe clear function for CRGB arrays.
14template <int N> inline void clear(CRGB (&arr)[N]) FL_NO_EXCEPT {
15 for (int i = 0; i < N; ++i) {
16 arr[i] = CRGB::Black;
17 }
18}
19
20inline void clear(Leds &leds) FL_NO_EXCEPT { leds.fill(CRGB::Black); }
21
22template<fl::size W, fl::size H>
24 leds.fill(CRGB::Black);
25}
26
27template<typename T>
28inline void clear(Grid<T> &grid) FL_NO_EXCEPT {
29 grid.clear();
30}
31
32// Default, when you don't know what do then call clear.
33template<typename Container>
34inline void clear(Container &container) FL_NO_EXCEPT {
35 container.clear();
36}
37
38
39
40} // namespace fl
CRGB leds[1]
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
void clear(CRGB(&arr)[N]) FL_NO_EXCEPT
Definition clear.h:14
Base definition for an LED controller.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:517
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38