forked from melodyians/melodyian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.h
67 lines (46 loc) · 1.52 KB
/
robot.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
#pragma once
#include "components.h"
#include "types.h"
// Behaviors
class RobotLEDBehavior : public Behavior {
private:
RGBColor transition_color;
bool flash_on_flag;
byte selected_light_preset;
byte current_fade_preset;
float brightness;
void triggerLightPreset(int preset_number, State * state);
void flashBehavior(State * state, Output * output);
void fadeBehavior(State * state, Output * output);
void pulseBehavior(unsigned short dt, State * state, Output * output);
public:
RobotLEDBehavior();
void updateBehavior(unsigned short dt, State * state, Output * output);
void updateBehaviorKey(byte control_number, byte value);
void updateState(byte control_number, byte value, State * state);
};
class RobotSoundBehavior : public Behavior {
private:
Melody * melody_one;
Melody * melody_two;
public:
RobotSoundBehavior();
void updateBehavior(unsigned short dt, State * state, Output * output);
void updateBehaviorKey(byte control_number, byte value);
void updateState(byte control_number, byte value, State * state);
};
// Main interface
class Robot {
public:
Robot(HardwareInterface * hardware);
HardwareInterface * hardware;
State * state;
Output * output;
RobotLEDBehavior * led_behavior;
RobotSoundBehavior * sound_behavior;
void handleInput(byte control_number, byte value);
void updateBehavior(unsigned short dt);
void updateHardware();
void noteOnControl(byte channel, byte note, byte velocity);
void noteOffControl(byte channel, byte note, byte velocity);
};