LCOV - code coverage report
Current view: top level - src/MIDI_Outputs/ManyAddresses - CCButtonMatrix.hpp (source / functions) Hit Total Coverage
Test: 19d2efc7037c2e176feca44750a12594c76f466f Lines: 4 4 100.0 %
Date: 2019-11-24 14:50:27 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <Banks/BankAddresses.hpp>
       4             : #include <MIDI_Outputs/Bankable/Abstract/MIDIButtonMatrix.hpp>
       5             : #include <MIDI_Senders/DigitalCCSender.hpp>
       6             : 
       7             : BEGIN_CS_NAMESPACE
       8             : 
       9             : namespace Bankable {
      10             : namespace ManyAddresses {
      11             : 
      12             : /**
      13             :  * @brief   A class of MIDIOutputElement%s that read the input from a **matrix
      14             :  *          of momentary push buttons or switches**, and send out MIDI **Control
      15             :  *          Change** events.
      16             :  * 
      17             :  * A value of 0x7F is sent when a button is pressed, and a value of 0x00 is sent
      18             :  * when a button is released.  
      19             :  * Crude software debouncing is implemented by limiting the refresh rate.  
      20             :  *
      21             :  *  * This version can be banked using an arbitrary list of alternative
      22             :  * addresses.
      23             :  *          
      24             :  * @tparam  NumBanks
      25             :  *          The number of variants/alternative addresses the element has.
      26             :  * @tparam  nb_rows
      27             :  *          The number of rows of the matrix.
      28             :  * @tparam  nb_cols
      29             :  *          The number of columns of the matrix.
      30             :  * 
      31             :  * @ingroup ManyAddressesMIDIOutputElements
      32             :  */
      33             : template <setting_t NumBanks, uint8_t nb_rows, uint8_t nb_cols>
      34           1 : class CCButtonMatrix
      35             :     : public MIDIButtonMatrix<ManyMatrixAddresses<NumBanks, nb_rows, nb_cols>,
      36             :                               DigitalCCSender, nb_rows, nb_cols> {
      37             :   public:
      38             :     /**
      39             :      * @brief   Create a new Bankable CCButtonMatrix object with the given pins,
      40             :      *          controller numbers and channel.
      41             :      * 
      42             :      * @param   config
      43             :      *          The bank configuration to use: the bank to add this element to,
      44             :      *          and whether to change the address, channel or cable number.
      45             :      * @param   rowPins
      46             :      *          A list of pin numbers connected to the rows of the button
      47             :      *          matrix.  
      48             :      *          **⚠** These pins will be driven LOW as outputs (Lo-Z).
      49             :      * @param   colPins
      50             :      *          A list of pin numbers connected to the columns of the button
      51             :      *          matrix.  
      52             :      *          These pins will be used as inputs (Hi-Z), and the
      53             :      *          internal pull-up resistor will be enabled.
      54             :      * @param   controllers
      55             :      *          A list of 2-dimensional arrays of the same dimensions as the 
      56             :      *          button matrix that contains the MIDI Controller number of each 
      57             :      *          button.
      58             :      *          [0, 119]
      59             :      * @param   channelCNs
      60             :      *          The a list containing the MIDI channels [CHANNEL_1, CHANNEL_16] 
      61             :      *          and Cable Numbers [0, 15].
      62             :      * @param   sender
      63             :      *          The MIDI sender to use.
      64             :      */
      65           1 :     CCButtonMatrix(
      66             :         const OutputBankConfig &config, const PinList<nb_rows> &rowPins,
      67             :         const PinList<nb_cols> &colPins,
      68             :         const Array<AddressMatrix<nb_rows, nb_cols>, NumBanks> &controllers,
      69             :         const Array<MIDICNChannel, NumBanks> &channelCNs,
      70             :         const DigitalCCSender &sender = {})
      71           1 :         : MIDIButtonMatrix<ManyMatrixAddresses<NumBanks, nb_rows, nb_cols>,
      72             :                            DigitalCCSender, nb_rows, nb_cols>{
      73           2 :               {config, controllers, channelCNs}, rowPins, colPins, sender} {}
      74             : };
      75             : 
      76             : } // namespace ManyAddresses
      77             : } // namespace Bankable
      78             : 
      79             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-5-g4ff2ed6