Line data Source code
1 : /* ✔ */ 2 : 3 : #pragma once 4 : 5 : #include <Banks/BankAddresses.hpp> 6 : #include <MIDI_Outputs/Bankable/Abstract/MIDIButtonLatched.hpp> 7 : #include <MIDI_Senders/DigitalCCSender.hpp> 8 : 9 : BEGIN_CS_NAMESPACE 10 : 11 : namespace Bankable { 12 : 13 : /** 14 : * @brief A class of MIDIOutputElement%s that read the input of a **momentary 15 : * push button**, and send out MIDI **Controller Change** events. 16 : * 17 : * It latches the input, so press once to enable, press again to 18 : * disable (toggle). 19 : * 20 : * The switch is debounced in software. 21 : * This version can be banked. 22 : * 23 : * @tparam NumBanks 24 : * The number of banks. 25 : * 26 : * @ingroup BankableMIDIOutputElements 27 : */ 28 : template <uint8_t NumBanks> 29 : class CCButtonLatched 30 : : public MIDIButtonLatched<NumBanks, SingleAddress, DigitalCCSender> { 31 : public: 32 : /** 33 : * @brief Create a new bankable CCButtonLatched object on the given pin 34 : * and with address. 35 : * 36 : * @param config 37 : * The bank configuration to use: the bank to add this element to, 38 : * and whether to change the address, channel or cable number. 39 : * @param pin 40 : * The digital input pin to read from. 41 : * The internal pull-up resistor will be enabled. 42 : * @param address 43 : * The MIDI address containing the controller number [0, 119], 44 : * channel [Channel_1, Channel_16], and optional cable number 45 : * [Cable_1, Cable_16]. 46 : * @param sender 47 : * The MIDI sender to use. 48 : */ 49 1 : CCButtonLatched(BankConfig<NumBanks> config, pin_t pin, MIDIAddress address, 50 : const DigitalCCSender &sender = {}) 51 : : MIDIButtonLatched<NumBanks, SingleAddress, DigitalCCSender>( 52 1 : {config, address}, pin, sender) {} 53 : }; 54 : 55 : } // namespace Bankable 56 : 57 : END_CS_NAMESPACE