10
10
#endif
11
11
12
12
/* 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
-
23
13
/* *
24
14
LedBackpackAlignment represents all text alignment option for LED backpack displays */
25
15
typedef enum _wippersnapper_i2c_output_LedBackpackAlignment {
@@ -28,6 +18,14 @@ typedef enum _wippersnapper_i2c_output_LedBackpackAlignment {
28
18
wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT = 2 /* * Right-aligned. * */
29
19
} wippersnapper_i2c_output_LedBackpackAlignment ;
30
20
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
+
31
29
/* Struct definitions */
32
30
/* *
33
31
LedBackpackConfig represents the configuration for a LED backpack display. */
@@ -41,96 +39,101 @@ typedef struct _wippersnapper_i2c_output_LedBackpackConfig {
41
39
typedef struct _wippersnapper_i2c_output_CharLCDConfig {
42
40
uint32_t rows ; /* * Number of rows for the character LCD. * */
43
41
uint32_t columns ; /* * Number of columns for the character LCD. * */
44
- char backlight_color [15 ]; /* * Optional Backlight color for the character LCD, in Hex. * */
45
42
} wippersnapper_i2c_output_CharLCDConfig ;
46
43
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
+
47
52
/* *
48
53
I2cOutputAdd represents a request from the broker to add an I2C output device to a device. */
49
54
typedef struct _wippersnapper_i2c_output_I2cOutputAdd {
50
55
pb_size_t which_config ;
51
56
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. * */
54
60
} config ;
55
61
} wippersnapper_i2c_output_I2cOutputAdd ;
56
62
57
63
/* *
58
64
LedBackpackWrite represents a request from the broker to write a message to a LED backpack. */
59
65
typedef 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. * */
71
67
} wippersnapper_i2c_output_LedBackpackWrite ;
72
68
73
69
/* *
74
70
CharLCDWrite represents a request from the broker to write to a character LCD. */
75
71
typedef 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. * */
79
74
} wippersnapper_i2c_output_CharLCDWrite ;
80
75
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
+
81
82
82
83
#ifdef __cplusplus
83
84
extern "C" {
84
85
#endif
85
86
86
87
/* 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
-
91
88
#define _wippersnapper_i2c_output_LedBackpackAlignment_MIN wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_UNSPECIFIED
92
89
#define _wippersnapper_i2c_output_LedBackpackAlignment_MAX wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT
93
90
#define _wippersnapper_i2c_output_LedBackpackAlignment_ARRAYSIZE ((wippersnapper_i2c_output_LedBackpackAlignment)(wippersnapper_i2c_output_LedBackpackAlignment_LED_BACKPACK_ALIGNMENT_RIGHT+1))
94
91
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
+
95
96
#define wippersnapper_i2c_output_LedBackpackConfig_alignment_ENUMTYPE wippersnapper_i2c_output_LedBackpackAlignment
96
97
97
98
99
+ #define wippersnapper_i2c_output_OledConfig_font_size_ENUMTYPE wippersnapper_i2c_output_OledTextSize
100
+
101
+
98
102
99
- #define wippersnapper_i2c_output_LedBackpackWrite_blink_rate_ENUMTYPE wippersnapper_i2c_output_LedBackpackBlinkRate
100
103
101
104
102
105
103
106
/* Initializer values for message structs */
104
107
#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}
106
110
#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 {""}
109
114
#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}
111
117
#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 {""}
114
121
115
122
/* Field tags (for use in manual encoding/decoding) */
116
123
#define wippersnapper_i2c_output_LedBackpackConfig_brightness_tag 1
117
124
#define wippersnapper_i2c_output_LedBackpackConfig_alignment_tag 2
118
125
#define wippersnapper_i2c_output_CharLCDConfig_rows_tag 1
119
126
#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
121
130
#define wippersnapper_i2c_output_I2cOutputAdd_led_backpack_config_tag 1
122
131
#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
131
134
#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
134
137
135
138
/* Struct field encoding specification for nanopb */
136
139
#define wippersnapper_i2c_output_LedBackpackConfig_FIELDLIST (X , a ) \
@@ -141,58 +144,69 @@ X(a, STATIC, SINGULAR, UENUM, alignment, 2)
141
144
142
145
#define wippersnapper_i2c_output_CharLCDConfig_FIELDLIST (X , a ) \
143
146
X(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)
146
148
#define wippersnapper_i2c_output_CharLCDConfig_CALLBACK NULL
147
149
#define wippersnapper_i2c_output_CharLCDConfig_DEFAULT NULL
148
150
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
+
149
158
#define wippersnapper_i2c_output_I2cOutputAdd_FIELDLIST (X , a ) \
150
159
X(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)
152
162
#define wippersnapper_i2c_output_I2cOutputAdd_CALLBACK NULL
153
163
#define wippersnapper_i2c_output_I2cOutputAdd_DEFAULT NULL
154
164
#define wippersnapper_i2c_output_I2cOutputAdd_config_led_backpack_config_MSGTYPE wippersnapper_i2c_output_LedBackpackConfig
155
165
#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
156
167
157
168
#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)
166
170
#define wippersnapper_i2c_output_LedBackpackWrite_CALLBACK NULL
167
171
#define wippersnapper_i2c_output_LedBackpackWrite_DEFAULT NULL
168
172
169
173
#define wippersnapper_i2c_output_CharLCDWrite_FIELDLIST (X , a ) \
170
174
X(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)
173
176
#define wippersnapper_i2c_output_CharLCDWrite_CALLBACK NULL
174
177
#define wippersnapper_i2c_output_CharLCDWrite_DEFAULT NULL
175
178
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
+
176
184
extern const pb_msgdesc_t wippersnapper_i2c_output_LedBackpackConfig_msg ;
177
185
extern const pb_msgdesc_t wippersnapper_i2c_output_CharLCDConfig_msg ;
186
+ extern const pb_msgdesc_t wippersnapper_i2c_output_OledConfig_msg ;
178
187
extern const pb_msgdesc_t wippersnapper_i2c_output_I2cOutputAdd_msg ;
179
188
extern const pb_msgdesc_t wippersnapper_i2c_output_LedBackpackWrite_msg ;
180
189
extern const pb_msgdesc_t wippersnapper_i2c_output_CharLCDWrite_msg ;
190
+ extern const pb_msgdesc_t wippersnapper_i2c_output_OLEDWrite_msg ;
181
191
182
192
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
183
193
#define wippersnapper_i2c_output_LedBackpackConfig_fields &wippersnapper_i2c_output_LedBackpackConfig_msg
184
194
#define wippersnapper_i2c_output_CharLCDConfig_fields &wippersnapper_i2c_output_CharLCDConfig_msg
195
+ #define wippersnapper_i2c_output_OledConfig_fields &wippersnapper_i2c_output_OledConfig_msg
185
196
#define wippersnapper_i2c_output_I2cOutputAdd_fields &wippersnapper_i2c_output_I2cOutputAdd_msg
186
197
#define wippersnapper_i2c_output_LedBackpackWrite_fields &wippersnapper_i2c_output_LedBackpackWrite_msg
187
198
#define wippersnapper_i2c_output_CharLCDWrite_fields &wippersnapper_i2c_output_CharLCDWrite_msg
199
+ #define wippersnapper_i2c_output_OLEDWrite_fields &wippersnapper_i2c_output_OLEDWrite_msg
188
200
189
201
/* 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
194
206
#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
196
210
197
211
#ifdef __cplusplus
198
212
} /* extern "C" */
0 commit comments