diff --git a/proto/wippersnapper/analogin.proto b/proto/wippersnapper/analogin.proto index 8983ab6..eb66175 100644 --- a/proto/wippersnapper/analogin.proto +++ b/proto/wippersnapper/analogin.proto @@ -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. */ } /** diff --git a/proto/wippersnapper/config.proto b/proto/wippersnapper/config.proto new file mode 100644 index 0000000..70753ac --- /dev/null +++ b/proto/wippersnapper/config.proto @@ -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 settings = 1; +} \ No newline at end of file diff --git a/proto/wippersnapper/expander.proto b/proto/wippersnapper/expander.proto index 5d5bd4d..d912f32 100644 --- a/proto/wippersnapper/expander.proto +++ b/proto/wippersnapper/expander.proto @@ -25,28 +25,28 @@ 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. */ } /** -* 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. */ diff --git a/proto/wippersnapper/i2c.proto b/proto/wippersnapper/i2c.proto index 733a532..fffd3f7 100644 --- a/proto/wippersnapper/i2c.proto +++ b/proto/wippersnapper/i2c.proto @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MIT syntax = "proto3"; package ws.i2c; +import "config.proto"; import "sensor.proto"; /** @@ -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 types = 4; /** SI Types for each sensor on the I2c device. */ + ws.config.Settings settings = 5; /** Additional device configuration options. **/ } /**