Control Surface  1.1.0
MIDI Control Surface library for Arduino
CCButtonMatrix.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 /**
9  * @brief A class of MIDIOutputElement%s that read the input from a **matrix
10  * of momentary push buttons or switches**, and send out MIDI **Control
11  * Change** events.
12  *
13  * A value of 0x7F is sent when a button is pressed, and a value of 0x00 is sent
14  * when a button is released.
15  * Crude software debouncing is implemented by limiting the refresh rate.
16  * This version cannot be banked.
17  *
18  * @tparam nb_rows
19  * The number of rows of the matrix.
20  * @tparam nb_cols
21  * The number of columns of the matrix.
22  *
23  * @ingroup MIDIOutputElements
24  */
25 template <uint8_t nb_rows, uint8_t nb_cols>
27  : public MIDIButtonMatrix<DigitalCCSender, nb_rows, nb_cols> {
28  public:
29  /**
30  * @brief Create a new CCButtonMatrix object with the given pins,
31  * controller numbers and channel.
32  *
33  * @param rowPins
34  * A list of pin numbers connected to the rows of the button
35  * matrix.
36  * **⚠** These pins will be driven LOW as outputs (Lo-Z).
37  * @param colPins
38  * A list of pin numbers connected to the columns of the button
39  * matrix.
40  * These pins will be used as inputs (Hi-Z), and the
41  * internal pull-up resistor will be enabled.
42  * @param controllers
43  * A 2-dimensional array of the same dimensions as the button
44  * matrix that contains the MIDI Controller number of each button.
45  * [0, 119]
46  * @param channelCN
47  * The MIDI channel [CHANNEL_1, CHANNEL_16] and Cable Number
48  * [0, 15].
49  * @param sender
50  * The MIDI sender to use.
51  */
52  CCButtonMatrix(const PinList<nb_rows> &rowPins,
53  const PinList<nb_cols> &colPins,
54  const AddressMatrix<nb_rows, nb_cols> &controllers,
55  MIDICNChannel channelCN, const DigitalCCSender &sender = {})
57  rowPins, colPins, controllers, channelCN, sender) {}
58 };
59 
MIDIButtonMatrix.hpp
CCButtonMatrix::CCButtonMatrix
CCButtonMatrix(const PinList< nb_rows > &rowPins, const PinList< nb_cols > &colPins, const AddressMatrix< nb_rows, nb_cols > &controllers, MIDICNChannel channelCN, const DigitalCCSender &sender={})
Create a new CCButtonMatrix object with the given pins, controller numbers and channel.
Definition: CCButtonMatrix.hpp:52
CCButtonMatrix
A class of MIDIOutputElements that read the input from a matrix of momentary push buttons or switches...
Definition: CCButtonMatrix.hpp:26
DigitalCCSender.hpp
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
DigitalCCSender
Definition: DigitalCCSender.hpp:7
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
MIDIButtonMatrix< DigitalCCSender, nb_rows, nb_cols >::sender
DigitalCCSender sender
Definition: Abstract/MIDIButtonMatrix.hpp:50
MIDIButtonMatrix
MIDIButtonMatrix.
Definition: Abstract/MIDIButtonMatrix.hpp:15
MIDICNChannel
A class for saving a MIDI channel and cable number.
Definition: MIDICNChannelAddress.hpp:19
AddressMatrix
Array2D< uint8_t, nb_rows, nb_cols > AddressMatrix
Definition: Def.hpp:26
AH::ButtonMatrix::rowPins
const PinList< nb_rows > rowPins
Definition: ButtonMatrix.hpp:85
AH::ButtonMatrix::colPins
const PinList< nb_cols > colPins
Definition: ButtonMatrix.hpp:86