From 90f5e8958e0f49e2c303abfb9d1f557e28caf78c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 7 Dec 2014 00:06:27 +0100 Subject: o Implementing getting and setting of values. --- app.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) (limited to 'app.h') diff --git a/app.h b/app.h index e892a42..eaf6465 100644 --- a/app.h +++ b/app.h @@ -3,10 +3,57 @@ #include -#define FSP_CMD_GAUGE_COUNT 1 -#define FSP_CMD_GAUGE_INFO 2 +enum fsp_cmd_code { + FSP_CMD_GET_GAUGE_COUNT = 1, + FSP_CMD_SET_GAUGE = 2, + FSP_CMD_GET_GAUGE = 3, + FSP_CMD_FAIL = 255, +}; -bool send_ctrl(uint8_t *data, uint8_t len); +struct fsp_get_gauge_count_req { +}; + +struct fsp_get_gauge_count_res { + uint8_t count; +}; + +struct fsp_set_gauge_req { + uint8_t gauge; + uint8_t value; +}; + +struct fsp_set_gauge_res { +}; + +struct fsp_get_gauge_req { + uint8_t gauge; +}; + +struct fsp_get_gauge_res { + uint8_t gauge; + uint8_t value; +}; + +struct fsp_req { + uint8_t code; + union { + struct fsp_get_gauge_count_req get_gauge_count; + struct fsp_get_gauge_req get_gauge; + struct fsp_set_gauge_req set_gauge; + }; +}; + +struct fsp_res { + uint8_t len; + uint8_t code; + union { + struct fsp_get_gauge_count_res get_gauge_count; + struct fsp_get_gauge_res get_gauge; + struct fsp_set_gauge_res set_gauge; + }; +}; + +bool send_ctrl(struct fsp_res *res); void on_gauge_data(uint8_t *data, uint8_t len); void on_gauge_ctrl(uint8_t *data, uint8_t len); -- cgit v1.2.3