Control Surface stm32
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
16using AH::analog_t;
17using AH::NO_PIN;
18using AH::pin_t;
19using AH::PinList;
20
22
23using AH::Array;
24using AH::Array2D;
25
27template <uint8_t NumRows, uint8_t NumCols>
28using AddressMatrix = Array2D<uint8_t, NumRows, NumCols>;
29
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
51using setting_t = uint8_t;
55
56// Updatable types:
57struct Potentiometer {};
58struct MotorFader {};
59struct Display {};
60
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
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
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).
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