Pebble App Framework
v7.1.1
How It Works
CLI
Device API
Phone API
C Coverage
TS Coverage
GitHub
Theme
Pebble App Framework: Device API
Toggle main menu visibility
Loading...
Searching...
No Matches
goal_latch.h
Go to the documentation of this file.
1
18
#pragma once
19
#include <stdint.h>
20
25
29
typedef
enum
30
{
31
GOAL_LATCH_STEPS
,
32
GOAL_LATCH_CALORIES
,
33
GOAL_LATCH_DISTANCE
,
34
GOAL_LATCH_ACTIVE
,
35
GOAL_LATCH_COUNT
36
}
GoalLatchGoal
;
37
39
#define GOAL_LATCH_BIT(goal) ((uint8_t)(1u << (goal)))
40
44
typedef
struct
45
{
46
int
day
;
47
uint8_t
below
;
48
uint8_t
met
;
49
}
GoalLatch
;
50
51
#define GOAL_LATCH_EMPTY {.day = -1}
52
66
uint8_t
goal_latch_update
(
GoalLatch
*latch,
int
day,
const
int
readings[
GOAL_LATCH_COUNT
],
67
const
int
targets[
GOAL_LATCH_COUNT
]);
68
goal_latch_update
uint8_t goal_latch_update(GoalLatch *latch, int day, const int readings[GOAL_LATCH_COUNT], const int targets[GOAL_LATCH_COUNT])
Takes the latest readings and says which goals they just met.
Definition
goal_latch.c:9
GoalLatchGoal
GoalLatchGoal
The goals the latch watches, in the order it reads their readings and targets.
Definition
goal_latch.h:30
GOAL_LATCH_ACTIVE
@ GOAL_LATCH_ACTIVE
Active minutes so far today.
Definition
goal_latch.h:34
GOAL_LATCH_STEPS
@ GOAL_LATCH_STEPS
Steps so far today.
Definition
goal_latch.h:31
GOAL_LATCH_COUNT
@ GOAL_LATCH_COUNT
How many goals the latch watches.
Definition
goal_latch.h:35
GOAL_LATCH_DISTANCE
@ GOAL_LATCH_DISTANCE
Walked distance so far today, in metres.
Definition
goal_latch.h:33
GOAL_LATCH_CALORIES
@ GOAL_LATCH_CALORIES
Active calories so far today.
Definition
goal_latch.h:32
GoalLatch
Remembers which goals were met today.
Definition
goal_latch.h:45
GoalLatch::day
int day
The day the marks belong to, as tm_yday, or -1 before the first look.
Definition
goal_latch.h:46
GoalLatch::met
uint8_t met
One GOAL_LATCH_BIT for each goal already met today.
Definition
goal_latch.h:48
GoalLatch::below
uint8_t below
One GOAL_LATCH_BIT for each goal with a reading below its target today.
Definition
goal_latch.h:47
src
c
core
health
goal_latch.h
Generated by
1.18.0