Skip to content

Commit d4aa227

Browse files
committed
rename RgbStacked -> RgbPallete
1 parent 105ae1e commit d4aa227

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

src/modm/driver/pwm/apa102.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Apa102
4343
}
4444

4545
bool
46-
setColorBrightness(size_t index, const color::RgbStacked<8,8,8> &color, uint8_t brightness)
46+
setColorBrightness(size_t index, const color::RgbPallete<8,8,8> &color, uint8_t brightness)
4747
{
4848
if (index >= LEDs) return false;
4949
uint32_t value = color.value() << 8 | (brightness | 0xe0);
@@ -52,7 +52,7 @@ class Apa102
5252
}
5353

5454
bool
55-
setColor(size_t index, const color::RgbStacked<8,8,8> &color)
55+
setColor(size_t index, const color::RgbPallete<8,8,8> &color)
5656
{
5757
if (index >= LEDs) return false;
5858
// read the brightness value and clear all colors

src/modm/ui/color.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#include "color/hsv.hpp"
1616

1717
#include "color/rgb_html.hpp"
18-
#include "color/rgb_stacked.hpp"
18+
#include "color/rgb_pallete.hpp"

src/modm/ui/color/concepts.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Rgb;
3636

3737
template<int DR, int DG, int DB>
3838
requires (DR > 0) && (DG > 0) && (DB > 0)
39-
class RgbStacked;
39+
class RgbPallete;
4040

4141
template <int DH, int DS, int DV>
4242
requires (DH > 0) && (DS > 0) && (DV > 0)
@@ -62,7 +62,7 @@ template<class C>
6262
concept ColorRgb = is_instance<C, Rgb>::value;
6363

6464
template<class C>
65-
concept ColorRgbStacked = is_instance<C, RgbStacked>::value;
65+
concept ColorRgbPallete = is_instance<C, RgbPallete>::value;
6666

6767
template<class C>
6868
concept ColorHsv = is_instance<C, Hsv>::value;
@@ -71,7 +71,7 @@ concept ColorHsv = is_instance<C, Hsv>::value;
7171
* @brief Concept to ident any colortype instance
7272
*/
7373
template<class C>
74-
concept Color = ColorGray<C> || ColorRgb<C> || ColorHsv<C> || ColorRgbStacked<C>; // conjunction
74+
concept Color = ColorGray<C> || ColorRgb<C> || ColorHsv<C> || ColorRgbPallete<C>; // conjunction
7575
// concept Color = std::convertible_to<C, Rgb<8,8,8> >; // more tolerant alternative: convertability
7676

7777
}

src/modm/ui/color/gray.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Gray : public modm::ProportionalUnsigned<D>
5959
) >> 13)
6060
{}
6161

62-
template<ColorRgbStacked C>
62+
template<ColorRgbPallete C>
6363
constexpr Gray(const C& rgbstacked)
6464
: Gray(Rgb<C::RedType::digits, C::GreenType::digits, C::BlueType::digits>(rgbstacked))
6565
{}

src/modm/ui/color/hsv.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Hsv
9797
saturation_ = max ? diff / max * maxValue : 0;
9898
}
9999

100-
template<ColorRgbStacked C>
100+
template<ColorRgbPallete C>
101101
constexpr Hsv(const C& rgbstacked)
102102
: Hsv(Rgb<C::RedType::digits, C::GreenType::digits, C::BlueType::digits>(rgbstacked))
103103
{}

src/modm/ui/color/rgb.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Rgb
5454
{}
5555

5656
template<class C>
57-
requires ColorRgb<C> || ColorRgbStacked<C>
57+
requires ColorRgb<C> || ColorRgbPallete<C>
5858
constexpr Rgb(const C& other)
5959
: red_(other.red()), green_(other.green()), blue_(other.blue())
6060
{}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace modm::color {
1919
* Requires less space than unstacked rgb types. Calculations without dedicated graphics
2020
* acceleration hardware are very inefficient.
2121
* If theres no dedicated graphics acceleration but lots of RAM, using modm::Rgb<> for
22-
* calculations and afterwards conversion to modm::RgbStacked<> may be an option.
22+
* calculations and afterwards conversion to modm::RgbPallete<> may be an option.
2323
*
2424
* @tparam DR Digits for red channel
2525
* @tparam DG Digits for green channel
@@ -30,7 +30,7 @@ namespace modm::color {
3030
*/
3131
template <int DR, int DG, int DB>
3232
requires (DR > 0) && (DG > 0) && (DB > 0)
33-
class RgbStacked
33+
class RgbPallete
3434
{
3535
public:
3636
using RedType = Gray<DR>;
@@ -39,38 +39,38 @@ class RgbStacked
3939

4040
using T = uint_t<DR + DG + DB>::least;
4141

42-
constexpr RgbStacked() = default;
42+
constexpr RgbPallete() = default;
4343

44-
constexpr RgbStacked(T value)
44+
constexpr RgbPallete(T value)
4545
: value_(value)
4646
{}
4747

48-
constexpr RgbStacked(RedType red, GreenType green, BlueType blue)
48+
constexpr RgbPallete(RedType red, GreenType green, BlueType blue)
4949
: value_(red.value() << (DG + DB) | green.value() << DB | blue.value())
5050
{}
5151

52-
constexpr RgbStacked(const RgbStacked &rgbstacked)
52+
constexpr RgbPallete(const RgbPallete &rgbstacked)
5353
: value_(rgbstacked.value_)
5454
{}
5555

5656
template<ColorGray C>
57-
constexpr RgbStacked(const C &gray)
58-
: RgbStacked(Rgb<C::digits>(gray))
57+
constexpr RgbPallete(const C &gray)
58+
: RgbPallete(Rgb<C::digits>(gray))
5959
{}
6060

6161
template<ColorRgb C>
62-
constexpr RgbStacked(const C &rgb)
63-
: RgbStacked(rgb.red(), rgb.green(), rgb.blue())
62+
constexpr RgbPallete(const C &rgb)
63+
: RgbPallete(rgb.red(), rgb.green(), rgb.blue())
6464
{}
6565

66-
template<ColorRgbStacked C>
67-
constexpr RgbStacked(const C &rgstacked)
68-
: RgbStacked(rgstacked.red(), rgstacked.green(), rgstacked.blue())
66+
template<ColorRgbPallete C>
67+
constexpr RgbPallete(const C &rgstacked)
68+
: RgbPallete(rgstacked.red(), rgstacked.green(), rgstacked.blue())
6969
{}
7070

7171
template<ColorHsv C>
72-
constexpr RgbStacked(const C &hsv)
73-
: RgbStacked(Rgb<5,6,5>(hsv))
72+
constexpr RgbPallete(const C &hsv)
73+
: RgbPallete(Rgb<5,6,5>(hsv))
7474
{}
7575

7676
/**
@@ -105,11 +105,11 @@ class RgbStacked
105105
auto blue() { return channel_accessor<T, BlueType, 0>{value_}; }
106106

107107
// assignment
108-
void operator=(const RgbStacked other) {
108+
void operator=(const RgbPallete other) {
109109
value_ = other.value_;
110110
}
111111

112-
RgbStacked& operator+=(const Rgb<DR, DG, DB>& rgb) {
112+
RgbPallete& operator+=(const Rgb<DR, DG, DB>& rgb) {
113113
operator=({
114114
red().value() + rgb.red(),
115115
green().value() + rgb.green(),
@@ -118,7 +118,7 @@ class RgbStacked
118118
return *this;
119119
}
120120

121-
RgbStacked& operator-=(const Rgb<DR, DG, DB>& rgb) {
121+
RgbPallete& operator-=(const Rgb<DR, DG, DB>& rgb) {
122122
operator=({
123123
red().value() - rgb.red(),
124124
green().value() - rgb.green(),
@@ -127,7 +127,7 @@ class RgbStacked
127127
return *this;
128128
}
129129

130-
RgbStacked& operator*=(const Rgb<DR, DG, DB>& rgb) {
130+
RgbPallete& operator*=(const Rgb<DR, DG, DB>& rgb) {
131131
operator=({
132132
red().value() * rgb.red(),
133133
green().value() * rgb.green(),
@@ -136,7 +136,7 @@ class RgbStacked
136136
return *this;
137137
}
138138

139-
RgbStacked& operator/=(const Rgb<DR, DG, DB>& rgb) {
139+
RgbPallete& operator/=(const Rgb<DR, DG, DB>& rgb) {
140140
operator=({
141141
red().value() * rgb.red(),
142142
green().value() * rgb.green(),
@@ -145,31 +145,31 @@ class RgbStacked
145145
return *this;
146146
}
147147

148-
RgbStacked operator+(const Rgb<DR, DG, DB>& rgb) {
148+
RgbPallete operator+(const Rgb<DR, DG, DB>& rgb) {
149149
return {
150150
red().value() + rgb.red(),
151151
green().value() + rgb.green(),
152152
blue().value() + rgb.blue()
153153
};
154154
}
155155

156-
RgbStacked operator-(const Rgb<DR, DG, DB>& rgb) {
156+
RgbPallete operator-(const Rgb<DR, DG, DB>& rgb) {
157157
return {
158158
red().value() - rgb.red(),
159159
green().value() - rgb.green(),
160160
blue().value() - rgb.blue()
161161
};
162162
}
163163

164-
RgbStacked operator*(const Rgb<DR, DG, DB>& rgb) {
164+
RgbPallete operator*(const Rgb<DR, DG, DB>& rgb) {
165165
return {
166166
red().value() * rgb.red(),
167167
green().value() * rgb.green(),
168168
blue().value() * rgb.blue()
169169
};
170170
}
171171

172-
RgbStacked operator/(const Rgb<DR, DG, DB>& rgb) {
172+
RgbPallete operator/(const Rgb<DR, DG, DB>& rgb) {
173173
return {
174174
red().value() / rgb.red(),
175175
green().value() / rgb.green(),
@@ -179,7 +179,7 @@ class RgbStacked
179179

180180
// Equality
181181
constexpr bool
182-
operator==(const RgbStacked& other) const = default;
182+
operator==(const RgbPallete& other) const = default;
183183

184184
// Remaining comparison operators are server by color::Rgb<D> and implicit type conversion
185185

@@ -191,13 +191,13 @@ class RgbStacked
191191
T value_{0};
192192
};
193193

194-
using Rgb565 = RgbStacked<5,6,5>;
195-
using Rgb666 = RgbStacked<6,6,6>;
194+
using Rgb565 = RgbPallete<5,6,5>;
195+
using Rgb666 = RgbPallete<6,6,6>;
196196

197197
#if __has_include(<modm/io/iostream.hpp>)
198198
#include <modm/io/iostream.hpp>
199199

200-
template<ColorRgbStacked C>
200+
template<ColorRgbPallete C>
201201
IOStream&
202202
operator<<(IOStream& os, const C& rgb)
203203
{

0 commit comments

Comments
 (0)