1010#endif
1111
1212/* Enum definitions */
13- /* *
14- LedBackpackBlinkRate represents supported, OPTIONAL, blink rates for LED backpack displays */
15- typedef enum _wippersnapper_i2c_output_LedBackpackBlinkRate {
16- wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_UNSPECIFIED = 0 , /* * No blinking. * */
17- wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_OFF = 1 , /* * No blinking. * */
18- wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_2HZ = 2 , /* * 2 Hz blink rate. * */
19- wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_1HZ = 3 , /* * 1 Hz blink rate. * */
20- wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_HALFHZ = 4 /* * 0.5 Hz blink rate. * */
21- } wippersnapper_i2c_output_LedBackpackBlinkRate ;
22-
2313/* *
2414 LedBackpackAlignment represents all text alignment option for LED backpack displays */
2515typedef enum _wippersnapper_i2c_output_LedBackpackAlignment {
@@ -28,6 +18,14 @@ typedef enum _wippersnapper_i2c_output_LedBackpackAlignment {
2818 wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT = 2 /* * Right-aligned. * */
2919} wippersnapper_i2c_output_LedBackpackAlignment ;
3020
21+ /* *
22+ Desired OLED display text 'magnification' size. */
23+ typedef enum _wippersnapper_i2c_output_OledTextSize {
24+ wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_UNSPECIFIED = 0 , /* * Unspecified text size. * */
25+ wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_DEFAULT = 1 , /* * Default text size, 6x8px. * */
26+ wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_LARGE = 2 /* * Larger text size option, 12x16px. * */
27+ } wippersnapper_i2c_output_OledTextSize ;
28+
3129/* Struct definitions */
3230/* *
3331 LedBackpackConfig represents the configuration for a LED backpack display. */
@@ -41,96 +39,101 @@ typedef struct _wippersnapper_i2c_output_LedBackpackConfig {
4139typedef struct _wippersnapper_i2c_output_CharLCDConfig {
4240 uint32_t rows ; /* * Number of rows for the character LCD. * */
4341 uint32_t columns ; /* * Number of columns for the character LCD. * */
44- char backlight_color [15 ]; /* * Optional Backlight color for the character LCD, in Hex. * */
4542} wippersnapper_i2c_output_CharLCDConfig ;
4643
44+ /* *
45+ OledConfig represents the configuration for a OLED display. */
46+ typedef struct _wippersnapper_i2c_output_OledConfig {
47+ uint32_t width ; /* * Width of the OLED display in pixels. * */
48+ uint32_t height ; /* * Height of the OLED display in pixels. * */
49+ wippersnapper_i2c_output_OledTextSize font_size ; /* * Desired font magnification for the OLED display. Defaults to OLED_TEXT_SIZE_DEFAULT. * */
50+ } wippersnapper_i2c_output_OledConfig ;
51+
4752/* *
4853 I2cOutputAdd represents a request from the broker to add an I2C output device to a device. */
4954typedef struct _wippersnapper_i2c_output_I2cOutputAdd {
5055 pb_size_t which_config ;
5156 union {
52- wippersnapper_i2c_output_LedBackpackConfig led_backpack_config ; /* * Configuration for LED backpack. * */
53- wippersnapper_i2c_output_CharLCDConfig char_lcd_config ; /* * Configuration for character LCD. * */
57+ wippersnapper_i2c_output_LedBackpackConfig led_backpack_config ; /* * Configuration for a LED backpack. * */
58+ wippersnapper_i2c_output_CharLCDConfig char_lcd_config ; /* * Configuration for a character LCD. * */
59+ wippersnapper_i2c_output_OledConfig oled_config ; /* * Configuration for an OLED display. * */
5460 } config ;
5561} wippersnapper_i2c_output_I2cOutputAdd ;
5662
5763/* *
5864 LedBackpackWrite represents a request from the broker to write a message to a LED backpack. */
5965typedef struct _wippersnapper_i2c_output_LedBackpackWrite {
60- pb_size_t which_message ;
61- union {
62- char text [20 ]; /* * Text to write to the LED backpack. * */
63- int32_t number_int ; /* * Number to write to the LED backpack. * */
64- float number_float ; /* * Float to write to the LED backpack. * */
65- } message ;
66- bool adjust_brightness ; /* * Optionally used to enable the brightness tag. * */
67- int32_t brightness ; /* * Optionally adjusts the brightness from 0 (off) to 15 (full brightness). * */
68- wippersnapper_i2c_output_LedBackpackBlinkRate blink_rate ; /* * Optionally sets the blink rate for the LED backpack. * */
69- bool enable_scroll_marquee ; /* * Optionally enables automatic text scrolling * */
70- float scroll_marquee_speed ; /* * Speed for the scrolling marquee. * */
66+ char message [8 ]; /* * Message to write to the LED backpack. * */
7167} wippersnapper_i2c_output_LedBackpackWrite ;
7268
7369/* *
7470 CharLCDWrite represents a request from the broker to write to a character LCD. */
7571typedef struct _wippersnapper_i2c_output_CharLCDWrite {
76- char message [128 ]; /* * Message to write to the character LCD. * */
77- char backlight_color [20 ]; /* * Optional Backlight color for the character LCD, in Hex. * */
78- bool enable_scroll ; /* * Optional Enable automatic scrolling for the character LCD. * */
72+ char message [100 ]; /* * Message to write to the character LCD. * */
73+ bool enable_backlight ; /* * Whether to enable the backlight. Defaults to True. * */
7974} wippersnapper_i2c_output_CharLCDWrite ;
8075
76+ /* *
77+ OLEDWrite represents a request from the broker to write to a OLED display. */
78+ typedef struct _wippersnapper_i2c_output_OLEDWrite {
79+ char message [512 ]; /* * Message to write to an OLED display. * */
80+ } wippersnapper_i2c_output_OLEDWrite ;
81+
8182
8283#ifdef __cplusplus
8384extern "C" {
8485#endif
8586
8687/* Helper constants for enums */
87- #define _wippersnapper_i2c_output_LedBackpackBlinkRate_MIN wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_UNSPECIFIED
88- #define _wippersnapper_i2c_output_LedBackpackBlinkRate_MAX wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_HALFHZ
89- #define _wippersnapper_i2c_output_LedBackpackBlinkRate_ARRAYSIZE ((wippersnapper_i2c_output_LedBackpackBlinkRate)(wippersnapper_i2c_output_LedBackpackBlinkRate_LED_BACKPACK_BLINK_RATE_HALFHZ+1))
90-
9188#define _wippersnapper_i2c_output_LedBackpackAlignment_MIN wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_UNSPECIFIED
9289#define _wippersnapper_i2c_output_LedBackpackAlignment_MAX wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT
9390#define _wippersnapper_i2c_output_LedBackpackAlignment_ARRAYSIZE ((wippersnapper_i2c_output_LedBackpackAlignment)(wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT+1))
9491
92+ #define _wippersnapper_i2c_output_OledTextSize_MIN wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_UNSPECIFIED
93+ #define _wippersnapper_i2c_output_OledTextSize_MAX wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_LARGE
94+ #define _wippersnapper_i2c_output_OledTextSize_ARRAYSIZE ((wippersnapper_i2c_output_OledTextSize)(wippersnapper_i2c_output_OledTextSize_OLED_TEXT_SIZE_LARGE+1))
95+
9596#define wippersnapper_i2c_output_LedBackpackConfig_alignment_ENUMTYPE wippersnapper_i2c_output_LedBackpackAlignment
9697
9798
99+ #define wippersnapper_i2c_output_OledConfig_font_size_ENUMTYPE wippersnapper_i2c_output_OledTextSize
100+
101+
98102
99- #define wippersnapper_i2c_output_LedBackpackWrite_blink_rate_ENUMTYPE wippersnapper_i2c_output_LedBackpackBlinkRate
100103
101104
102105
103106/* Initializer values for message structs */
104107#define wippersnapper_i2c_output_LedBackpackConfig_init_default {0, _wippersnapper_i2c_output_LedBackpackAlignment_MIN}
105- #define wippersnapper_i2c_output_CharLCDConfig_init_default {0, 0, ""}
108+ #define wippersnapper_i2c_output_CharLCDConfig_init_default {0, 0}
109+ #define wippersnapper_i2c_output_OledConfig_init_default {0, 0, _wippersnapper_i2c_output_OledTextSize_MIN}
106110#define wippersnapper_i2c_output_I2cOutputAdd_init_default {0, {wippersnapper_i2c_output_LedBackpackConfig_init_default}}
107- #define wippersnapper_i2c_output_LedBackpackWrite_init_default {0, {""}, 0, 0, _wippersnapper_i2c_output_LedBackpackBlinkRate_MIN, 0, 0}
108- #define wippersnapper_i2c_output_CharLCDWrite_init_default {"", "", 0}
111+ #define wippersnapper_i2c_output_LedBackpackWrite_init_default {""}
112+ #define wippersnapper_i2c_output_CharLCDWrite_init_default {"", 0}
113+ #define wippersnapper_i2c_output_OLEDWrite_init_default {""}
109114#define wippersnapper_i2c_output_LedBackpackConfig_init_zero {0, _wippersnapper_i2c_output_LedBackpackAlignment_MIN}
110- #define wippersnapper_i2c_output_CharLCDConfig_init_zero {0, 0, ""}
115+ #define wippersnapper_i2c_output_CharLCDConfig_init_zero {0, 0}
116+ #define wippersnapper_i2c_output_OledConfig_init_zero {0, 0, _wippersnapper_i2c_output_OledTextSize_MIN}
111117#define wippersnapper_i2c_output_I2cOutputAdd_init_zero {0, {wippersnapper_i2c_output_LedBackpackConfig_init_zero}}
112- #define wippersnapper_i2c_output_LedBackpackWrite_init_zero {0, {""}, 0, 0, _wippersnapper_i2c_output_LedBackpackBlinkRate_MIN, 0, 0}
113- #define wippersnapper_i2c_output_CharLCDWrite_init_zero {"", "", 0}
118+ #define wippersnapper_i2c_output_LedBackpackWrite_init_zero {""}
119+ #define wippersnapper_i2c_output_CharLCDWrite_init_zero {"", 0}
120+ #define wippersnapper_i2c_output_OLEDWrite_init_zero {""}
114121
115122/* Field tags (for use in manual encoding/decoding) */
116123#define wippersnapper_i2c_output_LedBackpackConfig_brightness_tag 1
117124#define wippersnapper_i2c_output_LedBackpackConfig_alignment_tag 2
118125#define wippersnapper_i2c_output_CharLCDConfig_rows_tag 1
119126#define wippersnapper_i2c_output_CharLCDConfig_columns_tag 2
120- #define wippersnapper_i2c_output_CharLCDConfig_backlight_color_tag 3
127+ #define wippersnapper_i2c_output_OledConfig_width_tag 1
128+ #define wippersnapper_i2c_output_OledConfig_height_tag 2
129+ #define wippersnapper_i2c_output_OledConfig_font_size_tag 3
121130#define wippersnapper_i2c_output_I2cOutputAdd_led_backpack_config_tag 1
122131#define wippersnapper_i2c_output_I2cOutputAdd_char_lcd_config_tag 2
123- #define wippersnapper_i2c_output_LedBackpackWrite_text_tag 1
124- #define wippersnapper_i2c_output_LedBackpackWrite_number_int_tag 2
125- #define wippersnapper_i2c_output_LedBackpackWrite_number_float_tag 3
126- #define wippersnapper_i2c_output_LedBackpackWrite_adjust_brightness_tag 4
127- #define wippersnapper_i2c_output_LedBackpackWrite_brightness_tag 5
128- #define wippersnapper_i2c_output_LedBackpackWrite_blink_rate_tag 6
129- #define wippersnapper_i2c_output_LedBackpackWrite_enable_scroll_marquee_tag 7
130- #define wippersnapper_i2c_output_LedBackpackWrite_scroll_marquee_speed_tag 8
132+ #define wippersnapper_i2c_output_I2cOutputAdd_oled_config_tag 3
133+ #define wippersnapper_i2c_output_LedBackpackWrite_message_tag 1
131134#define wippersnapper_i2c_output_CharLCDWrite_message_tag 1
132- #define wippersnapper_i2c_output_CharLCDWrite_backlight_color_tag 2
133- #define wippersnapper_i2c_output_CharLCDWrite_enable_scroll_tag 3
135+ #define wippersnapper_i2c_output_CharLCDWrite_enable_backlight_tag 2
136+ #define wippersnapper_i2c_output_OLEDWrite_message_tag 1
134137
135138/* Struct field encoding specification for nanopb */
136139#define wippersnapper_i2c_output_LedBackpackConfig_FIELDLIST (X , a ) \
@@ -141,58 +144,69 @@ X(a, STATIC, SINGULAR, UENUM, alignment, 2)
141144
142145#define wippersnapper_i2c_output_CharLCDConfig_FIELDLIST (X , a ) \
143146X(a, STATIC, SINGULAR, UINT32, rows, 1) \
144- X(a, STATIC, SINGULAR, UINT32, columns, 2) \
145- X(a, STATIC, SINGULAR, STRING, backlight_color, 3)
147+ X(a, STATIC, SINGULAR, UINT32, columns, 2)
146148#define wippersnapper_i2c_output_CharLCDConfig_CALLBACK NULL
147149#define wippersnapper_i2c_output_CharLCDConfig_DEFAULT NULL
148150
151+ #define wippersnapper_i2c_output_OledConfig_FIELDLIST (X , a ) \
152+ X(a, STATIC, SINGULAR, UINT32, width, 1) \
153+ X(a, STATIC, SINGULAR, UINT32, height, 2) \
154+ X(a, STATIC, SINGULAR, UENUM, font_size, 3)
155+ #define wippersnapper_i2c_output_OledConfig_CALLBACK NULL
156+ #define wippersnapper_i2c_output_OledConfig_DEFAULT NULL
157+
149158#define wippersnapper_i2c_output_I2cOutputAdd_FIELDLIST (X , a ) \
150159X(a, STATIC, ONEOF, MESSAGE, (config,led_backpack_config,config.led_backpack_config), 1) \
151- X(a, STATIC, ONEOF, MESSAGE, (config,char_lcd_config,config.char_lcd_config), 2)
160+ X(a, STATIC, ONEOF, MESSAGE, (config,char_lcd_config,config.char_lcd_config), 2) \
161+ X(a, STATIC, ONEOF, MESSAGE, (config,oled_config,config.oled_config), 3)
152162#define wippersnapper_i2c_output_I2cOutputAdd_CALLBACK NULL
153163#define wippersnapper_i2c_output_I2cOutputAdd_DEFAULT NULL
154164#define wippersnapper_i2c_output_I2cOutputAdd_config_led_backpack_config_MSGTYPE wippersnapper_i2c_output_LedBackpackConfig
155165#define wippersnapper_i2c_output_I2cOutputAdd_config_char_lcd_config_MSGTYPE wippersnapper_i2c_output_CharLCDConfig
166+ #define wippersnapper_i2c_output_I2cOutputAdd_config_oled_config_MSGTYPE wippersnapper_i2c_output_OledConfig
156167
157168#define wippersnapper_i2c_output_LedBackpackWrite_FIELDLIST (X , a ) \
158- X(a, STATIC, ONEOF, STRING, (message,text,message.text), 1) \
159- X(a, STATIC, ONEOF, INT32, (message,number_int,message.number_int), 2) \
160- X(a, STATIC, ONEOF, FLOAT, (message,number_float,message.number_float), 3) \
161- X(a, STATIC, SINGULAR, BOOL, adjust_brightness, 4) \
162- X(a, STATIC, SINGULAR, INT32, brightness, 5) \
163- X(a, STATIC, SINGULAR, UENUM, blink_rate, 6) \
164- X(a, STATIC, SINGULAR, BOOL, enable_scroll_marquee, 7) \
165- X(a, STATIC, SINGULAR, FLOAT, scroll_marquee_speed, 8)
169+ X(a, STATIC, SINGULAR, STRING, message, 1)
166170#define wippersnapper_i2c_output_LedBackpackWrite_CALLBACK NULL
167171#define wippersnapper_i2c_output_LedBackpackWrite_DEFAULT NULL
168172
169173#define wippersnapper_i2c_output_CharLCDWrite_FIELDLIST (X , a ) \
170174X(a, STATIC, SINGULAR, STRING, message, 1) \
171- X(a, STATIC, SINGULAR, STRING, backlight_color, 2) \
172- X(a, STATIC, SINGULAR, BOOL, enable_scroll, 3)
175+ X(a, STATIC, SINGULAR, BOOL, enable_backlight, 2)
173176#define wippersnapper_i2c_output_CharLCDWrite_CALLBACK NULL
174177#define wippersnapper_i2c_output_CharLCDWrite_DEFAULT NULL
175178
179+ #define wippersnapper_i2c_output_OLEDWrite_FIELDLIST (X , a ) \
180+ X(a, STATIC, SINGULAR, STRING, message, 1)
181+ #define wippersnapper_i2c_output_OLEDWrite_CALLBACK NULL
182+ #define wippersnapper_i2c_output_OLEDWrite_DEFAULT NULL
183+
176184extern const pb_msgdesc_t wippersnapper_i2c_output_LedBackpackConfig_msg ;
177185extern const pb_msgdesc_t wippersnapper_i2c_output_CharLCDConfig_msg ;
186+ extern const pb_msgdesc_t wippersnapper_i2c_output_OledConfig_msg ;
178187extern const pb_msgdesc_t wippersnapper_i2c_output_I2cOutputAdd_msg ;
179188extern const pb_msgdesc_t wippersnapper_i2c_output_LedBackpackWrite_msg ;
180189extern const pb_msgdesc_t wippersnapper_i2c_output_CharLCDWrite_msg ;
190+ extern const pb_msgdesc_t wippersnapper_i2c_output_OLEDWrite_msg ;
181191
182192/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
183193#define wippersnapper_i2c_output_LedBackpackConfig_fields &wippersnapper_i2c_output_LedBackpackConfig_msg
184194#define wippersnapper_i2c_output_CharLCDConfig_fields &wippersnapper_i2c_output_CharLCDConfig_msg
195+ #define wippersnapper_i2c_output_OledConfig_fields &wippersnapper_i2c_output_OledConfig_msg
185196#define wippersnapper_i2c_output_I2cOutputAdd_fields &wippersnapper_i2c_output_I2cOutputAdd_msg
186197#define wippersnapper_i2c_output_LedBackpackWrite_fields &wippersnapper_i2c_output_LedBackpackWrite_msg
187198#define wippersnapper_i2c_output_CharLCDWrite_fields &wippersnapper_i2c_output_CharLCDWrite_msg
199+ #define wippersnapper_i2c_output_OLEDWrite_fields &wippersnapper_i2c_output_OLEDWrite_msg
188200
189201/* Maximum encoded size of messages (where known) */
190- #define WIPPERSNAPPER_I2C_OUTPUT_I2C_OUTPUT_PB_H_MAX_SIZE wippersnapper_i2c_output_CharLCDWrite_size
191- #define wippersnapper_i2c_output_CharLCDConfig_size 28
192- #define wippersnapper_i2c_output_CharLCDWrite_size 153
193- #define wippersnapper_i2c_output_I2cOutputAdd_size 30
202+ #define WIPPERSNAPPER_I2C_OUTPUT_I2C_OUTPUT_PB_H_MAX_SIZE wippersnapper_i2c_output_OLEDWrite_size
203+ #define wippersnapper_i2c_output_CharLCDConfig_size 12
204+ #define wippersnapper_i2c_output_CharLCDWrite_size 103
205+ #define wippersnapper_i2c_output_I2cOutputAdd_size 16
194206#define wippersnapper_i2c_output_LedBackpackConfig_size 13
195- #define wippersnapper_i2c_output_LedBackpackWrite_size 43
207+ #define wippersnapper_i2c_output_LedBackpackWrite_size 9
208+ #define wippersnapper_i2c_output_OLEDWrite_size 514
209+ #define wippersnapper_i2c_output_OledConfig_size 14
196210
197211#ifdef __cplusplus
198212} /* extern "C" */
0 commit comments