/* * curtis.c * * Created on: 2019Äê6ÔÂ20ÈÕ * Author: Eric */ #include "base.h" #include "log.h" #include "can.h" #include "cfg.h" #define curtisSendRpm(id, rpm, positive) bool McWalkProcessCurtis(void) { static u32 interval = 0; s16 v = 0; u8 positive; if(TimerSub(Timer1ms, interval) < 4){ return False; } interval = Timer1ms; if(Set.FWlkRpm < 0){ v = -Set.FWlkRpm; positive = 0x80; }else{ v = Set.FWlkRpm; positive = 0x40; } /* canid = 0x200 + id 0x40 */ CanSendByte(0, 8, 1, 0, 0, 0, 0, 0, 0, 0); CanSendByte(0x240, 8, v, v >> 8, positive, 0, 0, Cfg.FWlkAcc, Cfg.FWlkDcc, 0); if(Set.BWlkRpm < 0){ v = -Set.BWlkRpm; positive = 0x80; }else{ v = Set.BWlkRpm; positive = 0x40; } /* canid = 0x200 + id 0x41 */ CanSendByte(0, 8, 1, 0, 0, 0, 0, 0, 0, 0); CanSendByte(0x241, 8, v, v >> 8, positive, 0, 0, Cfg.BWlkAcc, Cfg.BWlkDcc, 0); //CanSendProcess(CAN1); return True; }