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

Tells how much the wearer's wrist moved while a burst of beat gaps was measured. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  HrvMotion
 The movement seen over one burst. Start it with hrv_motion_reset. More...

Macros

#define HRV_MOTION_STILL_DEFAULT   60
 The top of still a face gets when it sets none, in milli-g a sample.
#define HRV_MOTION_MIN_SAMPLES   20
 Samples needed before the score means anything, two seconds at 10 Hz.

Functions

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 how much the wearer's wrist moved while a burst of beat gaps was measured.

Heart rate variability only means something at rest, and a busy wrist also shakes the sensor. This adds up how far the accelerometer moves from one sample to the next, which leaves the pull of gravity out, and averages it over the burst. Plain C with no SDK, so its specs run on a PC.

The score is milli-g per sample at 10 Hz, and the numbers mean nothing at another rate, since the same motion sampled faster moves less between samples. On a Pebble Time 2 one wearer scored about 23 to 47 sitting still and 57 to 160 eating or fidgeting. The wrist alone cannot tell desk work from walking, since a mouse and keyboard scored 267, so walking is decided by steps instead, in hrv_log_state_of.