1#if defined(ARDUINO) && defined(FASTLED_VERSION)
5#include <AH/STL/type_traits>
6#include <Settings/NamespaceSettings.hpp>
38 return CRGB {c.
r, c.
g, c.
b};
60template <MIDIMessageType Type, u
int8_t RangeLen,
class ColorMapper>
90 template <
class ColorMapper_ = ColorMapper>
92 typename std::enable_if<std::is_default_constructible<
93 ColorMapper_>::value>::type * =
nullptr)
98 template <
class ColorMapper_ = ColorMapper>
101 typename std::enable_if<std::is_default_constructible<
102 ColorMapper_>::value>::type * =
nullptr)
139 newColor = newColor.nscale8_video(
brightness);
149 for (uint8_t index = 0; index < RangeLen; ++index)
202template <u
int8_t RangeLen,
class ColorMapper = DefaultColorMapper>
220template <
class ColorMapper = DefaultColorMapper>
240template <u
int8_t RangeLen,
class ColorMapper = DefaultColorMapper>
259template <
class ColorMapper = DefaultColorMapper>
279template <u
int8_t RangeLen,
class ColorMapper = DefaultColorMapper>
297template <
class ColorMapper = DefaultColorMapper>
310 CRGB
operator()(uint8_t value, uint8_t bankIndex, uint8_t index)
const {
314 return CRGB {c.
r, c.
g, c.
b};
366 template <
class ColorMapper_ = ColorMapper>
369 typename std::enable_if<std::is_default_constructible<
370 ColorMapper_>::value>::type * =
nullptr)
373 template <
class ColorMapper_ = ColorMapper>
377 typename std::enable_if<std::is_default_constructible<
378 ColorMapper_>::value>::type * =
nullptr)
408 updateLED(match.bankIndex, match.index, match.value);
409 this->
dirty |= newdirty;
417 void updateLED(uint8_t bankIndex, uint8_t index, uint8_t value) {
419 CRGB newColor = CRGB(
colormapper(value, bankIndex, index));
421 newColor = newColor.nscale8_video(
brightness);
430 for (uint8_t index = 0; index < RangeLen; ++index)
473template <uint8_t BankSize, uint8_t RangeLen,
476 RangeLen, ColorMapper>;
479template <u
int8_t BankSize,
class ColorMapper = DefaultColorMapper>
483template <uint8_t BankSize, uint8_t RangeLen,
486 BankSize, RangeLen, ColorMapper>;
489template <u
int8_t BankSize,
class ColorMapper = DefaultColorMapper>
493template <uint8_t BankSize, uint8_t RangeLen,
496 BankSize, RangeLen, ColorMapper>;
499template <u
int8_t BankSize,
class ColorMapper = DefaultColorMapper>
MIDIMessageType
All possible MIDI status byte values (without channel).
@ KeyPressure
Key Pressure Channel Voice message (3B).
@ NoteOn
Note On Channel Voice message (3B).
@ ControlChange
Control Change Channel Voice message (3B).
Color velocityToNovationColor(uint8_t value)
The default mapping from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
Color velocityToNovationColor(uint8_t value)
The default mapping from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
uint8_t(*)(uint8_t) index_permuter_f
Function pointer type to permute indices.
#define BEGIN_CS_NAMESPACE
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
void setBrightness(uint8_t brightness)
Set the maximum brightness of the LEDs.
NoteCCKPRangeFastLED(BankConfig< BankSize > config, AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, const ColorMapper &colormapper)
void setLEDIndexPermuter(index_permuter_f permuter)
Change the mapping from the MIDI index to the LED index.
NoteCCKPRangeFastLED(BankConfig< BankSize > config, AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, const ColorMapper &colormapper, index_permuter_f index_permuter)
uint8_t getBrightness() const
Get the maximum brightness of the LEDs.
void updateLED(uint8_t bankIndex, uint8_t index, uint8_t value)
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
void begin() override
Initialize the input element.
NoteCCKPRangeFastLED(BankConfig< BankSize > config, AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, typename std::enable_if< std::is_default_constructible< ColorMapper_ >::value >::type *=nullptr)
NoteCCKPRangeFastLED(BankConfig< BankSize > config, CRGB *ledcolors, MIDIAddress address, typename std::enable_if< std::is_default_constructible< ColorMapper_ >::value >::type *=nullptr)
index_permuter_f ledIndexPermuter
static uint8_t identityPermuter(uint8_t i)
NoteCCKPRangeFastLED(BankConfig< BankSize > config, CRGB *ledcolors, MIDIAddress address, const ColorMapper &colormapper)
void handleUpdate(typename Matcher::Result match) override
typename Parent::Matcher Matcher
NoteCCKPRangeFastLED(BankConfig< BankSize > config, CRGB *ledcolors, MIDIAddress address, const ColorMapper &colormapper, index_permuter_f index_permuter)
void reset() override
Reset all values to zero.
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
BankableTwoByteRangeMIDIMatcher< BankSize > Matcher
uint8_t getValue(uint8_t index) const
Get the most recent MIDI value that was received for the active bank.
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
bool handleUpdateImpl(typename Matcher::Result match)
void reset() override
Reset all values to zero.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
void setBrightness(uint8_t brightness)
Set the maximum brightness of the LEDs.
void setLEDIndexPermuter(index_permuter_f permuter)
Change the mapping from the MIDI index to the LED index.
NoteCCKPRangeFastLED(CRGB *ledcolors, MIDIAddress address, const ColorMapper &colormapper, index_permuter_f index_permuter)
NoteCCKPRangeFastLED(AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, const ColorMapper &colormapper)
NoteCCKPRangeFastLED(AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, typename std::enable_if< std::is_default_constructible< ColorMapper_ >::value >::type *=nullptr)
uint8_t getBrightness() const
Get the maximum brightness of the LEDs.
bool getDirty() const
Check if the colors changed since the last time the dirty flag was cleared.
NoteCCKPRangeFastLED(CRGB *ledcolors, MIDIAddress address, const ColorMapper &colormapper)
void begin() override
Initialize the input element.
NoteCCKPRangeFastLED(CRGB *ledcolors, MIDIAddress address, typename std::enable_if< std::is_default_constructible< ColorMapper_ >::value >::type *=nullptr)
index_permuter_f ledIndexPermuter
NoteCCKPRangeFastLED(AH::Array< CRGB, RangeLen > &ledcolors, MIDIAddress address, const ColorMapper &colormapper, index_permuter_f index_permuter)
static uint8_t identityPermuter(uint8_t i)
void handleUpdate(typename Matcher::Result match) override
void reset() override
Reset the input element to its initial state.
void clearDirty()
Clear the dirty flag.
void updateLED(uint8_t index, uint8_t value)
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
The default mapping from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
CRGB operator()(uint8_t value, uint8_t bankIndex, uint8_t index) const
Map from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
A structure for RGB colors.
The default mapping from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
CRGB operator()(uint8_t value, uint8_t index) const
Map from a 7-bit MIDI value to an RGB color, using the Novation Launchpad mapping.
Matcher for MIDI messages with 2 data bytes, such as Note On/Off, Control Change, Key Pressure (but n...