jump_rope_count_device.h 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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;
  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;
  17. int cy_suppress;
  18. };
  19. struct sensor_packet
  20. {
  21. float ax, ay, az, gx, gy, gz, cy;
  22. };
  23. enum jump_rope_count_result
  24. {
  25. RESULT_INACTIVE = -1,
  26. RESULT_NONE = 0,
  27. RESULT_TRIGGERED = 1
  28. };
  29. extern int jump_rope_count_device_init(struct jump_rope_count_device *dev,
  30. struct jump_rope_count_config *cfg);
  31. extern int process_packet(struct jump_rope_count_device *dev,
  32. struct sensor_packet *packet,
  33. enum jump_rope_count_result *result);
  34. #endif
  35. /* vim: set ts=8 sw=8 sts=8 noet: */