1 |
|
|
/** |
2 |
|
|
* @file PatternLineN.hpp |
3 |
|
|
* @brief Header file for blink1_lib::PatternLineN |
4 |
|
|
*/ |
5 |
|
|
|
6 |
|
|
#pragma once |
7 |
|
|
|
8 |
|
|
#include <cstdint> |
9 |
|
|
|
10 |
|
|
#include "RGBN.hpp" |
11 |
|
|
|
12 |
|
|
namespace blink1_lib { |
13 |
|
|
|
14 |
|
|
/** |
15 |
|
|
* Same as a PatternLine, but uses RGBN to also store an LED ID |
16 |
|
|
*/ |
17 |
|
|
struct PatternLineN { |
18 |
|
|
/** |
19 |
|
|
* Fade time in milliseconds |
20 |
|
|
*/ |
21 |
|
|
std::uint16_t fadeMillis{0}; |
22 |
|
|
|
23 |
|
|
/** |
24 |
|
|
* RGBN value |
25 |
|
|
*/ |
26 |
|
|
RGBN rgbn; |
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Default constructor |
30 |
|
|
* |
31 |
|
|
* Initializes all values to 0 |
32 |
|
|
*/ |
33 |
|
4 |
PatternLineN() noexcept = default; |
34 |
|
|
|
35 |
|
|
/** |
36 |
|
|
* @param _rgbn RGBN value |
37 |
|
|
* @param _fadeMillis Fade time in milliseconds |
38 |
|
|
*/ |
39 |
|
|
PatternLineN(const RGBN& _rgbn, const std::uint16_t _fadeMillis) noexcept; |
40 |
|
|
|
41 |
|
|
/** |
42 |
|
|
* @param _r Red value |
43 |
|
|
* @param _g Green value |
44 |
|
|
* @param _b Blue value |
45 |
|
|
* @param _n LED index |
46 |
|
|
* @param _fadeMillis Fade time in milliseconds |
47 |
|
|
*/ |
48 |
|
|
PatternLineN(const std::uint8_t _r, const std::uint8_t _g, const std::uint8_t _b, const std::uint8_t _n, const std::uint16_t _fadeMillis) noexcept; |
49 |
|
|
|
50 |
|
|
/** |
51 |
|
|
* Equality operator |
52 |
|
|
* |
53 |
|
|
* @param other Object to compare to |
54 |
|
|
* @return true if the objects are equal, false otherwise |
55 |
|
|
*/ |
56 |
|
|
[[nodiscard]] bool operator==(const PatternLineN& other) const noexcept; |
57 |
|
|
|
58 |
|
|
/** |
59 |
|
|
* Inequality operator |
60 |
|
|
* |
61 |
|
|
* @param other Object to compare to |
62 |
|
|
* @return true if the objects are not equal, false otherwise |
63 |
|
|
*/ |
64 |
|
|
[[nodiscard]] bool operator!=(const PatternLineN& other) const noexcept; |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
* Output operator |
68 |
|
|
* |
69 |
|
|
* @param os Output stream |
70 |
|
|
* @param patternLine PatternLineN to output |
71 |
|
|
*/ |
72 |
|
|
friend std::ostream& operator<<(std::ostream& os, const PatternLineN& patternLine); |
73 |
|
|
}; |
74 |
|
|
} |