-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathanalogin.proto
More file actions
76 lines (69 loc) · 2 KB
/
Copy pathanalogin.proto
File metadata and controls
76 lines (69 loc) · 2 KB
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
// SPDX-FileCopyrightText: 2023-2026 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries
// SPDX-License-Identifier: MIT
syntax = "proto3";
package ws.analogin;
import "sensor.proto";
/**
* BrokerToDevice message envelope
*/
message B2D {
oneof payload {
Add add = 1;
Remove remove = 2;
}
}
/**
* DeviceToBroker message envelope
*/
message D2B {
oneof payload {
Event event = 1;
}
}
/**
* SampleMode specifies the pin's sample mode.
*/
enum SampleMode {
SM_UNSPECIFIED = 0; /** Invalid Sample Mode from Broker. */
SM_TIMER = 1; /** Periodically sample the pin's value. */
SM_EVENT = 2; /** Sample the pin's value when an event occurs. */
}
/**
* Gain specifies the pin's ADC gain setting.
*/
enum Gain {
G_UNSPECIFIED = 0; /** Use platform default gain. */
G_1X = 1; /** No gain, or unity gain. */
G_2X = 2; /** Gain of 2x */
G_4X = 3; /** Gain of 4x */
G_8X = 4; /** Gain of 8x */
G_16X = 5; /** Gain of 16x */
G_32X = 6; /** Gain of 32x */
G_64X = 7; /** Gain of 64x */
G_128X = 8; /** Gain of 128x */
G_2_3X = 9; /** Gain of 2/3x (Utilized by ADS1x15) */
}
/**
* Add adds an analog input pin to the device.
*/
message Add {
string pin_name = 1; /** Name of the pin. */
float period = 2; /** Time between reads, in seconds. */
ws.sensor.Type read_mode = 3; /** Desired read mode for the pin. */
SampleMode sample_mode = 4; /** Desired sample mode for the pin. */
float ref_voltage = 5; /** Reference voltage for the pin, in volts. */
Gain gain = 6; /** Optional ADC gain setting. */
}
/**
* Remove removes an analog input pin from the device.
*/
message Remove {
string pin_name = 1; /** Name of the pin. */
}
/**
* Event contains a value, sent when an analog input pin is read.
*/
message Event {
string pin_name = 1; /** Name of the pin. */
ws.sensor.Event value = 2; /** Reading(s) from an analog input pin. */
}