Line data Source code
1 : /* ✔ */ 2 : 3 : #pragma once 4 : 5 : #include "Channel.hpp" 6 : #include "Cable.hpp" 7 : #include <AH/Containers/Array.hpp> 8 : #include <AH/Hardware/Hardware-Types.hpp> 9 : #include <Settings/NamespaceSettings.hpp> 10 : #include <stddef.h> // size_t 11 : #include <stdint.h> // uint8_t 12 : 13 : BEGIN_CS_NAMESPACE 14 : 15 : using AH::analog_t; 16 : using AH::NO_PIN; 17 : using AH::pin_t; 18 : using AH::PinList; 19 : 20 : using MappingFunction = analog_t (*)(analog_t); 21 : 22 : using AH::Array; 23 : using AH::Array2D; 24 : 25 : /// @todo This should be an array of type MIDIAddress. 26 : template <uint8_t nb_rows, uint8_t nb_cols> 27 : using AddressMatrix = Array2D<uint8_t, nb_rows, nb_cols>; 28 : 29 : /// A struct for the pins of a rotary (quadrature) encoder with a switch. 30 : struct EncoderSwitchPinList { 31 : // TODO: why do I need explicit constructors? 32 2 : EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin) 33 2 : : A(A), B(B), switchPin(switchPin) {} 34 : EncoderSwitchPinList(uint8_t A, uint8_t B) 35 : : A(A), B(B), switchPin(NO_PIN) {} 36 : 37 : uint8_t A; ///< The pin connected to the A pin of the encoder. 38 : uint8_t B; ///< The pin connected to the B pin of the encoder. 39 : pin_t switchPin = NO_PIN; ///< The pin connected to the switch pin of the 40 : ///< encoder. 41 : }; 42 : 43 : /// A struct for the pins of a rotary (quadrature) encoder without a switch. 44 : struct EncoderPinList { 45 : uint8_t A; ///< The pin connected to the A pin of the encoder. 46 : uint8_t B; ///< The pin connected to the B pin of the encoder. 47 : }; 48 : 49 : /// The type used for Selector%s. 50 : using setting_t = uint8_t; 51 : /// A special setting that indicates an unused or invalid setting. 52 : constexpr setting_t NO_SETTING = 1 << (8 * sizeof(setting_t) - 1); 53 : 54 : // Updatable types: 55 : struct Potentiometer {}; 56 : struct MotorFader {}; 57 : struct Display {}; 58 : 59 : /// A simple struct representing a pixel with integer coordinates. 60 : struct PixelLocation { 61 : int16_t x; 62 : int16_t y; 63 : }; 64 : 65 : END_CS_NAMESPACE