-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUIState.h
59 lines (48 loc) · 1.46 KB
/
UIState.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
#ifndef UISTATE_H
#define UISTATE_H
#define UI_STATE_SEQUENCE 0
#define UI_STATE_PICK_STEP 1
#define UI_STATE_STEP_OPTIONS 2
#define UI_STATE_SEQUENCER_OPTIONS 4
// TODO: move this away from here
#define STEP_OPTIONS_CHOOSE_OPTION 0
#define STEP_OPTIONS_ENABLE 1
#define STEP_OPTIONS_NOTE 2
#define STEP_OPTIONS_VELOCITY 3
#define SEQUENCER_OPTIONS_CHOOSE_OPTION 0
#define SEQUENCER_OPTIONS_BANK 1
#define SEQUENCER_OPTIONS_CHANNEL 2
#define SEQUENCER_OPTIONS_BPM 3
#define SEQUENCER_OPTIONS_STEPS 4
class UIState {
public:
byte state = UI_STATE_SEQUENCE;
uint8_t currentlySelectedStep = 0;
// 0-based
uint8_t bank = 0;
void loop() {
state = nextState;
}
void changeToSequence() {
Serial.println("Changing to sequence");
queueChangeState(UI_STATE_SEQUENCE);
}
void changeToPickStep() {
Serial.println("Changing to pick step");
queueChangeState(UI_STATE_PICK_STEP);
}
void changeToStepOptions() {
Serial.println("Changing to step options");
queueChangeState(UI_STATE_STEP_OPTIONS);
}
void changeToSequencerOptions() {
Serial.println("Changing to sequencer options");
queueChangeState(UI_STATE_SEQUENCER_OPTIONS);
}
private:
byte nextState;
void queueChangeState(byte state) {
nextState = state;
}
};
#endif