This repository has been archived on 2025-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
controller-hart/User/hart/master/inc/hart_master_rsp.h

40 lines
1.5 KiB
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 __HART_MASTER_RSP_H__
#define __HART_MASTER_RSP_H__
#include "./hart_master_frame.h"
#pragma pack(1)
typedef struct
{
uint8_t card_index;
uint8_t channel_index;
io_system_device_t *device;
} io_system_device_info_t;
typedef union
{
hart_command_75_t command_75; // 轮询子设备
hart_command_84_t command_84; // 读取子设备标识摘要
hart_command_85_t command_85; // 读取I/O通道统计信息
hart_command_86_t command_86; // 读取子设备统计信息
hart_command_87_t command_87; // 写入I/O系统主模式
hart_command_88_t command_88; // 写入重试计数
} hart_command_rsp_data_u; // HART请求指令数据域
typedef struct
{
uint8_t address[HART_LONG_ADDRESS_LEN]; // 短帧地址1个字节长帧地址5个字节上位机发送时从低位到高位填充例如短地址0x01长地址0x00 0x00 0x00 0x00 0x01
uint8_t address_length; // 地址长度
uint32_t command; // HART命令码
hart_command_rsp_data_u data; // 数据域
// 以下解析数据后填充
hart_delimiter_u delimiter;
uint8_t data_length; // 数据域长度
} hart_command_rsp_t; // 主机请求指令接口参数定义:hart_master_command_req
#pragma pack()
extern BOOL (*hart_command_rsp_ptr_arr[HART_COMMAND_MAX])(const hart_command_rsp_t *const data, hart_response_t *resp);
extern BOOL hart_master_rsp_init(const hart_master_init_t *const init);
#endif // __HART_MASTER_RSP_H__