host_shoes.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "host_shoes.h"
  2. void host_shoes(int time_stamp, float gyr[3], float acc[3], float mag[3], uint16_t h_press, uint16_t s_press,
  3. int32_t h_pos[3], int16_t h_att[3], int32_t s_pos[3], int16_t s_att[3], int16_t h_zupt, int16_t s_zupt,uint16_t s_rssi)
  4. {
  5. static int16_t h_pos_offset[3];
  6. static int16_t s_pos_offset[3];
  7. static int16_t h_pos_last[3];
  8. static int16_t s_pos_last[3];
  9. int32_t left_press = (((int32_t)h_press & 0x0000ffff)<<8);
  10. int16_t is_down = 0;
  11. int16_t is_jump = 0;
  12. if(!CAL_MODE)
  13. {
  14. unsigned char left_tag = footPDR(time_stamp, gyr, acc, mag, left_press, h_pos, h_att, &h_zupt);
  15. if(h_zupt == 1)
  16. {
  17. for(int i = 0; i < 3; i ++)
  18. {
  19. h_pos_last[i] = h_pos[i];
  20. }
  21. }
  22. if(s_zupt == 1)
  23. {
  24. for(int i = 0; i < 3; i ++)
  25. {
  26. s_pos_last[i] = s_pos[i];
  27. }
  28. }
  29. for(int i = 0; i <3; i++)
  30. {
  31. h_pos_offset[i] = h_pos[i] - h_pos_last[i];
  32. s_pos_offset[i] = s_pos[i] - s_pos_last[i];
  33. }
  34. special_motion(time_stamp, h_press, s_press, h_pos_offset, s_pos_offset, &is_down, &is_jump, acc);
  35. }
  36. send_data_to_com(s_pos, h_pos, s_att, h_att, s_zupt, h_zupt, is_down, is_jump, s_rssi);
  37. }