Loading...
Searching...
No Matches
health_hrv.h
Go to the documentation of this file.
1
11#pragma once
12#include <pebble.h>
13#include "health/hrv_log.h"
14
19
23typedef struct
24{
25 bool live;
26 uint16_t period_sec;
27 uint16_t still_mg;
28 uint16_t walk_steps;
29 uint16_t settle_gaps;
31 bool keep_all;
33 uint32_t persist_key;
35
48void health_hrv_start(const HealthHrvConfig *cfg, int seed_ms, const HrvLog *seed_log, void (*changed)(void));
49
56void health_hrv_set_period(uint16_t period_sec);
57
70void health_hrv_set_rules(uint16_t still_mg, uint16_t walk_steps, uint16_t settle_gaps, HrvCount count, bool keep_all,
71 bool live_redraw);
72
74void health_hrv_on_gap(void);
75
77void health_hrv_poll(void);
78
80void health_hrv_stop(void);
81
83int health_hrv_ms(void);
84
86bool health_hrv_sampling(void);
87
89bool health_hrv_measuring(void);
90
92const HrvLog *health_hrv_log(void);
93
101bool health_hrv_recent(int back, HrvBurst *out);
102
111bool health_hrv_live(int *score, int *steps, int *held_sec);
112
114uint16_t health_hrv_still_mg(void);
115
117uint16_t health_hrv_walk_steps(void);
118
120uint16_t health_hrv_settle_gaps(void);
121
HrvCount
Which bursts count for the main reading. The first is the one a face gets when it sets none.
Definition hrv_log.h:45
uint16_t health_hrv_still_mg(void)
The still limit in use, in milli-g a sample.
Definition health_hrv.c:785
int health_hrv_ms(void)
The latest reading as RMSSD in ms, or -1 if there is none or it went stale.
Definition health_hrv.c:735
void health_hrv_on_gap(void)
Reads one beat gap from the watch. The health store calls it for each HRV event.
Definition health_hrv.c:406
void health_hrv_start(const HealthHrvConfig *cfg, int seed_ms, const HrvLog *seed_log, void(*changed)(void))
Starts HRV with the health store's rules, or starts it again with new ones.
Definition health_hrv.c:597
void health_hrv_poll(void)
The HRV turn on the face's cadence, which the health store passes on while it is live.
Definition health_hrv.c:497
uint16_t health_hrv_walk_steps(void)
The steps through a burst that make it a walk.
Definition health_hrv.c:790
bool health_hrv_measuring(void)
Whether a burst is being measured right now, with the sensor held on.
Definition health_hrv.c:745
bool health_hrv_sampling(void)
Whether the watch took the last request for beat gaps.
Definition health_hrv.c:740
void health_hrv_set_period(uint16_t period_sec)
Changes how often the watch takes a burst. A period of 0 stops the sampling and puts the reading back...
Definition health_hrv.c:675
bool health_hrv_recent(int back, HrvBurst *out)
One of the latest bursts, dropped ones included, newest first.
Definition health_hrv.c:755
const HrvLog * health_hrv_log(void)
The readings kept for the face's panels. Never NULL.
Definition health_hrv.c:750
uint16_t health_hrv_settle_gaps(void)
The gaps left out at the start of each burst.
Definition health_hrv.c:795
bool health_hrv_live(int *score, int *steps, int *held_sec)
The burst being held right now.
Definition health_hrv.c:772
void health_hrv_set_rules(uint16_t still_mg, uint16_t walk_steps, uint16_t settle_gaps, HrvCount count, bool keep_all, bool live_redraw)
Changes the rules for which bursts count and how they are measured, such as when the wearer changes a...
Definition health_hrv.c:708
void health_hrv_stop(void)
Stops the sampling, since the watch keeps an app's request going for an hour after it closes.
Definition health_hrv.c:721
The heart rate variability readings kept for a face's panels: the last few with what the wearer was d...
The HRV rules the health store passes on from its own config.
Definition health_hrv.h:24
bool live
True asks the watch for beat gaps, and false just keeps the seed.
Definition health_hrv.h:25
uint16_t walk_steps
The steps through a burst that make it a walk, or 0 for HRV_WALK_STEPS_DEFAULT.
Definition health_hrv.h:28
uint16_t period_sec
How often the watch takes a burst, in seconds, or 0 for not at all.
Definition health_hrv.h:26
bool keep_all
Measure a burst that cannot count rather than drop it, for a panel that shows it.
Definition health_hrv.h:31
HrvCount count
Which bursts count for the main reading.
Definition health_hrv.h:30
uint16_t settle_gaps
Gaps left out at the start of a burst, or 0 for HRV_SETTLE_GAPS.
Definition health_hrv.h:29
bool live_redraw
Redraw the face once a second while a burst is held, for a readout that shows each burst.
Definition health_hrv.h:32
uint16_t still_mg
The most the wrist may move for a burst to be still, or 0 for HRV_MOTION_STILL_DEFAULT.
Definition health_hrv.h:27
uint32_t persist_key
The persist slot for the log, or 0 to keep it in memory only.
Definition health_hrv.h:33
One burst, for a readout that shows each burst: what the wearer did and what came of it.
Definition hrv_log.h:59
The readings kept, in the shape that goes to flash. Start it with hrv_log_reset.
Definition hrv_log.h:77