Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
100 changes: 99 additions & 1 deletion proto/wippersnapper/i2c/v1/i2c.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
// SPDX-FileCopyrightText: 2021-2025 Brent Rubell for Adafruit Industries
// SPDX-License-Identifier: MIT
syntax = "proto3";

Expand Down Expand Up @@ -93,6 +93,8 @@ message I2CDeviceInitRequest {
uint32 i2c_device_address = 3; /** The 7-bit I2C address of the device on the bus. */
string i2c_device_name = 4[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */
repeated I2CDeviceSensorProperties i2c_device_properties = 5[(nanopb).max_count = 15]; /** Properties of each sensor on the I2C device. */
bool is_output_device = 6; /** True if the I2C device is an i2c output device, False otherwise (default). */
I2cOutputAdd i2c_output_add = 7; /** The configuration for an I2C output device. */
}

/**
Expand Down Expand Up @@ -205,3 +207,99 @@ message I2CDeviceEvent {
uint32 sensor_address = 1; /** The 7-bit I2C address of the I2C device. */
repeated SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */
}

/**
* I2cDeviceOutputWrite represents a request to write to an I2C output device.
* NOTE: This message is similar to the I2CDeviceOutputWrite message on
* the api-v2 branch but NOT identical.
*/
message I2CDeviceOutputWrite {
uint32 i2c_device_address = 1; /** The 7-bit I2C address of the device on the bus. */
string i2c_device_name = 2[(nanopb).max_size = 15]; /** The I2C device's name, MUST MATCH the name on the JSON definition file on https://github.com/adafruit/Wippersnapper_Components. */
oneof output_msg {
LedBackpackWrite write_led_backpack = 3; /** Optional - If the I2C device is a LED backpack, fill this field. **/
CharLcdWrite write_char_lcd = 4; /** Optional - If the I2C device is a character LCD, fill this field. **/
Ssd1306Write write_ssd1306 = 5; /** Optional - If the I2C device is a SSD1306 OLED display, fill this field. **/
}
}

///*** I2C Output Device Messages (from i2c_output.proto in api v2) ***///

/**
* LedBackpackAlignment represents all text alignment
* options for LED backpack displays
*/
enum LedBackpackAlignment {
LED_BACKPACK_ALIGNMENT_UNSPECIFIED = 0; /** Unspecified alignment option. **/
LED_BACKPACK_ALIGNMENT_LEFT = 1; /** (Default) Left-aligned. **/
LED_BACKPACK_ALIGNMENT_RIGHT = 2; /** Right-aligned. **/
}

/**
* Desired SSD1306 text 'magnification' size.
*/
enum Ssd1306TextSize {
SSD1306_TEXT_SIZE_UNSPECIFIED = 0; /** Unspecified text size. **/
SSD1306_TEXT_SIZE_1 = 1; /** Default text size. 6x8. **/
SSD1306_TEXT_SIZE_2 = 2; /** Text size 2. 12x16. **/
SSD1306_TEXT_SIZE_3 = 3; /** Text size 3. 18x24. **/
}

/**
* LedBackpackConfig represents the configuration for a LED backpack display.
*/
message LedBackpackConfig {
int32 brightness = 1; /** Desired brightness of the LED backpack, from 0 (off) to 15 (full brightness). **/
LedBackpackAlignment alignment = 2; /** Desired text alignment for the LED backpack. **/
}

/**
* CharLcdConfig represents the configuration for a character LCD display.
*/
message CharLcdConfig {
uint32 rows = 1; /** Number of rows for the character LCD. **/
uint32 columns = 2; /** Number of columns for the character LCD. **/
}

/**
* Ssd1306Config represents the configuration for a SSD1306 OLED display.
*/
message Ssd1306Config {
uint32 width = 1; /** Width of the display. **/
uint32 height = 2; /** Height of the display. **/
Ssd1306TextSize text_size = 3; /** Desired text 'magnification' size. **/
}

/**
* I2cOutputAdd represents a request from the broker to add an I2C output device to a device.
*/
message I2cOutputAdd {
oneof config {
LedBackpackConfig led_backpack_config = 1; /** Configuration for LED backpack. **/
CharLcdConfig char_lcd_config = 2; /** Configuration for character LCD. **/
Ssd1306Config ssd1306_config = 3; /** Configuration for SSD1306 OLED display. **/
}
}

/**
* LedBackpackWrite represents a request from the broker to write a message to a LED backpack.
*/
message LedBackpackWrite {
string message = 1 [(nanopb).max_size = 5]; /** Message to write to the LED backpack. **/
}

/**
* CharLcdWrite represents a request from the broker to write to a character LCD.
*/
message CharLcdWrite {
string message = 1 [(nanopb).max_size = 128]; /** Message to write to the character LCD. **/
bool enable_backlight = 2; /** Optional field to enable/disable the backlight. Should be its own feed (0 is off, 1 is on).**/
}

/**
* Ssd1306Write represents a request from the broker to
* write to a SSD1306 OLED display.
*/
message Ssd1306Write {
string message = 1 [(nanopb).max_size = 128]; /** Message to write to a SSD1306 OLED display. **/
}
1 change: 1 addition & 0 deletions proto/wippersnapper/signal/v1/signal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ message I2CRequest {
wippersnapper.i2c.v1.I2CDeviceDeinitRequest req_i2c_device_deinit = 5;
wippersnapper.i2c.v1.I2CDeviceUpdateRequest req_i2c_device_update = 6;
wippersnapper.i2c.v1.I2CDeviceInitRequests req_i2c_device_init_requests = 7;
wippersnapper.i2c.v1.I2CDeviceOutputWrite req_i2c_device_out_write = 8;
}
}

Expand Down