Line data Source code
1 : #pragma once 2 : 3 : #include <Banks/BankAddresses.hpp> 4 : #include <MIDI_Outputs/Bankable/Abstract/MIDIButtonLatching.hpp> 5 : #include <MIDI_Senders/DigitalCCSender.hpp> 6 : 7 : BEGIN_CS_NAMESPACE 8 : 9 : namespace Bankable { 10 : 11 : /** 12 : * @brief A class of MIDIOutputElement%s that read the input of a **latching 13 : * push button or toggle switch**, and send out MIDI **Control Change** 14 : * events. 15 : * 16 : * When the switch changes state, two MIDI events are sent: the first 17 : * one with a value of 0x7F, followed immediately by a second one with 18 : * a value of 0x00. 19 : * The switch is debounced in software. 20 : * This version can be banked. 21 : * 22 : * @ingroup BankableMIDIOutputElements 23 : */ 24 1 : class CCButtonLatching 25 : : public MIDIButtonLatching<SingleAddress, DigitalCCSender> { 26 : public: 27 : /** 28 : * @brief Create a new Bankable CCButtonLatching object with the given 29 : * pin, the given controller number and channel. 30 : * 31 : * @param config 32 : * The bank configuration to use: the bank to add this element to, 33 : * and whether to change the address, channel or cable number. 34 : * @param pin 35 : * The digital input pin with the button connected. 36 : * The internal pull-up resistor will be enabled. 37 : * @param address 38 : * The MIDI address containing the controller number [0, 119], 39 : * channel [CHANNEL_1, CHANNEL_16], and optional cable number 40 : * [CABLE_1, CABLE_16]. 41 : * @param sender 42 : * The MIDI sender to use. 43 : */ 44 1 : CCButtonLatching(OutputBankConfig<> config, pin_t pin, MIDIAddress address, 45 : const DigitalCCSender &sender = {}) 46 1 : : MIDIButtonLatching<SingleAddress, DigitalCCSender>{ 47 2 : {config, address}, pin, sender} {} 48 : }; 49 : 50 : } // namespace Bankable 51 : 52 : END_CS_NAMESPACE