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

Generated by: LCOV version 1.14-5-g4ff2ed6