1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-21 16:12:18 +00:00
stmbl/shared/stmbl_talk.h

29 lines
805 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
uint8_t slave_addr; // calc from uid, overwrite in config
uint8_t len; // #data in byte
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,
BOOTLOADER,
// ENABLE,
// DISABLE, // proc / conf data = default
} cmd : 4;
uint8_t counter : 4; // packet counter, mosi: ++, miso: same as request
} 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)