curtis.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * curtis.c
  3. *
  4. * Created on: 2019Äê6ÔÂ20ÈÕ
  5. * Author: Eric
  6. */
  7. #include "base.h"
  8. #include "log.h"
  9. #include "can.h"
  10. #include "cfg.h"
  11. #define curtisSendRpm(id, rpm, positive)
  12. bool McWalkProcessCurtis(void) {
  13. static u32 interval = 0;
  14. s16 v = 0;
  15. u8 positive;
  16. if(TimerSub(Timer1ms, interval) < 4){
  17. return False;
  18. }
  19. interval = Timer1ms;
  20. if(Set.FWlkRpm < 0){
  21. v = -Set.FWlkRpm;
  22. positive = 0x80;
  23. }else{
  24. v = Set.FWlkRpm;
  25. positive = 0x40;
  26. }
  27. /* canid = 0x200 + id 0x40 */
  28. CanSendByte(0, 8, 1, 0, 0, 0, 0, 0, 0, 0);
  29. CanSendByte(0x240, 8, v, v >> 8, positive, 0, 0, Cfg.FWlkAcc, Cfg.FWlkDcc, 0);
  30. if(Set.BWlkRpm < 0){
  31. v = -Set.BWlkRpm;
  32. positive = 0x80;
  33. }else{
  34. v = Set.BWlkRpm;
  35. positive = 0x40;
  36. }
  37. /* canid = 0x200 + id 0x41 */
  38. CanSendByte(0, 8, 1, 0, 0, 0, 0, 0, 0, 0);
  39. CanSendByte(0x241, 8, v, v >> 8, positive, 0, 0, Cfg.BWlkAcc, Cfg.BWlkDcc, 0);
  40. //CanSendProcess(CAN1);
  41. return True;
  42. }