update
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#ifndef _PROTO_MODBUS_MASTER_LEAKAGE_H_
|
||||
#define _PROTO_MODBUS_MASTER_LEAKAGE_H_
|
||||
#include "main.h"
|
||||
#include "app_com.h"
|
||||
|
||||
#define COMM_SENSOR_NUM_MAX (32) /*最大的通讯数量*/
|
||||
|
||||
|
||||
/*通讯状态*/
|
||||
#define PROTO_LEAKAGE_COMM_STATE_INIT (0U) /*初始化 */
|
||||
#define PROTO_LEAKAGE_COMM_STATE_CURR_DATA_GET (1U) /*获取实时数据*/
|
||||
|
||||
#define PROTO_LEAKAGE_COMM_STATE_DEFAULT PROTO_LEAKAGE_COMM_STATE_CURR_DATA_GET
|
||||
|
||||
#define PROTO_LEAKAGE_STATE_CODE_TIME_OUT (30U) /*通讯超时*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct /*通讯相关参数*/
|
||||
{
|
||||
u8 id; /*modbus通讯id*/
|
||||
u8 state; /*传感器当前的通讯状态*/
|
||||
u8 leakage_data_index; /*漏液子控索引*/
|
||||
u16 state_send_time; /*当前通讯状态发送次数*/
|
||||
u16 tx_time_out_count; /*协议指令发送次数*/
|
||||
u32 sensor_state_code; /*传感器状态码,为对应位为1代表异常*/
|
||||
}comm;
|
||||
|
||||
}proto_sensor_class_t;
|
||||
|
||||
typedef struct proto_leakage_t proto_leakage_t;
|
||||
|
||||
struct proto_leakage_t
|
||||
{
|
||||
u16 sensor_index; /*当前与哪个传感器通讯*/
|
||||
u16 sensor_num; /*总共通讯的传感器数量*/
|
||||
|
||||
proto_sensor_class_t sensor[APP_LEAKAGE_SUB_DEVICE_NUM]; /*传感器状态*/
|
||||
|
||||
void (*init)(proto_leakage_t *);
|
||||
void (*tx_task)(proto_leakage_t *);
|
||||
void (*uart_send)(u8 *,u16);
|
||||
};
|
||||
|
||||
extern proto_leakage_t modbus_leakage[APP_COM_NUM];
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user