LCOV - code coverage report
Current view: top level - src/MIDI_Outputs/ManyAddresses - CCButtonMatrix.hpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 2 2 100.0 %
Date: 2024-11-09 15:32:27 Functions: 1 1 100.0 %
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  NumRows
      27             :  *          The number of rows of the matrix.
      28             :  * @tparam  NumCols
      29             :  *          The number of columns of the matrix.
      30             :  * 
      31             :  * @ingroup ManyAddressesMIDIOutputElements
      32             :  */
      33             : template <setting_t NumBanks, uint8_t NumRows, uint8_t NumCols>
      34             : class CCButtonMatrix
      35             :     : public MIDIButtonMatrix<ManyMatrixAddresses<NumBanks, NumRows, NumCols>,
      36             :                               DigitalCCSender, NumRows, NumCols> {
      37             :   public:
      38             :     /**
      39             :      * @brief   Create a new Bankable CCButtonMatrix object with the given pins,
      40             :      *          controller numbers and channel.
      41             :      * 
      42             :      * @param   bank
      43             :      *          The bank to add this element to.
      44             :      * @param   rowPins
      45             :      *          A list of pin numbers connected to the rows of the button
      46             :      *          matrix.  
      47             :      *          **⚠** These pins will be driven LOW as outputs (Lo-Z).
      48             :      * @param   colPins
      49             :      *          A list of pin numbers connected to the columns of the button
      50             :      *          matrix.  
      51             :      *          These pins will be used as inputs (Hi-Z), and the
      52             :      *          internal pull-up resistor will be enabled.
      53             :      * @param   controllers
      54             :      *          A list of 2-dimensional arrays of the same dimensions as the 
      55             :      *          button matrix that contains the MIDI Controller number of each 
      56             :      *          button.
      57             :      *          [0, 119]
      58             :      * @param   channelCNs
      59             :      *          The a list containing the MIDI channels [Channel_1, Channel_16] 
      60             :      *          and Cable Numbers [Cable_1, Cable_16].
      61             :      * @param   sender
      62             :      *          The MIDI sender to use.
      63             :      */
      64           1 :     CCButtonMatrix(
      65             :         const Bank<NumBanks> &bank, const PinList<NumRows> &rowPins,
      66             :         const PinList<NumCols> &colPins,
      67             :         const Array<AddressMatrix<NumRows, NumCols>, NumBanks> &controllers,
      68             :         const Array<MIDIChannelCable, NumBanks> &channelCNs,
      69             :         const DigitalCCSender &sender = {})
      70             :         : MIDIButtonMatrix<ManyMatrixAddresses<NumBanks, NumRows, NumCols>,
      71             :                            DigitalCCSender, NumRows, NumCols> {
      72           1 :               {bank, controllers, channelCNs}, rowPins, colPins, sender} {}
      73             : };
      74             : 
      75             : } // namespace ManyAddresses
      76             : } // namespace Bankable
      77             : 
      78             : END_CS_NAMESPACE

Generated by: LCOV version 1.15