/
timesetter.h
44 lines (34 loc) · 1.14 KB
/
timesetter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef timesetter_h_INCLUDED
#define timesetter_h_INCLUDED
#include "qpn_port.h"
/**
* Create the time setter.
*/
void timesetter_ctor(void);
/**
*/
struct TimeSetter {
QActive super;
/** Set false when we enter the time setting states, true when we
change the time in the time setting states. Used to decide whether
or not to set the current time after we've finished in the time
setting states. Later, will also indicate whether we update the
time in the RTC when we exit those states. */
uint8_t timeSetChanged;
/** The new time used by the time setting states. Hours, minutes, and
seconds. These values are incremented and decremented separately
by code that is aware of the current mode. */
uint8_t setTime[3];
/** Count timeouts in the time setting states. */
uint8_t setTimeouts;
/** Set true when we are able to receive signals. */
uint8_t ready;
/** Indicates whether we are setting the time or the alarm. */
uint8_t settingWhich;
/** A temporary holder for the alarm state. */
uint8_t alarmOn;
};
#define SETTING_ALARM 'A'
#define SETTING_TIME 'T'
extern struct TimeSetter timesetter;
#endif