v2019
Dependencies: CRAC-Strat_2019 SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Dependents: Codeprincipal_2019 CRAC-Strat_2019
Diff: Asservissement/Asservissement.cpp
- Revision:
- 44:badcbe8766e9
- Parent:
- 29:41e02746041d
- Child:
- 50:a5361ffeefc8
diff -r 657b6a573e11 -r badcbe8766e9 Asservissement/Asservissement.cpp --- a/Asservissement/Asservissement.cpp Thu May 17 13:08:31 2018 +0000 +++ b/Asservissement/Asservissement.cpp Tue May 07 17:37:46 2019 +0000 @@ -32,6 +32,41 @@ can2.write(msgTx); } + +void Send2Short(unsigned short id, unsigned short d1, unsigned short d2) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=id; + msgTx.len=4; + msgTx.format=CANStandard; + msgTx.type=CANData; + // from sur 2 octets + msgTx.data[0]=(unsigned char)d1; + msgTx.data[1]=(unsigned char)(d1>>8); + msgTx.data[2]=(unsigned char)d2; + msgTx.data[3]=(unsigned char)(d2>>8); + + can2.write(msgTx); +} + +void SendMsgCan(unsigned short id, unsigned char* data, int len) +{ + CANMessage msgTx=CANMessage(); + msgTx.id=id; + msgTx.len=len; + msgTx.format=CANStandard; + msgTx.type=CANData; + // from sur 2 octets + for(int i = 0; i<len; i++) + { + msgTx.data[i]=data[i]; + } + + can2.write(msgTx); +} + + + /*********************************************************************************************/ /* FUNCTION NAME: GoToPosition */ /* DESCRIPTION : Transmission CAN correspondant à un asservissement en position (x,y,theta) */