Loading...
Searching...
No Matches
hrv_motion.c File Reference

Tells whether the wearer kept still while a burst of beat gaps was measured. More...

#include "health/hrv_motion.h"
#include <string.h>

Functions

static uint32_t moved (int16_t now, int16_t before)
 How far one reading moved from the one before, as a positive number.
void hrv_motion_reset (HrvMotion *motion)
 Empties the movement, ready for the next burst.
void hrv_motion_push (HrvMotion *motion, int16_t x_mg, int16_t y_mg, int16_t z_mg)
 Adds one accelerometer sample.
int hrv_motion_score (const HrvMotion *motion)
 The average movement per sample so far.
bool hrv_motion_over (const HrvMotion *motion, uint16_t max_mg)
 Whether the wrist has moved more than a limit through the burst so far.
bool hrv_motion_cannot_pass (const HrvMotion *motion, uint16_t max_mg, uint32_t max_samples)
 Whether the burst can no longer finish under a limit, however still the wrist stays.

Detailed Description

Tells whether the wearer kept still while a burst of beat gaps was measured.

Function Documentation

◆ moved()

uint32_t moved ( int16_t now,
int16_t before )
static

How far one reading moved from the one before, as a positive number.

Parameters
nowThe reading now, in milli-g.
beforeThe reading before, in milli-g.
Returns
The distance between them.