aboutsummaryrefslogtreecommitdiff
path: root/shared/protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/protocol.h')
-rw-r--r--shared/protocol.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/shared/protocol.h b/shared/protocol.h
index adec614..5bdfcbe 100644
--- a/shared/protocol.h
+++ b/shared/protocol.h
@@ -15,6 +15,7 @@
#define W2_CMD_CODE_MASK (~1)
#define W2_CMD_DIRECTION_MASK (1)
+#define W2_CMD_COUNT 28
enum w2_e_scmds {
/** ping command */
W2_CMD_PING = 0x00,
@@ -162,6 +163,11 @@ typedef struct {
#pragma pack(pop)
+/** stores message handlers in array with opcode as index */
+extern void (*g_w2_cmd_handlers[W2_CMD_COUNT])(w2_s_bin *);
+/** fills g_w2_cmd_handlers with functions */
+void w2_cmd_setup_handlers();
+
/** global handler for complete messages */
void w2_cmd_handler(uint8_t data[W2_SERIAL_READ_BUFFER_SIZE], uint8_t length);
/** calculate message length */