diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-06-05 21:37:57 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-06-10 12:27:12 -0400 |
commit | 589bd64ce013691ef8989d3dfbc74ffe0822d480 (patch) | |
tree | fd4f894bdec7de4bc21d6db3768caf95b851f199 /src/command.h | |
parent | 36b8831c7e7c4e4481704234fbc27dbe43026f73 (diff) | |
download | kutter-589bd64ce013691ef8989d3dfbc74ffe0822d480.tar.gz kutter-589bd64ce013691ef8989d3dfbc74ffe0822d480.tar.xz kutter-589bd64ce013691ef8989d3dfbc74ffe0822d480.zip |
command: Support 2-byte message ids
Allow command ids, response ids, and output ids to be either 1 or 2
bytes long. This increases the total number of message types from 128
to 16384.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/command.h')
-rw-r--r-- | src/command.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/command.h b/src/command.h index 894114d7..21b3f79b 100644 --- a/src/command.h +++ b/src/command.h @@ -57,11 +57,13 @@ #define MESSAGE_SYNC 0x7E struct command_encoder { - uint8_t msg_id, max_size, num_params; + uint16_t encoded_msgid; + uint8_t max_size, num_params; const uint8_t *param_types; }; struct command_parser { - uint8_t msg_id, num_args, flags, num_params; + uint16_t encoded_msgid; + uint8_t num_args, flags, num_params; const uint8_t *param_types; void (*func)(uint32_t *args); }; @@ -72,6 +74,7 @@ enum { // command.c void *command_decode_ptr(uint32_t v); +uint_fast16_t command_parse_msgid(uint8_t **pp); uint8_t *command_parsef(uint8_t *p, uint8_t *maxend , const struct command_parser *cp, uint32_t *args); uint_fast8_t command_encode_and_frame( @@ -86,7 +89,7 @@ int_fast8_t command_find_and_dispatch(uint8_t *buf, uint_fast8_t buf_len // out/compile_time_request.c (auto generated file) extern const struct command_parser command_index[]; -extern const uint8_t command_index_size; +extern const uint16_t command_index_size; extern const uint8_t command_identify_data[]; extern const uint32_t command_identify_size; const struct command_encoder *ctr_lookup_encoder(const char *str); |