Control Surface  1.1.1
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"
8 #include <Settings/NamespaceSettings.hpp>
9 #include <stddef.h> // size_t
10 #include <stdint.h> // uint8_t
11 
13 
14 using AH::analog_t;
15 using AH::NO_PIN;
16 using AH::pin_t;
17 using AH::PinList;
18 
20 
21 using AH::Array;
22 using AH::Array2D;
23 
25 template <uint8_t nb_rows, uint8_t nb_cols>
26 using AddressMatrix = Array2D<uint8_t, nb_rows, nb_cols>;
27 
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
PixelLocation::x
int16_t x
Definition: Def.hpp:61
EncoderSwitchPinList::switchPin
pin_t switchPin
The pin connected to the switch pin of the encoder.
Definition: Def.hpp:39
AH::pin_t
uint16_t pin_t
The type for Arduino pins (and ExtendedIOElement pins).
Definition: Hardware-Types.hpp:17
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
MotorFader
Definition: Def.hpp:56
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
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:60
Array.hpp
EncoderPinList::B
uint8_t B
The pin connected to the B pin of the encoder.
Definition: Def.hpp:46
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:541
NO_SETTING
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:52
AH::NO_PIN
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
Definition: Hardware-Types.hpp:24
PixelLocation::y
int16_t y
Definition: Def.hpp:62
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:26
Display
Definition: Def.hpp:57
EncoderPinList::A
uint8_t A
The pin connected to the A pin of the encoder.
Definition: Def.hpp:45
Potentiometer
Definition: Def.hpp:55
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
EncoderPinList
A struct for the pins of a rotary (quadrature) encoder without a switch.
Definition: Def.hpp:44
MappingFunction
analog_t(*)(analog_t) MappingFunction
Definition: Def.hpp:19
Hardware-Types.hpp
EncoderSwitchPinList
A struct for the pins of a rotary (quadrature) encoder with a switch.
Definition: Def.hpp:30