stmbl/shared/stmbl_talk.h

27 lines
761 B
C
Raw Permalink Normal View History

2018-03-20 23:45:27 +00:00
#pragma once
#include <stdint.h>
2018-04-06 20:10:57 +00:00
#pragma pack(push, 1)
2018-04-06 23:36:17 +00:00
typedef struct {
uint32_t crc; // can be 0 for eth comm
2018-10-13 14:48:42 +00:00
uint8_t slave_addr; // calc from uid, overwrite in config, bootloader = 255
2018-10-13 14:41:50 +00:00
uint8_t len; // #data in words
2018-04-06 23:36:17 +00:00
uint8_t conf_addr;
struct {
enum stmbl_talk_cmd_t {
NO_CMD,
WRITE_CONF, // conf[rx.header.conf_addr] = rx.header.config.u32, tx.header.config.u32 = conf[tx.header.conf_addr++]
READ_CONF, // tx.header.config.u32 = conf[rx.header.conf_addr]
DO_RESET,
2018-10-13 14:48:42 +00:00
BOOTLOADER
2018-04-06 23:36:17 +00:00
} cmd : 4;
2018-10-13 14:42:17 +00:00
uint8_t counter : 4; // packet counter, master: ++, slave: same as request
2018-04-06 23:36:17 +00:00
} flags;
union {
float f32;
uint32_t u32;
int32_t i32;
} config;
2018-03-22 00:38:43 +00:00
} stmbl_talk_header_t;
2018-04-06 20:10:57 +00:00
#pragma pack(pop)