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