1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #include "special_motion.h"
- int down_send_count = 0;
- int is_down;
- int jump_send_count = 0;
- int is_jump = 0;
- void special_motion(int time_stamp, uint16_t h_press, uint16_t s_press, int16_t h_pos[3], int16_t s_pos[3], int16_t *down, int16_t *jump, float acc[3])
- {
- int32_t left_press = (((int32_t)h_press & 0x0000ffff)<<8);
- int32_t right_press = (((int32_t)s_press & 0x0000ffff)<<8);
-
-
- /*
- 处理蹲的动作
- */
- short down_tag = 0;
- down_tag = press_down_detect_new(time_stamp, left_press, right_press, h_pos[2], s_pos[2], acc[2]);
- if (down_tag)
- {
- /*
- gpio_mt_run(300);
- */
- down_send_count = 20;
- }
-
- if(down_send_count > 0)
- {
- is_down = 1;
- down_send_count --;
- }
- else
- {
- is_down = 0;
- }
-
- /*
- 处理跳的动作
- */
-
- short jump_tag = 0;
-
- jump_tag = press_jump_detect(h_pos, s_pos);
-
- if (jump_tag)
- {
- /*
- gpio_mt_run(300);
- */
- jump_send_count = 20;
- }
-
- //连续发20次蹲,终端再处理
- if(jump_send_count > 0)
- {
- is_jump = 1;
- jump_send_count --;
- }
- else
- {
- is_jump = 0;
- }
-
- *down = is_down;
- *jump = is_jump;
-
- }
|