-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomm.proto
160 lines (141 loc) · 3.05 KB
/
comm.proto
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
syntax = "proto2";
package UsbComm;
enum Action {
NOP = 0;
VERSION = 1;
MOTOR_GET_STATE = 2;
KNOB_GET_CONFIG = 3;
KNOB_SET_CONFIG = 4;
KNOB_UPDATE_PREF = 9;
RGB_CONTROL = 5;
RGB_GET_STATE = 6;
RGB_SET_STATE = 8;
RGB_GET_INDICATOR = 10;
RGB_SET_INDICATOR = 11;
EINK_SET_IMAGE = 7;
}
message MessageH2D {
required Action action = 1;
oneof payload {
Nop nop = 2;
KnobConfig knob_config = 3;
KnobConfig.Pref knob_pref = 6;
RgbControl rgb_control = 4;
RgbState rgb_state = 7;
RgbIndicator rgb_indicator = 8;
EinkImage eink_image = 5;
}
}
message MessageD2H {
required Action action = 1;
oneof payload {
Nop nop = 2;
Version version = 3;
MotorState motor_state = 4;
KnobConfig knob_config = 5;
KnobConfig.Pref knob_pref = 8;
RgbState rgb_state = 6;
RgbIndicator rgb_indicator = 9;
EinkImage eink_image = 7;
}
}
message Nop {}
message Version {
required string zephyr_version = 1;
required string zmk_version = 2;
required string app_version = 3;
optional Features features = 4;
message Features {
optional bool rgb = 1;
optional bool rgb_full_control = 5;
optional bool rgb_indicator = 6;
optional bool eink = 2;
optional bool knob = 3;
optional bool knob_prefs = 4;
}
}
message MotorState {
required uint32 timestamp = 1;
required ControlMode control_mode = 2;
required float current_angle = 3;
required float current_velocity = 4;
required float target_angle = 5;
required float target_velocity = 6;
required float target_voltage = 7;
enum ControlMode {
TORQUE = 0;
VELOCITY = 1;
ANGLE = 2;
}
}
message KnobConfig {
required bool demo = 1;
required Mode mode = 2;
repeated Pref prefs = 5;
enum Mode {
DISABLE = 0;
INERTIA = 1;
ENCODER = 2;
SPRING = 3;
DAMPED = 4;
SPIN = 5;
RATCHET = 6;
}
message Pref {
required uint32 layer_id = 1;
optional string layer_name = 2;
required bool active = 3;
optional Mode mode = 4;
optional uint32 ppr = 5;
optional float torque_limit = 6;
}
}
message RgbControl {
required Command command = 1;
enum Command {
RGB_ON = 1;
RGB_OFF = 2;
RGB_HUI = 3;
RGB_HUD = 4;
RGB_SAI = 5;
RGB_SAD = 6;
RGB_BRI = 7;
RGB_BRD = 8;
RGB_SPI = 9;
RGB_SPD = 10;
RGB_EFF = 11;
RGB_EFR = 12;
}
}
message RgbState {
required bool on = 1;
optional HSB color = 2;
optional Effect effect = 3;
optional uint32 speed = 4;
message HSB {
required uint32 h = 1;
required uint32 s = 2;
required uint32 b = 3;
}
enum Effect {
SOLID = 0;
BREATHE = 1;
SPECTRUM = 2;
SWIRL = 3;
}
}
message RgbIndicator {
optional bool enable = 1;
optional uint32 brightness_active = 2;
optional uint32 brightness_inactive = 3;
}
message EinkImage {
required uint32 id = 1;
optional uint32 bits_length = 2 [ deprecated = true ];
optional bytes bits = 3;
optional uint32 x = 4;
optional uint32 y = 5;
optional uint32 width = 6;
optional uint32 height = 7;
optional bool partial = 8;
}