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

          Line data    Source code
       1             : /* ✔ */
       2             : 
       3             : #pragma once
       4             : 
       5             : #include "Channel.hpp"
       6             : #include "Frequency.hpp"
       7             : #include <Helpers/Array.hpp>
       8             : #include <Settings/NamespaceSettings.hpp>
       9             : #include <stddef.h> // size_t
      10             : #include <stdint.h> // uint8_t
      11             : 
      12             : BEGIN_CS_NAMESPACE
      13             : 
      14             : /// The type returned from analogRead and similar functions.
      15             : using analog_t = uint16_t;
      16             : /// The type for Arduino pins (and ExtendedIOElement pins).
      17             : using pin_t = uint16_t;
      18             : 
      19             : #ifdef NO_PIN // Fix for FastLED: https://github.com/FastLED/FastLED/issues/893
      20             : #undef NO_PIN
      21             : #endif
      22             : 
      23             : /// A special pin number that indicates an unused or invalid pin.
      24             : constexpr pin_t NO_PIN = 1 << (8 * sizeof(pin_t) - 1);
      25             : 
      26             : /// A function pointer to a mapping function to map analog values.
      27             : /// @see    MIDIFilteredAnalog::map()
      28             : using MappingFunction = analog_t (*)(analog_t);
      29             : 
      30             : /// An easy alias for two-dimensional Arrays.
      31             : template <class T, size_t nb_rows, size_t nb_cols>
      32             : using Array2D = Array<Array<T, nb_cols>, nb_rows>;
      33             : 
      34             : /// @todo   This should be an array of type MIDICNChannelAddress.
      35             : template <uint8_t nb_rows, uint8_t nb_cols>
      36             : using AddressMatrix = Array2D<uint8_t, nb_rows, nb_cols>;
      37             : 
      38             : /// An easy alias for arrays of pins.
      39             : template <size_t N>
      40             : using PinList = Array<pin_t, N>;
      41             : 
      42             : /// A struct for the pins of a rotary (quadrature) encoder with a switch.
      43             : struct EncoderSwitchPinList {
      44             :     // TODO: why do I need explicit constructors?
      45           2 :     EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
      46           2 :         : A(A), B(B), switchPin(switchPin) {}
      47             :     EncoderSwitchPinList(uint8_t A, uint8_t B)
      48             :         : A(A), B(B), switchPin(NO_PIN) {}
      49             : 
      50             :     uint8_t A; ///< The pin connected to the A pin of the encoder.
      51             :     uint8_t B; ///< The pin connected to the B pin of the encoder.
      52             :     pin_t switchPin = NO_PIN; ///< The pin connected to the switch pin of the
      53             :                               ///< encoder.
      54             : };
      55             : 
      56             : /// A struct for the pins of a rotary (quadrature) encoder without a switch.
      57             : struct EncoderPinList {
      58             :     uint8_t A; ///< The pin connected to the A pin of the encoder.
      59             :     uint8_t B; ///< The pin connected to the B pin of the encoder.
      60             : };
      61             : 
      62             : /// The type used for Selector%s.
      63             : using setting_t = uint8_t;
      64             : /// A special setting that indicates an unused or invalid setting.
      65             : constexpr setting_t NO_SETTING = 1 << (8 * sizeof(setting_t) - 1);
      66             : 
      67             : // Updatable types:
      68             : struct NormalUpdatable {};
      69             : struct Potentiometer {};
      70             : struct MotorFader {};
      71             : struct Display {};
      72             : 
      73             : /// A simple struct representing a pixel with integer coordinates.
      74             : struct PixelLocation {
      75             :     int16_t x;
      76             :     int16_t y;
      77             : };
      78             : 
      79             : #define UNUSED_PARAM __attribute__((unused))
      80             : 
      81             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-5-g4ff2ed6