-
Notifications
You must be signed in to change notification settings - Fork 0
/
adc.proto
131 lines (110 loc) · 2.3 KB
/
adc.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
/* Protouf file for the ADC SDK module */
syntax = "proto3";
package EdgePiRPC_ADC;
option py_generic_services = true;
service AdcService{
rpc set_config(Config) returns(SuccessMsg);
rpc single_sample(EmptyMsg) returns(VoltageRead);
rpc select_differential(DiffConfig) returns(SuccessMsg);
rpc set_rtd(RtdConfig) returns(SuccessMsg);
rpc single_sample_rtd(EmptyMsg) returns(TempReading);
rpc start_conversions(ADC) returns (SuccessMsg);
rpc stop_conversions(ADC) returns (SuccessMsg);
rpc read_voltage(ADC) returns (VoltageRead);
rpc read_rtd_temperature(EmptyMsg) returns (TempReading);
}
message EmptyMsg {
// Empty Message
}
message SuccessMsg {
optional string content = 1;
}
message VoltageRead {
optional float voltage_read = 1;
}
message Config {
repeated ConfArg conf_arg = 1;
message ConfArg{
oneof enum{
AnalogIn adc_1_analog_in = 2;
ADC1DataRate adc_1_data_rate = 3;
AnalogIn adc_2_analog_in = 4;
ADC2DataRate adc_2_data_rate = 5;
FilterMode filter_mode = 6;
ConvMode conversion_mode = 7;
bool override_updates_validation = 8;
}
}
}
message DiffConfig {
optional ADCNum adc_num = 1;
optional DiffMode diff = 2;
}
message RtdConfig {
optional bool set_rtd = 1;
optional ADCNum adc_num = 2;
}
message TempReading {
optional float temp = 1;
}
message ADC {
optional ADCNum adc_num = 1;
}
enum AnalogIn {
AIN1 = 0;
AIN2 = 1;
AIN3 = 2;
AIN4 = 3;
AIN5 = 4;
AIN6 = 5;
AIN7 = 6;
AIN8 = 7;
AINCOM = 8;
FLOAT = 9;
}
enum ADC1DataRate {
SPS_2P5 = 0;
SPS_5 = 1;
SPS_10_ = 2;
SPS_16P6 = 3;
SPS_20 = 4;
SPS_50 = 5;
SPS_60 = 6;
SPS_100_ = 7;
SPS_400_ = 8;
SPS_1200 = 9;
SPS_2400 = 10;
SPS_4800 = 11;
SPS_7200 = 12;
SPS_14400 = 13;
SPS_19200 = 14;
SPS_38400 = 15;
}
enum ADC2DataRate {
SPS_10 = 0;
SPS_100 = 1;
SPS_400 = 3;
SPS_800 = 4;
}
enum FilterMode {
SINC1 = 0;
SINC2 = 1;
SINC3 = 2;
SINC4 = 3;
FIR = 4;
}
enum ConvMode {
CONTINUOUS = 0;
PULSE = 1;
}
enum ADCNum {
ADC_1 = 0;
ADC_2 = 1;
}
enum DiffMode {
DIFF_1 = 0;
DIFF_2 = 1;
DIFF_3 = 2;
DIFF_4 = 3;
DIFF_OFF = 4;
}