LCOV - code coverage report
Current view: top level - src/MIDI_Outputs - CCRotaryEncoder.hpp (source / functions) Hit Total Coverage
Test: e224b347cd670555e44f06608ac41bd1ace9d9d8 Lines: 5 5 100.0 %
Date: 2020-09-08 17:44:46 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          11 : 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             :      *          [CABLE_1, CABLE_16].
      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             :      */
      49           1 :     CCRotaryEncoder(const EncoderPinList &pins, const MIDIAddress &address,
      50             :                     int8_t speedMultiply = 1, uint8_t pulsesPerStep = 4)
      51           1 :         : MIDIRotaryEncoder(pins, address, speedMultiply, pulsesPerStep, {}) {}
      52             : 
      53             : // For tests only (PJRC Encoder library's copy constructor doesn't work)
      54             : #ifndef ARDUINO
      55          10 :     CCRotaryEncoder(const Encoder &enc, const MIDIAddress &address,
      56             :                     int8_t speedMultiply, uint8_t pulsesPerStep)
      57          10 :         : MIDIRotaryEncoder(enc, address, speedMultiply, pulsesPerStep, {}) {}
      58             : #endif
      59             : };
      60             : 
      61             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-6-g40580cd