Control Surface pin-t-adl
MIDI Control Surface library for Arduino
VPotRingLEDs.hpp
Go to the documentation of this file.
1#pragma once
2
5
7
8namespace MCU {
9
10class VPotRingLEDsDriver : public AH::LEDs<11> {
11 public:
12 VPotRingLEDsDriver(const AH::LEDs<11> &leds) : AH::LEDs<11>(leds) {}
13
15 this->displayRange(v.getStartOn(), v.getStartOff());
16 }
17};
18
19// -------------------------------------------------------------------------- //
20
28 public:
31
43 VPotRingLEDs(const PinList<11> &leds, uint8_t track,
44 MIDIChannelCable channelCN = CHANNEL_1)
45 : Parent(track, channelCN), VPotRingLEDsDriver(leds) {}
46
47 protected:
48 void handleUpdate(typename Matcher::Result match) override {
49 bool newdirty = Parent::handleUpdateImpl(match);
50 if (newdirty)
52 this->dirty |= newdirty;
53 }
54
56 this->displayVPot(this->getState());
57 }
58
59 public:
60 void begin() override {
64 }
65
66 void reset() override {
69 }
70};
71
72namespace Bankable {
73
83template <uint8_t BankSize>
84class VPotRingLEDs : public VPotRing<BankSize>, public VPotRingLEDsDriver {
85 public:
87 using Matcher = typename Parent::Matcher;
88
103 VPotRingLEDs(BankConfig<BankSize> config, const PinList<11> &leds,
104 uint8_t track, MIDIChannelCable channelCN = CHANNEL_1)
105 : Parent(config, track, channelCN),
106 VPotRingLEDsDriver(leds) {}
107
108 protected:
109 void handleUpdate(typename Matcher::Result match) override {
110 bool newdirty = Parent::handleUpdateImpl(match);
111 if (newdirty)
113 this->dirty |= newdirty;
114 }
115
117 this->displayVPot(this->getState());
118 }
119
120 public:
121 void begin() override {
125 }
126
127 void reset() override {
130 }
131
132 protected:
133 void onBankSettingChange() override {
136 }
137};
138
139} // namespace Bankable
140
141} // namespace MCU
142
constexpr Channel CHANNEL_1
Definition: Channel.hpp:118
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for collections of LEDs that can display ranges.
Definition: LEDs.hpp:21
LEDs(const PinList< N > &ledPins)
Create a LEDs object.
Definition: LEDs.hpp:29
void begin() const
Initialize (set LED pins as outputs).
Definition: LEDs.hpp:34
void displayRange(uint16_t startOn, uint16_t startOff) const
Turn on a range of the LEDs.
Definition: LEDs.hpp:48
A MIDI input element that represents a Mackie Control Universal VPot ring and displays its value usin...
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
void begin() override
Initialize the input element.
void handleUpdate(typename Matcher::Result match) override
VPotRingLEDs(BankConfig< BankSize > config, const PinList< 11 > &leds, uint8_t track, MIDIChannelCable channelCN=CHANNEL_1)
Constructor.
typename Parent::Matcher Matcher
void reset() override
Reset the input element to its initial state.
A MIDI input element that represents a Mackie Control Universal VPot ring.
Definition: VPotRing.hpp:240
BankableVPotMatcher< BankSize > Matcher
Definition: VPotRing.hpp:242
void onBankSettingChange() override
A function to be executed each time the bank setting changes.
Definition: VPotRing.hpp:344
VPotState getState() const
Get the full state of the VPot ring. (For the active bank.)
Definition: VPotRing.hpp:308
bool handleUpdateImpl(typename Matcher::Result match)
Definition: VPotRing.hpp:263
void reset() override
Reset all states to zero.
Definition: VPotRing.hpp:336
VPotRingLEDsDriver(const AH::LEDs< 11 > &leds)
void displayVPot(VPotState v)
A MIDI input element that represents a Mackie Control Universal VPot ring and displays it using LEDs.
void begin() override
Initialize the input element.
VPotRingLEDs(const PinList< 11 > &leds, uint8_t track, MIDIChannelCable channelCN=CHANNEL_1)
Constructor.
void handleUpdate(typename Matcher::Result match) override
void reset() override
Reset the input element to its initial state.
A MIDI input element that represents a Mackie Control Universal VPot ring.
Definition: VPotRing.hpp:157
VPotMatcher Matcher
Definition: VPotRing.hpp:159
VPotState getState() const
Get the full state of the VPot ring.
Definition: VPotRing.hpp:189
bool handleUpdateImpl(typename Matcher::Result match)
Definition: VPotRing.hpp:176
VPotRing(uint8_t track, MIDIChannelCable channelCN=CHANNEL_1)
Constructor.
Definition: VPotRing.hpp:172
void reset() override
Reset the state to zero.
Definition: VPotRing.hpp:206
A class for saving a MIDI channel and cable number.
Definition: MIDIAddress.hpp:24
virtual void begin()
Initialize the input element.
PrintStream library
Definition: Array.hpp:14
A namespace for MIDI elements that can be added to a Bank, to change their address or channel.
MIDI Input matcher for Mackie Control Universal VPot LED rings.
Definition: VPotRing.hpp:108
Struct that keeps track of the value and overload indicator of a Mackie Control Universal VPot LED ri...
Definition: VPotRing.hpp:14
uint8_t getStartOff() const
Get the first segment that should be off.
Definition: VPotRing.hpp:61
uint8_t getStartOn() const
Get the first segment that should be on.
Definition: VPotRing.hpp:46