LCOV - code coverage report
Current view: top level - src/MIDI_Outputs - CCRotaryEncoder.hpp (source / functions) Hit Total Coverage
Test: 90a1b9beff85a60dc6ebcea034a947a845e56960 Lines: 7 7 100.0 %
Date: 2019-11-30 15:53:32 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <MIDI_Outputs/Abstract/MIDIRotaryEncoder.hpp>
       4             : #include <MIDI_Senders/RelativeCCSender.hpp>
       5             : 
       6             : BEGIN_CS_NAMESPACE
       7             : 
       8             : /**
       9             :  * @brief   A class of MIDIOutputElement%s that read the input of a **quadrature
      10             :  *          (rotary) encoder** and send out relative MIDI **Control Change**
      11             :  *          events.
      12             :  * 
      13             :  * This version cannot be banked.
      14             :  *
      15             :  * @note    To use this class, include the [PJRC Encoder library]
      16             :  *          (https://github.com/PaulStoffregen/Encoder) before the
      17             :  *          Control-Surface library.
      18             :  *
      19             :  * @ingroup MIDIOutputElements
      20             :  */
      21           8 : class CCRotaryEncoder : public MIDIRotaryEncoder<RelativeCCSender> {
      22             :   public:
      23             :     /**
      24             :      * @brief   Construct a new CCRotaryEncoder object with the given pins, 
      25             :      *          address, channel, speed factor, and number of pulses per step.
      26             :      * 
      27             :      * @param   pins
      28             :      *          A list of the two pins connected to the A and B outputs of the
      29             :      *          encoder.  
      30             :      *          The internal pull-up resistors will be enabled by the Encoder
      31             :      *          library.
      32             :      * @param   address
      33             :      *          The MIDI address containing the controller number [0, 119], 
      34             :      *          channel [CHANNEL_1, CHANNEL_16], and optional cable number 
      35             :      *          [0, 15].
      36             :      * @param   speedMultiply
      37             :      *          A constant factor to increase the speed of the rotary encoder.
      38             :      *          The difference in position will just be multiplied by this 
      39             :      *          factor. 
      40             :      * @param   pulsesPerStep
      41             :      *          The number of pulses per physical click of the encoder.
      42             :      *          For a normal encoder, this is 4. If you want to increase the
      43             :      *          resolution, for the use of Jog wheels, for example, you can go
      44             :      *          as 1.  
      45             :      *          Whereas a greater speedMultiplier factor will increase the 
      46             :      *          speed, increasing the number of pulsesPerStep will result in a 
      47             :      *          lower speed.
      48             :      * @param   sender
      49             :      *          The MIDI sender to use.
      50             :      */
      51           1 :     CCRotaryEncoder(const EncoderPinList &pins,
      52             :                     const MIDICNChannelAddress &address,
      53             :                     uint8_t speedMultiply = 1, uint8_t pulsesPerStep = 4,
      54             :                     const RelativeCCSender &sender = {})
      55           2 :         : MIDIRotaryEncoder(pins, address, speedMultiply, pulsesPerStep,
      56           3 :                             sender) {}
      57             : 
      58             : // For tests only (PJRC Encoder library's copy constructor doesn't work)
      59             : #ifndef ARDUINO
      60           7 :     CCRotaryEncoder(const Encoder &encoder, const MIDICNChannelAddress &address,
      61             :                     uint8_t speedMultiply, uint8_t pulsesPerStep,
      62             :                     const RelativeCCSender &sender = {})
      63          14 :         : MIDIRotaryEncoder(encoder, address, speedMultiply, pulsesPerStep,
      64          21 :                             sender) {}
      65             : #endif
      66             : };
      67             : 
      68             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-5-g4ff2ed6