-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lyra.h
129 lines (90 loc) · 1.87 KB
/
Lyra.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _LYRA_H_
#define _LYRA_H_
#include <Arduino.h>
#include <AccelStepper.h>
enum WheelDirection {left, right};
struct WheelPinout {
int speed; //PWM
int direction_1;
int direction_2;
};
struct TunerPinout{
int EN;
int MS_1;
int MS_2;
int MS_3;
int Step;
int Direction;
};
struct CalibrationPinout {
int min;
int max;
};
struct UIPinout {
int led;
int poti;
};
enum LyraFeature {
Break,
Lift,
Speed,
Acceleration,
Tune
};
struct LyraConfiguration {
int firstNote;
int lastNote;
int *notePositions;
int minPosition;
int maxPosition;
WheelPinout wheelPinout;
TunerPinout tunerPinout;
CalibrationPinout calibrationPinout;
UIPinout uiPinout;
//LyraFeature *featureList;
void (* minIRQ)();
void (* maxIRQ)();
};
class Lyra {
public:
Lyra(LyraConfiguration config);
void play(byte note, byte velocity);
void release(byte note, byte velocity);
void vibrato(byte range);
void pitch(int range);
bool hasFeature(LyraFeature feature);
int calibrate();
void run();
void minIRQ();
void maxIRQ();
static const int NOTE_COUNT = 128;
private:
int firstNote_;
int lastNote_;
int *notePositions_;
int minPosition_;
int maxPosition_;
WheelPinout wheelPinout_;
TunerPinout tunerPinout_;
CalibrationPinout calibrationPinout_;
UIPinout uiPinout_;
void initPositions(LyraConfiguration config);
void initUI(LyraConfiguration config);
void initWheel(LyraConfiguration config);
void initTuner(LyraConfiguration config);
void turnWheel(byte speed, WheelDirection direction);
void stopWheel(int speed);
int getNotePosition(int note);
int getLowestNote();
int getHighestNote();
int getMinPosition();
int getMaxPosition();
void bendWheel(int angle);
void selectNote(byte note);
void tracePositions__();
LyraFeature *featureList_;
AccelStepper *tuner_;
byte currentNote_;
};
//const static int val4; //für FETs
#endif //_LYRA_H_