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

          Line data    Source code
       1             : /* ✔ */
       2             : 
       3             : #pragma once
       4             : 
       5             : #include <MIDI_Outputs/Abstract/MIDIButtonLatched.hpp>
       6             : #include <MIDI_Senders/DigitalNoteSender.hpp>
       7             : 
       8             : BEGIN_CS_NAMESPACE
       9             : 
      10             : /**
      11             :  * @brief   A class of MIDIOutputElement%s that read the input of a **momentary
      12             :  *          push button or toggle switch**, and send out MIDI **Note** events.
      13             :  * 
      14             :  * It latches the input, so press once to enable, press again to disable
      15             :  * (toggle).
      16             :  * 
      17             :  * The switch is debounced in software.  
      18             :  * This version cannot be banked.  
      19             :  *
      20             :  * @ingroup MIDIOutputElements
      21             :  */
      22           1 : class NoteButtonLatched : public MIDIButtonLatched<DigitalNoteSender> {
      23             :   public:
      24             :     /**
      25             :      * @brief   Create a new NoteButtonLatched object on the given pin and with 
      26             :      *          address.
      27             :      * 
      28             :      * @param   pin
      29             :      *          The digital input pin to read from.  
      30             :      *          The internal pull-up resistor will be enabled.
      31             :      * @param   address
      32             :      *          The MIDI address containing the note number [0, 127], 
      33             :      *          channel [CHANNEL_1, CHANNEL_16], and optional cable number 
      34             :      *          [0, 15].
      35             :      * @param   velocity
      36             :      *          The velocity of the MIDI Note events.
      37             :      */
      38           1 :     NoteButtonLatched(pin_t pin, const MIDICNChannelAddress &address,
      39             :                       uint8_t velocity = 0x7F)
      40           1 :         : MIDIButtonLatched{
      41           1 :               pin,
      42           1 :               address,
      43           1 :               {velocity},
      44           2 :           } {}
      45             : 
      46             :     /// Set the velocity of the MIDI Note events.
      47             :     void setVelocity(uint8_t velocity) { this->sender.setVelocity(velocity); }
      48             :     /// Get the velocity of the MIDI Note events.
      49             :     uint8_t getVelocity() const { return this->sender.getVelocity(); }
      50             : };
      51             : 
      52             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-5-g4ff2ed6