#pragma once #include "sdk/hal/zhal.hpp" namespace iflytop { namespace zcr { typedef struct { uint16_t packetindex; uint16_t cmdid; uint8_t subcmdid; uint8_t packetType; uint8_t data[]; } Cmdheader_t; typedef enum { kpt_cmd = 0, kpt_ack = 1, kpt_error_ack = 2, kpt_status_report = 3, } PacketType_t; typedef enum { kcmd_ping = 0, kcmd_read_io = 1, kcmd_set_io = 2, kcmd_readadc_raw = 3, kcmd_m211887_operation = 1000, // 维萨拉压力传感器 kcmd_read_presure_sensor = 1001, kcmd_triple_warning_light_ctl = 1002, kcmd_high_power_electrical_ctl = 1003, kcmd_peristaltic_pump_ctl = 1004, kcmd_read_huacheng_pressure_sensor = 1005, kcmd_set_proportional_valve = 1006, // {4:valveId,4:valveValue} kcmd_air_compressor_ch_ctrl = 1007, // {4:chstate} } CmdID_t; } // namespace zcr } // namespace iflytop #define IS_CMD(cmdheader, cmd, subcmd) ((cmdheader->cmdid == cmd) && (cmdheader->subcmdid == subcmd)) #define CMD_GET_PARAM(cmdheader, index) (((int32_t*)cmdheader->data)[index]) /** * @brief */