Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Def
Def.hpp
Go to the documentation of this file.
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
29
template
<u
int
8_t NumRows, u
int
8_t NumCols>
30
using
AddressMatrix
=
Array2D<uint8_t, NumRows, NumCols>
;
31
33
struct
EncoderSwitchPinList
{
35
EncoderSwitchPinList
(uint8_t
A
, uint8_t
B
,
pin_t
switchPin
)
36
:
A
(
A
),
B
(
B
),
switchPin
(
switchPin
) {}
37
38
EncoderSwitchPinList
(uint8_t
A
, uint8_t
B
)
39
:
A
(
A
),
B
(
B
),
switchPin
(
NO_PIN
) {}
40
41
uint8_t
A
;
42
uint8_t
B
;
43
pin_t
switchPin
;
44
};
45
47
struct
EncoderPinList
{
48
uint8_t
A
;
49
uint8_t
B
;
50
};
51
53
using
setting_t
= uint8_t;
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
64
struct
PixelLocation
{
65
int16_t
x
;
66
int16_t
y
;
67
};
68
69
END_CS_NAMESPACE
Arduino-Hardware-Types.hpp
ArduinoPin_t
AH::function_traits< decltype(::digitalWrite)>::argument_t< 0 > ArduinoPin_t
Definition
Arduino-Hardware-Types.hpp:23
Array.hpp
Cable.hpp
Channel.hpp
NoSetting
constexpr setting_t NoSetting
A special setting that indicates an unused or invalid setting.
Definition
Def.hpp:55
NO_PIN
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
Definition
Hardware-Types.hpp:96
setting_t
uint8_t setting_t
The type used for Selectors.
Definition
Def.hpp:53
MappingFunction
analog_t(*)(analog_t) MappingFunction
Definition
Def.hpp:23
AddressMatrix
Array2D< uint8_t, NumRows, NumCols > AddressMatrix
Definition
Def.hpp:30
Hardware-Types.hpp
NamespaceSettings.hpp
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
AH::Array2D
Array< Array< T, NumCols >, NumRows > Array2D
An easy alias for two-dimensional Arrays.
Definition
Array.hpp:529
AH::PinList
Array< pin_t, N > PinList
An easy alias for arrays of pins.
Definition
Hardware-Types.hpp:100
AH::analog_t
uint16_t analog_t
The type returned from analogRead and similar functions.
Definition
Hardware-Types.hpp:14
AH::NO_PIN
constexpr pin_t NO_PIN
A special pin number that indicates an unused or invalid pin.
Definition
Hardware-Types.hpp:96
AH::Array
An array wrapper for easy copying, comparing, and iterating.
Definition
Array.hpp:32
AH::ExtIO::pin_t
Type for storing pin numbers of Extended Input/Output elements.
Definition
Hardware-Types.hpp:25
Display
Definition
Def.hpp:61
EncoderPinList
A struct for the pins of a rotary (quadrature) encoder without a switch.
Definition
Def.hpp:47
EncoderPinList::B
uint8_t B
The pin connected to the B pin of the encoder.
Definition
Def.hpp:49
EncoderPinList::A
uint8_t A
The pin connected to the A pin of the encoder.
Definition
Def.hpp:48
EncoderSwitchPinList::switchPin
pin_t switchPin
The pin connected to the switch pin of the encoder.
Definition
Def.hpp:43
EncoderSwitchPinList::B
uint8_t B
The pin connected to the B pin of the encoder.
Definition
Def.hpp:42
EncoderSwitchPinList::A
uint8_t A
The pin connected to the A pin of the encoder.
Definition
Def.hpp:41
EncoderSwitchPinList::EncoderSwitchPinList
EncoderSwitchPinList(uint8_t A, uint8_t B)
Constructor for encoders without a switch.
Definition
Def.hpp:38
EncoderSwitchPinList::EncoderSwitchPinList
EncoderSwitchPinList(uint8_t A, uint8_t B, pin_t switchPin)
Constructor for encoders with a switch.
Definition
Def.hpp:35
MotorFader
Definition
Def.hpp:60
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition
Def.hpp:64
PixelLocation::x
int16_t x
Definition
Def.hpp:65
PixelLocation::y
int16_t y
Definition
Def.hpp:66
Potentiometer
Definition
Def.hpp:59
Generated by
1.17.0