jump_rope_count_device.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _JUMP_ROPE_COUNT_DEVICE_H
  2. #define _JUMP_ROPE_COUNT_DEVICE_H 1
  3. #include "schmidt_trigger.h"
  4. #include "monotonic_queue.h"
  5. #include "ringbuf.h"
  6. struct jump_rope_count_config
  7. {
  8. float lg, hg, la, ha, lgz, hgz, a_g_window;
  9. int cy_window, cy_crit, cy_suppress_time, wait_time;
  10. };
  11. struct jump_rope_count_device
  12. {
  13. struct schmidt trig_g, trig_a, trig_gz;
  14. struct ringbuf rbuf_g, rbuf_a;
  15. struct monotonic_queue mq_min_cy, mq_max_cy;
  16. int cy_window, cy_crit, cy_suppress_time, wait_time;
  17. int cy_suppress, remain_time;
  18. float last_cy, last_cy_fixed;
  19. };
  20. struct sensor_packet
  21. {
  22. float ax, ay, az, gx, gy, gz, cy;
  23. };
  24. enum jump_rope_count_result
  25. {
  26. RESULT_INACTIVE = -1,
  27. RESULT_NONE = 0,
  28. RESULT_TRIGGERED = 1
  29. };
  30. extern int jump_rope_count_device_init(struct jump_rope_count_device *dev,
  31. struct jump_rope_count_config *cfg);
  32. extern int process_packet(struct jump_rope_count_device *dev,
  33. struct sensor_packet *packet,
  34. enum jump_rope_count_result *result);
  35. #endif
  36. /* vim: set ts=8 sw=8 sts=8 noet: */