-
Notifications
You must be signed in to change notification settings - Fork 0
/
reticul8.proto
184 lines (147 loc) · 3.5 KB
/
reticul8.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
syntax = "proto2";
import "nanopb.proto";
option java_package = "net.xlfe.reticul8";
option java_outer_classname = "Reticul8";
enum PIN_MODE {
PM_INPUT_PULLUP = 1;
PM_INPUT_PULLDOWN = 2;
PM_OUTPUT = 3;
}
message GPIO_CONFIG {
required fixed32 pin = 1;
required PIN_MODE mode = 2;
};
message GPIO_MONITOR {
required fixed32 pin = 1;
required fixed32 debounce_ms = 2;
}
enum PIN_VALUE {
PV_LOW = 0;
PV_HIGH = 1;
}
message GPIO_WRITE {
required fixed32 pin = 1;
required PIN_VALUE value = 2;
};
message GPIO_READ {
required fixed32 pin = 1;
}
message OTA_UPDATE {
required fixed32 chunk = 1;
required bytes data = 2 [(nanopb) = {max_size: 200 }];
}
message PWM_CONFIG {
required fixed32 pin =1;
}
message PWM_STOP {
required fixed32 pin =1;
}
// Max duty is 8192
message PWM_DUTY {
required fixed32 pin =1;
required fixed32 duty = 2;
}
message PWM_FADE {
required fixed32 pin = 1;
required fixed32 duty = 2;
required fixed32 fade_ms = 3;
}
message I2C_CONFIG {
optional fixed32 pin_sda = 1;
optional fixed32 pin_scl = 2;
}
message I2C_WRITE {
required fixed32 device = 1;
required fixed32 len = 3;
required bytes data = 4 [(nanopb).max_size=32];
}
message I2C_READ {
required fixed32 device = 1;
required fixed32 address = 2;
required fixed32 len = 3;
}
message PING {
required bool ping = 1;
}
message REBOOT {
required bool reboot = 1;
}
message SYSINFO {
required bool sysinfo = 1;
}
message SCHEDULE {
required sfixed32 count = 1;
required fixed32 every_ms = 2;
required fixed32 after_ms = 3;
}
// Allow a nested command to run using the optional data
message RUN_NESTED {
required bytes data = 3 [(nanopb).max_size=196];
}
message RPC {
oneof call {
GPIO_CONFIG gpio_config = 1;
GPIO_WRITE gpio_write = 2;
GPIO_READ gpio_read = 3;
GPIO_MONITOR gpio_monitor = 4;
PWM_CONFIG pwm_config = 5;
PWM_DUTY pwm_duty = 6;
PWM_FADE pwm_fade = 7;
PWM_STOP pwm_stop = 15;
PING ping = 8;
SYSINFO sysinfo = 9;
REBOOT reboot = 16;
I2C_CONFIG i2c_config = 10;
I2C_WRITE i2c_write = 11;
I2C_READ i2c_read = 12;
OTA_UPDATE ota_update = 13;
RUN_NESTED nested = 14;
}
required fixed32 msg_id = 200;
optional SCHEDULE schedule = 201;
}
enum RESULT_TYPE {
RT_UNKNOWN = 1;
RT_SUCCESS = 2;
RT_ERROR = 3;
}
message PIN_CHANGE {
required fixed32 pin = 1;
required PIN_VALUE value =2;
}
enum STARTUP_REASON {
SR_UNKNOWN = 1;
ESP32_POWERON_RESET = 2;
ESP32_SW_RESET = 3;
ESP32_OWDT_RESET = 4;
ESP32_DEEPSLEEP_RESET = 5;
ESP32_SDIO_RESET = 6;
ESP32_TG0WDT_SYS_RESET = 7;
ESP32_TG1WDT_SYS_RESET = 8;
ESP32_RTCWDT_SYS_RESET = 9;
ESP32_INTRUSION_RESET = 10;
ESP32_TGWDT_CPU_RESET = 11;
ESP32_SW_CPU_RESET = 12;
ESP32_RTCWDT_CPU_RESET = 13;
ESP32_EXT_CPU_RESET = 14;
ESP32_RTCWDT_BROWN_OUT_RESET = 15;
ESP32_RTCWDT_RTC_RESET = 16;
}
message RPC_RESULT {
required RESULT_TYPE result = 1;
optional PIN_VALUE pin_value = 2;
required fixed32 msg_id = 200;
}
message FROM_MICRO {
oneof msg {
RPC_RESULT result = 1;
PIN_CHANGE pin_change = 2;
STARTUP_REASON startup = 3;
}
oneof data {
bytes raw = 200 [(nanopb).max_size = 64];
sfixed32 schedules_remaining = 201;
}
required fixed32 heap_usage = 21;
required fixed32 uptime_ms = 22;
}