|
|
@@ -14,14 +14,6 @@ typedef struct _PB_RequestState {
|
|
|
char dummy_field;
|
|
|
} PB_RequestState;
|
|
|
|
|
|
-typedef struct _PB_SmartKnobConfig {
|
|
|
- char dummy_field;
|
|
|
-} PB_SmartKnobConfig;
|
|
|
-
|
|
|
-typedef struct _PB_SmartKnobState {
|
|
|
- char dummy_field;
|
|
|
-} PB_SmartKnobState;
|
|
|
-
|
|
|
typedef struct _PB_Ack {
|
|
|
uint32_t nonce;
|
|
|
} PB_Ack;
|
|
|
@@ -30,6 +22,23 @@ typedef struct _PB_Log {
|
|
|
char msg[256];
|
|
|
} PB_Log;
|
|
|
|
|
|
+typedef struct _PB_SmartKnobConfig {
|
|
|
+ int32_t num_positions;
|
|
|
+ int32_t position;
|
|
|
+ float position_width_radians;
|
|
|
+ float detent_strength_unit;
|
|
|
+ float endstop_strength_unit;
|
|
|
+ float snap_point;
|
|
|
+ char text[51];
|
|
|
+} PB_SmartKnobConfig;
|
|
|
+
|
|
|
+typedef struct _PB_SmartKnobState {
|
|
|
+ int32_t current_position;
|
|
|
+ float sub_position_unit;
|
|
|
+ bool has_config;
|
|
|
+ PB_SmartKnobConfig config;
|
|
|
+} PB_SmartKnobState;
|
|
|
+
|
|
|
/* Message TO the Smartknob from the USB host */
|
|
|
typedef struct _PB_ToSmartknob {
|
|
|
uint32_t nonce;
|
|
|
@@ -59,21 +68,31 @@ extern "C" {
|
|
|
#define PB_FromSmartKnob_init_default {0, {PB_Ack_init_default}}
|
|
|
#define PB_Ack_init_default {0}
|
|
|
#define PB_Log_init_default {""}
|
|
|
-#define PB_SmartKnobState_init_default {0}
|
|
|
+#define PB_SmartKnobState_init_default {0, 0, false, PB_SmartKnobConfig_init_default}
|
|
|
#define PB_ToSmartknob_init_default {0, 0, {PB_RequestState_init_default}}
|
|
|
-#define PB_SmartKnobConfig_init_default {0}
|
|
|
+#define PB_SmartKnobConfig_init_default {0, 0, 0, 0, 0, 0, ""}
|
|
|
#define PB_RequestState_init_default {0}
|
|
|
#define PB_FromSmartKnob_init_zero {0, {PB_Ack_init_zero}}
|
|
|
#define PB_Ack_init_zero {0}
|
|
|
#define PB_Log_init_zero {""}
|
|
|
-#define PB_SmartKnobState_init_zero {0}
|
|
|
+#define PB_SmartKnobState_init_zero {0, 0, false, PB_SmartKnobConfig_init_zero}
|
|
|
#define PB_ToSmartknob_init_zero {0, 0, {PB_RequestState_init_zero}}
|
|
|
-#define PB_SmartKnobConfig_init_zero {0}
|
|
|
+#define PB_SmartKnobConfig_init_zero {0, 0, 0, 0, 0, 0, ""}
|
|
|
#define PB_RequestState_init_zero {0}
|
|
|
|
|
|
/* Field tags (for use in manual encoding/decoding) */
|
|
|
#define PB_Ack_nonce_tag 1
|
|
|
#define PB_Log_msg_tag 1
|
|
|
+#define PB_SmartKnobConfig_num_positions_tag 1
|
|
|
+#define PB_SmartKnobConfig_position_tag 2
|
|
|
+#define PB_SmartKnobConfig_position_width_radians_tag 3
|
|
|
+#define PB_SmartKnobConfig_detent_strength_unit_tag 4
|
|
|
+#define PB_SmartKnobConfig_endstop_strength_unit_tag 5
|
|
|
+#define PB_SmartKnobConfig_snap_point_tag 6
|
|
|
+#define PB_SmartKnobConfig_text_tag 7
|
|
|
+#define PB_SmartKnobState_current_position_tag 1
|
|
|
+#define PB_SmartKnobState_sub_position_unit_tag 2
|
|
|
+#define PB_SmartKnobState_config_tag 3
|
|
|
#define PB_ToSmartknob_nonce_tag 1
|
|
|
#define PB_ToSmartknob_request_state_tag 2
|
|
|
#define PB_ToSmartknob_smartknob_config_tag 3
|
|
|
@@ -103,9 +122,12 @@ X(a, STATIC, SINGULAR, STRING, msg, 1)
|
|
|
#define PB_Log_DEFAULT NULL
|
|
|
|
|
|
#define PB_SmartKnobState_FIELDLIST(X, a) \
|
|
|
-
|
|
|
+X(a, STATIC, SINGULAR, INT32, current_position, 1) \
|
|
|
+X(a, STATIC, SINGULAR, FLOAT, sub_position_unit, 2) \
|
|
|
+X(a, STATIC, OPTIONAL, MESSAGE, config, 3)
|
|
|
#define PB_SmartKnobState_CALLBACK NULL
|
|
|
#define PB_SmartKnobState_DEFAULT NULL
|
|
|
+#define PB_SmartKnobState_config_MSGTYPE PB_SmartKnobConfig
|
|
|
|
|
|
#define PB_ToSmartknob_FIELDLIST(X, a) \
|
|
|
X(a, STATIC, SINGULAR, UINT32, nonce, 1) \
|
|
|
@@ -117,7 +139,13 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,smartknob_config,payload.smartknob_c
|
|
|
#define PB_ToSmartknob_payload_smartknob_config_MSGTYPE PB_SmartKnobConfig
|
|
|
|
|
|
#define PB_SmartKnobConfig_FIELDLIST(X, a) \
|
|
|
-
|
|
|
+X(a, STATIC, SINGULAR, INT32, num_positions, 1) \
|
|
|
+X(a, STATIC, SINGULAR, INT32, position, 2) \
|
|
|
+X(a, STATIC, SINGULAR, FLOAT, position_width_radians, 3) \
|
|
|
+X(a, STATIC, SINGULAR, FLOAT, detent_strength_unit, 4) \
|
|
|
+X(a, STATIC, SINGULAR, FLOAT, endstop_strength_unit, 5) \
|
|
|
+X(a, STATIC, SINGULAR, FLOAT, snap_point, 6) \
|
|
|
+X(a, STATIC, SINGULAR, STRING, text, 7)
|
|
|
#define PB_SmartKnobConfig_CALLBACK NULL
|
|
|
#define PB_SmartKnobConfig_DEFAULT NULL
|
|
|
|
|
|
@@ -148,9 +176,9 @@ extern const pb_msgdesc_t PB_RequestState_msg;
|
|
|
#define PB_FromSmartKnob_size 261
|
|
|
#define PB_Log_size 258
|
|
|
#define PB_RequestState_size 0
|
|
|
-#define PB_SmartKnobConfig_size 0
|
|
|
-#define PB_SmartKnobState_size 0
|
|
|
-#define PB_ToSmartknob_size 8
|
|
|
+#define PB_SmartKnobConfig_size 94
|
|
|
+#define PB_SmartKnobState_size 112
|
|
|
+#define PB_ToSmartknob_size 102
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
} /* extern "C" */
|