Files
QD4C-firmware/app/tiny_frame/by_tiny_frame_pack.h
2024-02-25 11:49:10 +08:00

25 lines
630 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _BY_TINY_FRAME_PACK_H__
#define _BY_TINY_FRAME_PACK_H__
#include <stdio.h>
#include <stdint.h>
#include "by_tiny_frame_config.h"
// 从机地址 (1b) - 功能码 (1b) - 寄存器地址 (2b) - 数据 (4b) - CRC(2b)
// 从机地址 (1b) 0-127, 最低位表示发送方,主机请求低位为 0从机应答低位为 1
// 高字节在前
typedef struct by_tf_pack_frame_t {
uint8_t frame[10];
uint8_t slave_id;
uint8_t cmd;
uint16_t reg_addr;
uint32_t data;
} by_tf_pack_frame_t;
extern void by_tiny_frame_pack_init(void);
extern void by_tiny_frame_pack_send(by_tf_pack_frame_t *frame_s);
#endif