FastLED 3.9.15
Loading...
Searching...
No Matches
clamp.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <stdint.h>
5
6#include "fl/force_inline.h"
7
8namespace fl {
9
10template <typename T> FASTLED_FORCE_INLINE T clamp(T value, T min, T max) {
11 if (value < min) {
12 return min;
13 }
14 if (value > max) {
15 return max;
16 }
17 return value;
18}
19
20} // namespace fl
#define FASTLED_FORCE_INLINE
Definition force_inline.h:6
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16