Files
klubhaus-doorbell/libraries/FastLED/src/fl/clear.h
2026-02-12 00:45:31 -08:00

40 lines
697 B
C++

#pragma once
#include "fl/leds.h"
#include "fl/stdint.h"
namespace fl {
template<typename T>
class Grid;
// Memory safe clear function for CRGB arrays.
template <int N> inline void clear(CRGB (&arr)[N]) {
for (int i = 0; i < N; ++i) {
arr[i] = CRGB::Black;
}
}
inline void clear(Leds &leds) { leds.fill(CRGB::Black); }
template<fl::size W, fl::size H>
inline void clear(LedsXY<W, H> &leds) {
leds.fill(CRGB::Black);
}
template<typename T>
inline void clear(Grid<T> &grid) {
grid.clear();
}
// Default, when you don't know what do then call clear.
template<typename Container>
inline void clear(Container &container) {
container.clear();
}
} // namespace fl