2025-04-18 18:59:53 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @file FluxProtocol.h
|
|
|
|
|
|
* @brief 流量计通讯协议部分
|
|
|
|
|
|
*
|
|
|
|
|
|
* 用于声明流量计参数计便携制氧机参数
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author wang xiang en
|
|
|
|
|
|
* @date 2025-04-18
|
|
|
|
|
|
* @version 版本号
|
|
|
|
|
|
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd)
|
|
|
|
|
|
*/
|
2025-03-17 09:50:22 +08:00
|
|
|
|
#ifndef _FLUX_PROTOCOL_H
|
|
|
|
|
|
#define _FLUX_PROTOCOL_H
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
|
|
#include "freertos/task.h"
|
|
|
|
|
|
#include "freertos/queue.h"
|
|
|
|
|
|
#include "freertos/semphr.h"
|
|
|
|
|
|
#include "freertos/event_groups.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ui.h"
|
2025-03-17 13:46:43 +08:00
|
|
|
|
#include "FluxUart.h"
|
|
|
|
|
|
|
2025-04-18 18:59:53 +08:00
|
|
|
|
/* 导出三种流量计体积数据 */
|
2025-03-17 13:46:43 +08:00
|
|
|
|
extern float Spirit3_Volume[4];
|
|
|
|
|
|
extern float Spirit6_Volume[6];
|
|
|
|
|
|
extern float YULite8_Volume[6];
|
|
|
|
|
|
|
2025-04-18 18:59:53 +08:00
|
|
|
|
/* 声明设备类型 */
|
2025-03-17 13:46:43 +08:00
|
|
|
|
typedef enum DeviceType{
|
|
|
|
|
|
Spirit3,
|
|
|
|
|
|
Spirit6,
|
|
|
|
|
|
YU_Lite8,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-18 18:59:53 +08:00
|
|
|
|
/* 工作模式声明 */
|
2025-03-19 18:46:29 +08:00
|
|
|
|
typedef enum OperationMode
|
|
|
|
|
|
{
|
|
|
|
|
|
Normal,//正常模式,收到开始命令后开始进行累积计算,停止指令收到后停止积分
|
|
|
|
|
|
Timer,//计时模式,计算在设定时间内的累积值
|
|
|
|
|
|
Volume,//体积模式,体积到达后停止累积
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-18 18:59:53 +08:00
|
|
|
|
/* 地址0x0001处的启停指令 */
|
2025-03-19 18:46:29 +08:00
|
|
|
|
typedef enum MeasureCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
StartMeasure=1,
|
|
|
|
|
|
StopMeasure=2,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-18 18:59:53 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief 声明流量数据结构体
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef struct FluxProtocol
|
|
|
|
|
|
{
|
|
|
|
|
|
float testVolume;
|
|
|
|
|
|
uint16_t currentStage;
|
|
|
|
|
|
uint16_t currentBPM;
|
|
|
|
|
|
float nominalVolumeStage;
|
|
|
|
|
|
float nominalVolumeBPM;
|
|
|
|
|
|
float nominalVolumeMax;
|
|
|
|
|
|
float nominalVolumeMin;
|
|
|
|
|
|
enum DeviceType currentDevice;
|
|
|
|
|
|
};
|
|
|
|
|
|
extern struct FluxProtocol fluxProtocol;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 地址数据 Not Used
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
2025-03-19 18:46:29 +08:00
|
|
|
|
typedef struct FluxCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
uint16_t addr;
|
|
|
|
|
|
uint32_t PLC_ADDR;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-03-17 09:50:22 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
} /*extern "C"*/
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|