Control Surface  1.2.0
MIDI Control Surface library for Arduino
Def.hpp
Go to the documentation of this file.
1 /* ✔ */
2 
3 #pragma once
4 
5 #include "Channel.hpp"
6 #include "Cable.hpp"
9 #include <Settings/NamespaceSettings.hpp>
10 #include <stddef.h> // size_t
11 #include <stdint.h> // uint8_t
12 
14 
15 using AH::analog_t;
16 using AH::NO_PIN;
17 using AH::pin_t;
18 using AH::PinList;
19 
21 
22 using AH::Array;
23 using AH::Array2D;
24 
26 template <uint8_t nb_rows, uint8_t nb_cols>
27 using AddressMatrix = Array2D<uint8_t, nb_rows, nb_cols>;
28 
31  // TODO: why do I need explicit constructors?
32  EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
33  : 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;
38  uint8_t B;
40 };
42 
45  uint8_t A;
46  uint8_t B;
47 };
48 
50 using setting_t = uint8_t;
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 
60 struct PixelLocation {
61  int16_t x;
62  int16_t y;
63 };
64 
EncoderSwitchPinList::EncoderSwitchPinList
EncoderSwitchPinList(uint8_t A, uint8_t B)
Definition: Def.hpp:34
EncoderSwitchPinList::switchPin
pin_t switchPin
The pin connected to the switch pin of the encoder.
Definition: Def.hpp:39
EncoderPinList::A
uint8_t A
The pin connected to the A pin of the encoder.
Definition: Def.hpp:45
PixelLocation::x
int16_t x
Definition: Def.hpp:61
AH::pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Hardware-Types.hpp:17
MotorFader
Definition: Def.hpp:56
EncoderSwitchPinList::A
uint8_t A
The pin connected to the A pin of the encoder.
Definition: Def.hpp:37
EncoderSwitchPinList::B
uint8_t B
The pin connected to the B pin of the encoder.
Definition: Def.hpp:38
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
EncoderSwitchPinList::EncoderSwitchPinList
EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
Definition: Def.hpp:32
PixelLocation::y
int16_t y
Definition: Def.hpp:62
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
Display
Definition: Def.hpp:57
Array.hpp
Potentiometer
Definition: Def.hpp:55
AH::Array
An array wrapper for easy copying, comparing, and iterating.
Definition: Array.hpp:36
Channel.hpp
AH::Array2D
Array< Array< T, nb_cols >, nb_rows > Array2D
An easy alias for two-dimensional Arrays.
Definition: Array.hpp:545
NO_SETTING
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:52
EncoderPinList
A struct for the pins of a rotary (quadrature) encoder without a switch.
Definition: Def.hpp:44
AH::NO_PIN
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
Definition: Hardware-Types.hpp:24
AH::analog_t
uint16_t analog_t
The type returned from analogRead and similar functions.
Definition: Hardware-Types.hpp:15
AddressMatrix
Array2D< uint8_t, nb_rows, nb_cols > AddressMatrix
Definition: Def.hpp:27
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:60
AH::PinList
Array< pin_t, N > PinList
An easy alias for arrays of pins.
Definition: Hardware-Types.hpp:28
setting_t
uint8_t setting_t
The type used for Selectors.
Definition: Def.hpp:50
MappingFunction
analog_t(*)(analog_t) MappingFunction
Definition: Def.hpp:20
Hardware-Types.hpp
Cable.hpp
EncoderPinList::B
uint8_t B
The pin connected to the B pin of the encoder.
Definition: Def.hpp:46
EncoderSwitchPinList
A struct for the pins of a rotary (quadrature) encoder with a switch.
Definition: Def.hpp:30