1
Diff: CAN/CAN.cpp
- Revision:
- 8:95a914f962bd
- Parent:
- 5:6a95726e45b0
--- a/CAN/CAN.cpp Tue Dec 10 09:23:12 2019 +0000 +++ b/CAN/CAN.cpp Tue Jan 07 09:23:24 2020 +0000 @@ -1,12 +1,12 @@ #include "CAN.h" - +#include "used_leg_message.h" //定义设备 -CAN pf_can(PB_8, PB_9); // CAN Rx pin name, CAN Tx pin name -CAN df_can(PB_12, PB_13); // CAN Rx pin name, CAN Tx pin name +CAN ef_can(PB_8, PB_9); // CAN Rx pin name, CAN Tx pin name +CAN wf_can(PB_12, PB_13); // CAN Rx pin name, CAN Tx pin name // 定义CAN消息 -CANMessage pf_rxMsg, df_rxMsg; // 主控收到的CAN消息 -CANMessage PF_can, DF_can; // 主控发送的CAN消息 +CANMessage ef_rxMsg, wf_rxMsg; // 主控收到的CAN消息 +CANMessage EF_can, WF_can; // 主控发送的CAN消息 //=================================函数=======================================// @@ -56,16 +56,16 @@ // 多个控制器联合打包准备发送 void PackAll(){ - pack_cmd(&PF_can, a_control.pf); - pack_cmd(&DF_can, a_control.df); + pack_cmd(&EF_can, a_control.ef); + pack_cmd(&WF_can, a_control.wf); } // 写联合打包的数据 void WriteAll(){ - pf_can.write(PF_can); + ef_can.write(EF_can); wait(.00002); - df_can.write(DF_can); + wf_can.write(WF_can); wait(.00002); } @@ -94,14 +94,14 @@ float t = uint_to_float(i_int, -T_MAX, T_MAX, 12); if(id==0x0a){ - ankle->pf.p = p; - ankle->pf.v = v; - ankle->pf.t = t; + ankle->ef.p = p; + ankle->ef.v = v; + ankle->ef.t = t; } else if(id==0x0b){ - ankle->df.p = p; - ankle->df.v = v; - ankle->df.t = t; + ankle->wf.p = p; + ankle->wf.v = v; + ankle->wf.t = t; } }