void MrCs2EncStatus5(MrCs2CanDataType *CanMsg, unsigned long Uid, int Index) { SetLongToByteArray(CanMsg->Data, Uid); CanMsg->Data[4] = (unsigned char)Index; MrCs2SetCommand(CanMsg, MR_CS2_CMD_STATUS); MrCs2SetDlc(CanMsg, 5); }
void MrCs2EncSysSystemId5(MrCs2CanDataType *CanMsg, unsigned long Uid) { SetLongToByteArray((char *)CanMsg->Data, Uid); MrCs2SetCommand(CanMsg, MR_CS2_CMD_SYSTEM); MrCs2SetSystemSubcmd(CanMsg, MR_CS2_SUBCMD_SYSTEM_SYSTEM_ID); MrCs2SetDlc(CanMsg, 5); }
void MrCs2EncSpeed6(MrCs2CanDataType *CanMsg, unsigned long LocId, int Speed) { SetLongToByteArray((char *)CanMsg->Data, LocId); SetIntToByteArray((char *)&(CanMsg->Data[4]), Speed); MrCs2SetCommand(CanMsg, MR_CS2_CMD_SPEED); MrCs2SetDlc(CanMsg, 6); }
void MrCs2EncSysCycleEnd(MrCs2CanDataType *CanMsg, unsigned long Uid) { SetLongToByteArray(CanMsg->Data, Uid); MrCs2SetCommand(CanMsg, MR_CS2_CMD_SYSTEM); MrCs2SetSystemSubcmd(CanMsg, MR_CS2_SUBCMD_SYSTEM_CYCLE_END); MrCs2SetDlc(CanMsg, 5); }
void MrCs2EncCfgdatStream8(MrCs2CanDataType *CanMsg, char *Bytes) { int i; for (i = 0; i < 8; i++) CanMsg->Data[i] = (unsigned char)(Bytes[i]); MrCs2SetCommand(CanMsg, MR_CS2_CMD_CFGDAT_STREAM); MrCs2SetDlc(CanMsg, 8); }
void MrCs2EncS88Poll5(MrCs2CanDataType *CanMsg, unsigned long Uid, int NumModuls) { SetLongToByteArray((char *)CanMsg->Data, Uid); CanMsg->Data[4] = NumModuls; MrCs2SetCommand(CanMsg, MR_CS2_CMD_S88_POLL); MrCs2SetDlc(CanMsg, 5); }
void MrCs2EncCfgdatStream6(MrCs2CanDataType *CanMsg, unsigned long Length, int Crc) { SetLongToByteArray(CanMsg->Data, Length); SetIntToByteArray(&(CanMsg->Data[4]), Crc); MrCs2SetCommand(CanMsg, MR_CS2_CMD_CFGDAT_STREAM); MrCs2SetDlc(CanMsg, 6); }
void MrCs2EncStatus8(MrCs2CanDataType *CanMsg, char *Bytes) { int i; for (i = 0; i < 8; i++) CanMsg->Data[i] = (unsigned char)(Bytes[i]); MrCs2SetCommand(CanMsg, MR_CS2_CMD_STATUS); MrCs2SetDlc(CanMsg, 8); }
void MrCs2EncCanBootldr(MrCs2CanDataType *CanMsg, char *Bytes) { int i; for (i = 0; i < 8; i++) CanMsg->Data[i] = Bytes[i]; MrCs2SetCommand(CanMsg, MR_CS2_CMD_BOOTLDR_CAN); MrCs2SetDlc(CanMsg, 8); }
void MrCs2EncSysDataProtocoll(MrCs2CanDataType *CanMsg, unsigned long Uid, int Proto) { SetLongToByteArray((char *)CanMsg->Data, Uid); CanMsg->Data[5] = Proto; MrCs2SetCommand(CanMsg, MR_CS2_CMD_SYSTEM); MrCs2SetSystemSubcmd(CanMsg, MR_CS2_SUBCMD_SYSTEM_DATA_PROTOCOLL); MrCs2SetDlc(CanMsg, 6); }
void MrCs2EncSysOverload(MrCs2CanDataType *CanMsg, unsigned long Uid, int Channel) { SetLongToByteArray((char *)CanMsg->Data, Uid); CanMsg->Data[5] = Channel; MrCs2SetCommand(CanMsg, MR_CS2_CMD_SYSTEM); MrCs2SetSystemSubcmd(CanMsg, MR_CS2_SUBCMD_SYSTEM_OVERLOAD); MrCs2SetDlc(CanMsg, 6); }
void MrCs2EncPing8(MrCs2CanDataType *CanMsg, unsigned long Uid, int SwVersion, int DeviceId) { SetLongToByteArray(CanMsg->Data, Uid); SetIntToByteArray(&(CanMsg->Data[4]), SwVersion); SetIntToByteArray(&(CanMsg->Data[6]), DeviceId); MrCs2SetCommand(CanMsg, MR_CS2_CMD_PING); MrCs2SetDlc(CanMsg, 8); }
void MrCs2EncSysResetMfxCounter(MrCs2CanDataType *CanMsg, unsigned long Uid, int Counter) { SetLongToByteArray((char *)CanMsg->Data, Uid); SetIntToByteArray((char *)&(CanMsg->Data[5]), Counter); MrCs2SetCommand(CanMsg, MR_CS2_CMD_SYSTEM); MrCs2SetSystemSubcmd(CanMsg, MR_CS2_SUBCMD_SYSTEM_RESET_MFX_COUNTER); MrCs2SetDlc(CanMsg, 7); }
void MrCs2EncS88Poll7(MrCs2CanDataType *CanMsg, unsigned long Uid, int Modul, int State) { SetLongToByteArray((char *)CanMsg->Data, Uid); CanMsg->Data[4] = Modul; SetIntToByteArray((char *)&(CanMsg->Data[5]), State); MrCs2SetCommand(CanMsg, MR_CS2_CMD_S88_POLL); MrCs2SetDlc(CanMsg, 7); }
void MrCs2EncStatus6(MrCs2CanDataType *CanMsg, unsigned long Uid, int Index, int NumPackets) { SetLongToByteArray(CanMsg->Data, Uid); CanMsg->Data[4] = (unsigned char)Index; CanMsg->Data[5] = (unsigned char)NumPackets; MrCs2SetCommand(CanMsg, MR_CS2_CMD_STATUS); MrCs2SetDlc(CanMsg, 6); }
void MrCs2Decode(MrCs2CanDataType *CanMsg, CanFrameStruct *CanFrame) { unsigned CanHash, Response, Command, Prio, i; MrCs2SetId(CanMsg, CanFrame->CanId); MrCs2SetDlc(CanMsg, CanFrame->CanDlc); for (i = 0; i < 8; i++) CanMsg->Data[i] = CanFrame->CanData[i]; MrCs2DecodeId(MrCs2GetId(CanMsg), &CanHash, &Response, &Command, &Prio); MrCs2SetHash(CanMsg, CanHash & ~MR_CS2_MASK_HASH_MAGIC); MrCs2SetResponse(CanMsg, Response); MrCs2SetCommand(CanMsg, Command); MrCs2SetPrio(CanMsg, Prio); MrCs2SetIsCs2(CanMsg, MrCs2IsCs2Msg(CanHash, MrCs2GetCommand(CanMsg))); }
void MrCs2EncPing0(MrCs2CanDataType *CanMsg) { MrCs2SetCommand(CanMsg, MR_CS2_CMD_PING); MrCs2SetDlc(CanMsg, 0); }
void MrCs2EncSpeed4(MrCs2CanDataType *CanMsg, unsigned long LocId) { SetLongToByteArray((char *)CanMsg->Data, LocId); MrCs2SetCommand(CanMsg, MR_CS2_CMD_SPEED); MrCs2SetDlc(CanMsg, 4); }