Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
NoteCCKPLEDPWM.hpp
Go to the documentation of this file.
1#pragma once
2
6
8
9// -------------------------------------------------------------------------- //
10
20template <MIDIMessageType Type>
22 : public MatchingMIDIInputElement<Type, TwoByteMIDIMatcher> {
23 public:
26
33
34 private:
35 void handleUpdate(typename Matcher::Result match) override {
38 }
39
40 public:
46
48 void reset() override { AH::ExtIO::digitalWrite(ledPin, LOW); }
49
50 private:
52};
53
58
63
68
69// -------------------------------------------------------------------------- //
70
71namespace Bankable {
72
84template <MIDIMessageType Type, uint8_t BankSize>
85class NoteCCKPLEDPWM : public NoteCCKPValue<Type, BankSize> {
86 public:
88 using Matcher = typename Parent::Matcher;
89
99 MIDIAddress address)
100 : Parent(config, address), ledPin(ledPin) {}
101
102 protected:
103 void handleUpdate(typename Matcher::Result match) override {
104 bool newdirty = Parent::handleUpdateImpl(match);
105 if (newdirty)
106 display();
107 this->dirty |= newdirty;
108 }
109
114
115 public:
121
123 void reset() override {
126 }
127
128 using Parent::getValue;
129
130 protected:
131 void onBankSettingChange() override {
133 display();
134 }
135
136 private:
138};
139
144template <uint8_t BankSize>
146
151template <uint8_t BankSize>
153
158template <uint8_t BankSize>
160
161} // namespace Bankable
162
constexpr PinStatus_t LOW
constexpr PinMode_t OUTPUT
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
NoteCCKPValue< Type, BankSize > Parent
NoteCCKPLEDPWM(BankConfig< BankSize > config, pin_t ledPin, MIDIAddress address)
Constructor.
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
void begin() override
Set the pinmode of the LED to OUTPUT.
uint8_t getValue() const override
Get the most recent MIDI value that was received for the active bank.
void handleUpdate(typename Matcher::Result match) override
typename Parent::Matcher Matcher
void reset() override
Reset all values to zero and turn off the LED.
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
bool handleUpdateImpl(typename Matcher::Result match)
BankableTwoByteMIDIMatcher< BankSize > Matcher
NoteCCKPValue(BankConfig< BankSize > config, MIDIAddress address)
uint8_t getValue() const override
Get the most recent MIDI value that was received for the active bank.
void reset() override
Reset all values to zero.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
MatchingMIDIInputElement(const TwoByteMIDIMatcher &matcher)
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
MatchingMIDIInputElement< Type, Matcher > Parent
void begin() override
Set the pinmode of the LED to OUTPUT.
TwoByteMIDIMatcher Matcher
NoteCCKPLEDPWM(pin_t ledPin, MIDIAddress address)
void handleUpdate(typename Matcher::Result match) override
void reset() override
Turn off the LED.
void analogWrite(pin_t pin, analog_t val)
An ExtIO version of the Arduino function.
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.
T_out increaseBitDepth(T_in in)
Increase the bit depth of the given value from Bits_in bits wide to Bits_out bits wide,...
NoteCCKPLEDPWM< MIDIMessageType::NoteOn, BankSize > NoteLEDPWM
Class that listens for MIDI Note events on a single address and turns on an LED with a brightness/dut...
NoteCCKPLEDPWM< MIDIMessageType::ControlChange, BankSize > CCLEDPWM
Class that listens for MIDI Control Change events on a single address and turns on an LED with a brig...
NoteCCKPLEDPWM< MIDIMessageType::KeyPressure, BankSize > KPLEDPWM
Class that listens for MIDI Key Pressure events on a single address and turns on an LED with a bright...
NoteCCKPLEDPWM< MIDIMessageType::ControlChange > CCLEDPWM
Class that listens for MIDI Control Change events on a single address and turns on an LED with a brig...
NoteCCKPLEDPWM< MIDIMessageType::NoteOn > NoteLEDPWM
Class that listens for MIDI Note events on a single address and turns on an LED with a brightness/dut...
NoteCCKPLEDPWM< MIDIMessageType::KeyPressure > KPLEDPWM
Class that listens for MIDI Key Pressure events on a single address and turns on an LED with a bright...
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
Type for storing pin numbers of Extended Input/Output elements.
Matcher for MIDI messages with 2 data bytes, such as Note On/Off, Control Change, Key Pressure (but n...