Control Surface new-input
MIDI Control Surface library for Arduino
Def.hpp
Go to the documentation of this file.
1 /* ✔ */
2 
3 #pragma once
4 
5 #include "Cable.hpp"
6 #include "Channel.hpp"
9 #include <AH/STL/limits>
10 #include <Settings/NamespaceSettings.hpp>
11 #include <stddef.h> // size_t
12 #include <stdint.h> // uint8_t
13 
15 
16 using AH::analog_t;
17 using AH::NO_PIN;
18 using AH::pin_t;
19 using AH::PinList;
20 
22 
23 using AH::Array;
24 using AH::Array2D;
25 
27 template <uint8_t NumRows, uint8_t NumCols>
28 using AddressMatrix = Array2D<uint8_t, NumRows, NumCols>;
29 
33  EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
34  : A(A), B(B), switchPin(switchPin) {}
36  EncoderSwitchPinList(uint8_t A, uint8_t B)
37  : A(A), B(B), switchPin(NO_PIN) {}
38 
39  uint8_t A;
40  uint8_t B;
42 };
43 
46  uint8_t A;
47  uint8_t B;
48 };
49 
51 using setting_t = uint8_t;
53 constexpr setting_t NO_SETTING =
55 
56 // Updatable types:
57 struct Potentiometer {};
58 struct MotorFader {};
59 struct Display {};
60 
62 struct PixelLocation {
63  int16_t x;
64  int16_t y;
65 };
66 
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:53
uint8_t setting_t
The type used for Selectors.
Definition: Def.hpp:51
uint8_t B
The pin connected to the B pin of the encoder.
Definition: Def.hpp:47
analog_t(*)(analog_t) MappingFunction
Definition: Def.hpp:21
Array2D< uint8_t, NumRows, NumCols > AddressMatrix
Definition: Def.hpp:28
uint8_t A
The pin connected to the A pin of the encoder.
Definition: Def.hpp:46
int16_t x
Definition: Def.hpp:63
int16_t y
Definition: Def.hpp:64
Definition: Def.hpp:59
A struct for the pins of a rotary (quadrature) encoder without a switch.
Definition: Def.hpp:45
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:62
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Array< Array< T, NumCols >, NumRows > Array2D
An easy alias for two-dimensional Arrays.
Definition: Array.hpp:606
constexpr auto max(const T &a, const U &b) -> decltype(a< b ? b :a)
Return the larger of two numbers/objects.
Definition: MinMaxFix.hpp:22
Array< pin_t, N > PinList
An easy alias for arrays of pins.
uint16_t analog_t
The type returned from analogRead and similar functions.
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
A struct for the pins of a rotary (quadrature) encoder with a switch.
Definition: Def.hpp:31
pin_t switchPin
The pin connected to the switch pin of the encoder.
Definition: Def.hpp:41
uint8_t B
The pin connected to the B pin of the encoder.
Definition: Def.hpp:40
uint8_t A
The pin connected to the A pin of the encoder.
Definition: Def.hpp:39
EncoderSwitchPinList(uint8_t A, uint8_t B)
Constructor for encoders without a switch.
Definition: Def.hpp:36
EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
Constructor for encoders with a switch.
Definition: Def.hpp:33