aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-12-11 16:46:57 +0100
committerlonkaars <loek@pipeframe.xyz>2022-12-11 16:46:57 +0100
commit28cd1a0d195637f8f55faf711a66a3e0249843dc (patch)
tree43d5f1597b5a0a23d9703ffc3b4feb1e30de44fe /shared
parentae3970ad5e1b3495726b70d5653c2424fccfba07 (diff)
more serial worky
Diffstat (limited to 'shared')
-rw-r--r--shared/protocol.h16
-rw-r--r--shared/serial_parse.c2
2 files changed, 9 insertions, 9 deletions
diff --git a/shared/protocol.h b/shared/protocol.h
index e2b3b1c..c2001cf 100644
--- a/shared/protocol.h
+++ b/shared/protocol.h
@@ -27,7 +27,7 @@ typedef uint16_t cd_cmd_id_t;
typedef uint8_t cd_cmd_bool_t;
/** @brief cmd handler function signature */
-typedef void (cd_cmd_handler)(cd_s_bin *data);
+typedef void (cd_cmd_handler_t)(cd_s_bin *data);
#pragma pack(push, 1)
@@ -121,12 +121,12 @@ typedef enum {
CD_CMD_RESPONSE = 0x05, /** @brief response message */
} cd_e_scmds;
-cd_cmd_handler cd_cmd_ping,
- cd_cmd_get_node,
- cd_cmd_post_led,
- cd_cmd_post_link,
- cd_cmd_post_net,
- cd_cmd_response;
+cd_cmd_handler_t cd_cmd_ping,
+ cd_cmd_get_node,
+ cd_cmd_post_led,
+ cd_cmd_post_link,
+ cd_cmd_post_net,
+ cd_cmd_response;
/** @brief constant message sizes, 0 for dynamic size */
static const size_t CD_CMD_HANDLERS_SIZE[CD_CMD_COUNT] = {
@@ -149,7 +149,7 @@ static size_t (* const CD_CMD_HANDLERS_SIZEOF[CD_CMD_COUNT])(cd_s_bin*) = {
};
/** @brief stores message handlers in array with opcode as index */
-static cd_cmd_handler* const CD_CMD_HANDLERS[CD_CMD_COUNT] = {
+static cd_cmd_handler_t* const CD_CMD_HANDLERS[CD_CMD_COUNT] = {
[CD_CMD_PING] = &cd_cmd_ping,
[CD_CMD_GET_NODE] = &cd_cmd_get_node,
[CD_CMD_POST_LED] = &cd_cmd_post_led,
diff --git a/shared/serial_parse.c b/shared/serial_parse.c
index de48f60..bfc374a 100644
--- a/shared/serial_parse.c
+++ b/shared/serial_parse.c
@@ -47,7 +47,7 @@ void cd_cmd_handle(uint8_t data[CD_SERIAL_READ_BUFFER_SIZE], uint8_t data_length
cd_s_bin *copy = cd_bin_s_alloc(data_length, data);
if (data[0] >= CD_CMD_COUNT) return;
- cd_cmd_handler* handler = CD_CMD_HANDLERS[data[0]];
+ cd_cmd_handler_t* handler = CD_CMD_HANDLERS[data[0]];
if (handler == NULL) return;
(*handler)(copy);