Merge pull request #144 from adafruit/add-i2c-output
[v1] Support I2C Output Components
This commit is contained in:
commit
e1d92010c2
2 changed files with 99 additions and 1 deletions
|
|
@ -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";
|
||||
|
||||
|
|
@ -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. */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -205,3 +207,98 @@ 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, 6x8px. **/
|
||||
SSD1306_TEXT_SIZE_2 = 2; /** Larger text size option, 12x16px. **/
|
||||
}
|
||||
|
||||
/**
|
||||
* 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. **/
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue