diff options
author | jaseg <git@jaseg.de> | 2023-09-25 23:57:36 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-09-25 23:57:36 +0200 |
commit | 8cc05c79cea62609d02231492c054a0cca2b2289 (patch) | |
tree | e39d40456adefe9bb70bcd77ebdf97be1dcdc028 /center_fw/src/protocol.h | |
parent | 583ac10d1450610a4110849c26cc16f03154d26e (diff) | |
download | 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.tar.gz 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.tar.bz2 8seg-8cc05c79cea62609d02231492c054a0cca2b2289.zip |
Center firmware WIP
Diffstat (limited to 'center_fw/src/protocol.h')
-rw-r--r-- | center_fw/src/protocol.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/center_fw/src/protocol.h b/center_fw/src/protocol.h new file mode 100644 index 0000000..89c93e2 --- /dev/null +++ b/center_fw/src/protocol.h @@ -0,0 +1,33 @@ +#ifndef __PROTOCOL_H__ +#define __PROTOCOL_H__ + +#include <stdint.h> +#include <stdbool.h> + +#define PKT_TYPE_BULK_FLAG 0x80 + +struct proto_rx_st { + int packet_type; + int is_bulk; + int rxpos; + int address; + uint8_t argbuf[8]; + int offset; + const struct command_if_def *cmd_if; +}; + +struct command_if_def { + int packet_type_max; + int payload_len[0]; +}; + +extern volatile uint32_t decoding_error_cnt, protocol_error_cnt; +extern volatile bool backchannel_frame; + +/* Callback */ +void handle_command(int command, uint8_t *args); + +void receive_symbol(struct proto_rx_st *st, int symbol); +void reset_receiver(struct proto_rx_st *st, const struct command_if_def *cmd_if); + +#endif |