Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions proto/wippersnapper/analogin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,15 @@ enum SampleMode {
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. */
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. */
}

/**
Expand Down
23 changes: 23 additions & 0 deletions proto/wippersnapper/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2026 Brent Rubell and Loren Norman for Adafruit Industries
// SPDX-License-Identifier: MIT
syntax = "proto3";
package ws.config;

/**
* Value represents a configuration value that, may be one of several types.
*/
message Value {
oneof value {
string str_value = 1;
int32 int_value = 2;
float float_value = 3;
bool bool_value = 4;
}
}

/**
* Settings represents a collection of configuration settings, where each setting is a key-value pair.
*/
message Settings {
map<string, Value> settings = 1;
}
12 changes: 7 additions & 5 deletions proto/wippersnapper/expander.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
syntax = "proto3";
package ws.expander;
import "config.proto";
import "i2c.proto";

/**
Expand All @@ -25,28 +26,29 @@ message D2B {
}

/**
* Add adds an expander to the hardware.
* Add adds an expander component to the hardware.
*/
message Add {
i2c.Add cfg_i2c = 1; /** I2C configuration for the expander. */
i2c.Add cfg_i2c = 1; /** I2C configuration for the expander. */
ws.config.Settings settings = 2; /** Additional configuration options for the expander. **/
Comment thread
brentru marked this conversation as resolved.
Outdated
}

/**
* Added represents a message from the hardware indicating an expander was added.
* Added represents a message from the hardware indicating an expander component was added.
*/
message Added {
i2c.Added response_i2c = 1; /** I2C configuration response. */
}

/**
* Remove removes an analog pin from the hardware.
* Remove removes an expander component from the hardware.
*/
message Remove {
i2c.Remove cfg_i2c = 1; /** I2C configuration for the expander to remove. */
}

/**
* Removed represents a message from the device indicating an expander was removed.
* Removed represents a message from the device indicating an expander component was removed.
*/
message Removed {
i2c.Removed response_i2c = 1; /** I2C configuration response. */
Expand Down
6 changes: 3 additions & 3 deletions proto/wippersnapper/i2c.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
syntax = "proto3";
package ws.i2c;
import "config.proto";
import "sensor.proto";

/**
Expand Down Expand Up @@ -108,11 +109,10 @@ message Descriptor {
*/
message Add {
Descriptor descriptor = 1; /** The I2c device's address and metadata. */
/** The I2c device's name, MUST MATCH the name on the JSON
* definition file on the Wippersnapper_Components repo. */
string name = 2;
string name = 2; /** The I2c device's name. **/
float period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */
map<uint32, ws.sensor.Type> types = 4; /** SI Types for each sensor on the I2c device. */
ws.config.Settings settings = 5; /** Additional device configuration options. **/
}

/**
Expand Down
Loading