diff options
Diffstat (limited to 'app.h')
-rw-r--r-- | app.h | 53 |
1 files changed, 50 insertions, 3 deletions
@@ -3,10 +3,57 @@ #include <stdint.h> -#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); |