Loading...
Searching...
No Matches
hr_day.h
Go to the documentation of this file.
1
12#pragma once
13#include <stdbool.h>
14#include <stdint.h>
15
20
21#define HR_DAY_HOURS 24
22
24typedef struct
25{
26 uint16_t sum;
27 uint8_t count;
28 uint8_t low;
29 uint8_t high;
30} HrHour;
31
33typedef struct
34{
36} HrDay;
37
43void hr_day_clear(HrDay *day);
44
56void hr_day_add(HrDay *day, int hour, int bpm);
57
65int hr_day_hour_avg(const HrDay *day, int hour);
66
78void hr_day_stats(const HrDay *day, int *low, int *avg, int *high);
79
void hr_day_clear(HrDay *day)
Empties the day, for a new day or a fresh start.
Definition hr_day.c:9
void hr_day_add(HrDay *day, int hour, int bpm)
Adds one reading to its hour.
Definition hr_day.c:14
void hr_day_stats(const HrDay *day, int *low, int *avg, int *high)
The day's lowest and highest readings, and the average of every reading so far.
Definition hr_day.c:58
int hr_day_hour_avg(const HrDay *day, int hour)
The average of one hour's readings.
Definition hr_day.c:42
#define HR_DAY_HOURS
Today's hours from midnight.
Definition hr_day.h:21
Today's heart rate, one entry an hour from midnight.
Definition hr_day.h:34
HrHour hours[HR_DAY_HOURS]
Each hour's readings, midnight first.
Definition hr_day.h:35
The readings that landed in one hour.
Definition hr_day.h:25
uint8_t high
The highest reading.
Definition hr_day.h:29
uint8_t count
How many readings, or 0 for an hour with none.
Definition hr_day.h:27
uint8_t low
The lowest reading.
Definition hr_day.h:28
uint16_t sum
The readings added together.
Definition hr_day.h:26