Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/generate-local-arduino-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
cd protobuf-checkout/
mkdir ./arduino_out
protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v
protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-v --experimental_allow_proto3_optional
# Local (non-CI) build command is commented out below, use this to compile on your machine:
# protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t
- name: Checkout Arduino Repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protoc-wrapper-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
run: |
mkdir ./arduino_out
protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t
protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t --experimental_allow_proto3_optional
# Local (non-CI) build command is commented out below, use this to compile on your machine:
# protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t
- name: Checkout Arduino Repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-wrapper-arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
run: |
mkdir ./arduino_out
protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t
protoc --plugin=protobuf-checkout/nanopb/generator/protoc-gen-nanopb --proto_path=./protobuf-checkout/proto/wippersnapper --proto_path=nanopb/generator/proto ./protobuf-checkout/proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t --experimental_allow_proto3_optional
# Local (non-CI) build command is commented out below, use this to compile on your machine:
# protoc --plugin=nanopb/generator/protoc-gen-nanopb --proto_path=./proto/wippersnapper --proto_path=nanopb/generator/proto ./proto/wippersnapper/*.proto --nanopb_out=./arduino_out --nanopb_opt=-I./proto/wippersnapper --nanopb_opt=-t
- name: Checkout Arduino Repo
Expand Down
16 changes: 10 additions & 6 deletions proto/wippersnapper/analogio.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@
// SPDX-License-Identifier: MIT
syntax = "proto3";
package wippersnapper.analogio;
import "i2c.proto";
import "sensor.proto";

/**
* AnalogIOAdd adds an analog pin to the device.
*/
message AnalogIOAdd {
string pin_name = 1; /** Name of the pin. */
float period = 2; /** Time between reads, in seconds. */
wippersnapper.sensor.SensorType read_mode = 3; /** Desired read mode for the pin. */
string pin_name = 1; /** Name of the pin. */
float period = 2; /** Time between reads, in seconds. */
wippersnapper.sensor.SensorType read_mode = 3; /** Desired read mode for the pin. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 4; /** The I2C device/mux's address and related metadata. */
}

/**
* AnalogIORemove removes an analog pin from the device.
*/
message AnalogIORemove {
string pin_name = 1; /** Name of the pin. */
string pin_name = 1; /** Name of the pin. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 2; /** The I2C device/mux's address and related metadata. */
}


/**
* AnalogIOEvent is contains a value, sent when an analog pin is read.
*/
message AnalogIOEvent {
string pin_name = 1; /** Name of the pin. */
wippersnapper.sensor.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */
string pin_name = 1; /** Name of the pin. */
wippersnapper.sensor.SensorEvent sensor_event = 2; /** Reading(s) from an analog pin. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}
25 changes: 15 additions & 10 deletions proto/wippersnapper/digitalio.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
syntax = "proto3";
package wippersnapper.digitalio;
import "i2c.proto";
import "sensor.proto";

/**
Expand All @@ -27,32 +28,36 @@ enum DigitalIODirection {
* DigitalIOAdd adds a digital pin to the device.
*/
message DigitalIOAdd {
string pin_name = 1; /** The pin's name. */
DigitalIODirection gpio_direction = 2; /** The pin's direction. */
DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */
float period = 4; /** Time between measurements in seconds, if MODE_TIMER. */
bool value = 5; /** Re-sync only - send the pin's value. */
string pin_name = 1; /** The pin's name. */
DigitalIODirection gpio_direction = 2; /** The pin's direction. */
DigitalIOSampleMode sample_mode = 3; /** Specifies the pin's sample mode. */
float period = 4; /** Time between measurements in seconds, if MODE_TIMER. */
bool value = 5; /** Re-sync only - send the pin's value. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 6; /** The I2C device/mux's address and related metadata. */
}

/**
* DigitalIORemove removes a digital pin from the device.
*/
message DigitalIORemove {
string pin_name = 1; /** The pin's name. */
string pin_name = 1; /** The pin's name. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 2; /** The I2C device/mux's address and related metadata. */
}

/**
* DigitalIOEvent is sent from the device to the broker when a digital pin's value changes.
*/
message DigitalIOEvent {
string pin_name = 1; /** The pin's name. */
wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */
string pin_name = 1; /** The pin's name. */
wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}

/**
* DigitalIOWrite writes a boolean value to a digital pin.
*/
message DigitalIOWrite {
string pin_name = 1; /** The pin's name. */
wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */
string pin_name = 1; /** The pin's name. */
wippersnapper.sensor.SensorEvent value = 2; /** The pin's value. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}
23 changes: 14 additions & 9 deletions proto/wippersnapper/ds18x20.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// WipperSnapper's Protobuf communication API for DS18X20 Maxim Temperature ICs
syntax = "proto3";
package wippersnapper.ds18x20;
import "i2c.proto";
import "sensor.proto";

/**
Expand All @@ -11,33 +12,37 @@ import "sensor.proto";
* NOTE: This API currently only supports ONE device per OneWire bus.
*/
message Ds18x20Add {
string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */
int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */
float period = 3; /** The desired period to read the sensor, in seconds. */
repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI types used by the DS18x20 sensor. */
string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */
int32 sensor_resolution = 2; /** The desired sensor resolution (9, 10, 11, or 12 bits). */
float period = 3; /** The desired period to read the sensor, in seconds. */
repeated wippersnapper.sensor.SensorType sensor_types = 4; /** SI types used by the DS18x20 sensor. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 5; /** The I2C device/mux's address and related metadata. */
}

/**
* Ds18x20AddDs18x20AddedResponse represents a device's response
* to a Ds18x20Add message.
*/
message Ds18x20Added {
bool is_initialized = 1; /** True if the 1-wire bus has been initialized successfully, False otherwise. */
string onewire_pin = 2; /** The pin being used as a OneWire bus. */
bool is_initialized = 1; /** True if the 1-wire bus has been initialized successfully, False otherwise. */
string onewire_pin = 2; /** The pin being used as a OneWire bus. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}

/**
* Ds18x20Remove represents a to de-initialize a DS18X20
* Maxim temperature sensor, from the broker.
*/
message Ds18x20Remove {
string onewire_pin = 1; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */
string onewire_pin = 1; /** The desired onewire bus to de-initialize a DS18x sensor on and release. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 2; /** The I2C device/mux's address and related metadata. */
}

/**
* Ds18x20Event event represents data from **one** DS18X20 sensor.
*/
message Ds18x20Event {
string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */
repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** The DS18X20's SensorEvent. */
string onewire_pin = 1; /** The desired pin to use as a OneWire bus. */
repeated wippersnapper.sensor.SensorEvent sensor_events = 2; /** The DS18X20's SensorEvent. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}
1 change: 1 addition & 0 deletions proto/wippersnapper/i2c.options
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
wippersnapper.i2c.I2cBusScanned.i2c_bus_found_devices max_count:120
wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_name max_size:15
wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_sensor_types max_count:15
wippersnapper.i2c.I2cDeviceAddOrReplace.i2c_device_properties max_count:20
wippersnapper.i2c.I2cDeviceEvent.i2c_device_events max_count:15
11 changes: 6 additions & 5 deletions proto/wippersnapper/i2c.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ message I2cDeviceDescriptor {
* I2cDeviceAddOrReplace is a message for initializing (or replacing/updating) an i2c device.
*/
message I2cDeviceAddOrReplace {
I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */
string i2c_device_name = 2; /** The I2c device's name, MUST MATCH the name on the JSON definition file on
https://github.com/adafruit/Wippersnapper_Components. */
float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */
repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */
I2cDeviceDescriptor i2c_device_description = 1; /** The I2c device's address and metadata. */
string i2c_device_name = 2; /** The I2c device's name, MUST MATCH the name on the JSON definition file
on https://github.com/adafruit/Wippersnapper_Components. */
float i2c_device_period = 3; /** The desired period to update the I2c device's sensor(s), in seconds. */
repeated wippersnapper.sensor.SensorType i2c_device_sensor_types = 4; /** SI Types for each sensor on the I2c device. */
repeated wippersnapper.sensor.SensorProperty i2c_device_properties = 5; /** Custom Properties for the I2c device. */
}

/**
Expand Down
30 changes: 18 additions & 12 deletions proto/wippersnapper/pixels.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Addressable Pixels API for Adafruit WipperSnapper
syntax = "proto3";
package wippersnapper.pixels;
import "i2c.proto";

/**
* PixelsType defines the type/model of pixel strand.
Expand Down Expand Up @@ -34,37 +35,42 @@ enum PixelsOrder {
* Initial brightness is always 128.
*/
message PixelsAdd {
PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */
uint32 pixels_num = 2; /** Number of pixels attached to strand. */
PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */
uint32 pixels_brightness = 4; /** Strand brightness, 0 to 255 */
string pixels_pin_data = 5; /** Data pin a NeoPixel or DotStar strand is connected to. */
string pixels_pin_dotstar_clock = 6; /** Clock pin a DotStar strand is connected to. */
PixelsType pixels_type = 1; /** Defines the model/type of pixel strand */
uint32 pixels_num = 2; /** Number of pixels attached to strand. */
PixelsOrder pixels_ordering = 3; /** Defines the pixel strand's color ordering. */
uint32 pixels_brightness = 4; /** Strand brightness, 0 to 255 */
string pixels_pin_data = 5; /** Data pin a NeoPixel or DotStar strand is connected to. */
string pixels_pin_dotstar_clock = 6; /** Clock pin a DotStar strand is connected to. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 7; /** The I2C device/mux's address and related metadata. */
}

/**
* PixelsAdded represents response from a WipperSnapper
* device to IO after a PixelsAdd call
*/
message PixelsAdded {
bool is_success = 1; /** True if the strand initialized successfully, False otherwise. */
string pixels_pin_data = 2; /** Data pin the responding strand is connected to. */
bool is_success = 1; /** True if the strand initialized successfully, False otherwise. */
string pixels_pin_data = 2; /** Data pin the responding strand is connected to. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}

/**
* PixelAdd represents a call from IO to a device
* Removes a strand of addressable pixels and release the resources and pin.
*/
message PixelsRemove {
string pixels_pin_data = 1; /** Data pin the pixel strand is connected to. */
string pixels_pin_data = 1; /** Data pin the pixel strand is connected to. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 2; /** The I2C device/mux's address and related metadata. */
}

/**
* PixelsWrite represents a call from IO to a device.
* Writes to a strand of pixels.
*/
message PixelsWrite {
string pixels_pin_data = 1; /** Data pin a strand is connected to. */
uint32 pixels_color = 2; /* 32-bit color value. Most significant byte is white (for RGBW pixels) or ignored (for RGB pixels),
next is red, then green, and least significant byte is blue. */
string pixels_pin_data = 1; /** Data pin a strand is connected to. */
uint32 pixels_color = 2; /* 32-bit color value. Most significant byte is white
(for RGBW pixels) or ignored (for RGB pixels), next is red,
then green, and least significant byte is blue. */
optional wippersnapper.i2c.I2cDeviceDescriptor i2c_device = 3; /** The I2C device/mux's address and related metadata. */
}
8 changes: 8 additions & 0 deletions proto/wippersnapper/sensor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ message SensorEvent {
float pitch = 2; /** The sensor's pitch value as a float. */
float heading = 3; /** The sensor's heading value as a float. */
}
}

/**
* SensorProperty is used to receive a sensor's custom properties.
*/
message SensorProperty {
string key = 1; /** The property's key. */
string value = 2; /** The property's value. Possibly switch value to oneOf float/string/bool/bytes? */
}
Loading
Loading