107 lines
2.6 KiB
C
107 lines
2.6 KiB
C
|
|
#ifndef __EXTIOCONTROL_H__
|
|
#define __EXTIOCONTROL_H__
|
|
|
|
#include "controlbus.h"
|
|
|
|
#if (CONTROL_BUS == COMM_CAN)
|
|
/*
|
|
IO扩展板
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
typedef struct
|
|
{
|
|
u8 nodeId; // 节点ID
|
|
|
|
CtrlBusPacket ctrlCmd; // 发给外围板的控制命令
|
|
CtrlBusPacket exbSta; // 外围板返回的状态命令
|
|
BoardRegVal regVal; // 外围板寄存器值
|
|
CtrlBusPacket rdReg; // 读取外围板寄存器值
|
|
|
|
u8 cmdFlag; // 有新命令标志 N5--接收到控制命令
|
|
|
|
u8 staFlag; // 有新状态标志 N5--发送BN_CMD_EXSTA
|
|
u8 refSta; // 刷新状态标志 N5--接收BN_CMD_EXSTA
|
|
|
|
u8 refVer;
|
|
u8 verFlag;
|
|
|
|
u8 transFlag; // 数据传输标志 发送数据
|
|
u8 exbupdateFlag; // 外围板程序升级标志
|
|
|
|
}ExtIOControl;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
typedef union
|
|
{
|
|
u8 buff[CAN_DATA_LEN];
|
|
|
|
struct
|
|
{
|
|
u16 cmd;
|
|
u8 subcmd;
|
|
u16 outctrl;
|
|
u8 para[3];
|
|
} __attribute__ ((packed)) extIOCtrl; // IO扩展板控制
|
|
|
|
struct
|
|
{
|
|
u16 inputSta;
|
|
u8 rev[6];
|
|
} __attribute__ ((packed)) extIOSta; // 状态命令
|
|
|
|
}ExtIOCommand;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
// 控制命令定义
|
|
|
|
/*
|
|
#define CTRL_CMD_EMB_HEAD_CTRL 0x1000 // 平绣机头板控制
|
|
#define CTRL_CMD_EMB_HEAD_PARA 0x1001 // 平绣机头板参数设置
|
|
#define CTRL_CMD_HEAD_NVPARA 0x1002 // 平绣机头非易失性参数设置
|
|
|
|
#define CTRL_CMD_CHENILLE_HEAD_CTRL 0x1010 // 毛巾机头板控制
|
|
#define CTRL_CMD_CHENILLE_HEAD_PARA 0x1011 // 毛巾机头板参数设置
|
|
#define CTRL_CMD_CHENILLE_NVPARA 0x1012 // 毛巾机头非易失性参数设置
|
|
|
|
#define CTRL_CMD_COIL_HEAD_CTRL 0x1020 // 缠绕机头板控制
|
|
#define CTRL_CMD_COIL_HEAD_PARA 0x1021 // 缠绕机头板参数设置
|
|
#define CTRL_CMD_COIL_NVPARA 0x1022 // 缠绕机头非易失性参数设置
|
|
*/
|
|
|
|
/*
|
|
#define CTRL_CMD_COLOR_CTRL 0x1100 // 控制命令
|
|
#define CTRL_CMD_COLOR_PARA 0x1101 // 参数设置命令
|
|
#define CTRL_CMD_COLOR_NVPARA 0x1102 // 非易失性参数设置
|
|
*/
|
|
|
|
#define CTRL_CMD_EXTIO_CTRL 0x1200 // 控制命令
|
|
|
|
//-------------------------------------------------------------------------------
|
|
// 子控制命令定义
|
|
#define CTRL_SUBCMD_OUT_ON 0x01
|
|
#define CTRL_SUBCMD_OUT_OFF 0x02
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
void InitExtIOControl(ExtIOControl * pCtrl);
|
|
|
|
void SendExtIOCommand(ExtIOControl * pCtrl, ExtIOCommand * pCmd);
|
|
|
|
void RequestExtIOStatus(ExtIOControl * pCtrl);
|
|
|
|
void RequestExtIOVersion(ExtIOControl * pCtrl);
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|