/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock
58 by edam
removed Bounce library and updated/fixed new code
1
/*
2
 * time.h
3
 *
4
 * Copyright (C) 2011 Tim Marston <tim@ed.am> and Dan Marston.
5
 *
6
 * This file is part of propeller-clock (hereafter referred to as "this
7
 * program"). See http://ed.am/dev/software/arduino/propeller-clock for more
8
 * information.
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Lesser General Public License as published
12
 * by the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU Lesser General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Lesser General Public License
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 */
23
#ifndef _TIME_H_
24
#define _TIME_H_
25
26
66 by Tim Marston
removed time singleton, not cause it saved much space, but cause i don't want singletons in this project!
27
namespace Time
56 by edam
updated software to include drawing abstraction infrastructure
28
{
29
	/**
89 by Tim Marston
moved rount Time a bit, and passed _button to SettingsMajorMode so that it can
30
	 * Initialise time from store.
31
	 */
32
	void load_time();
33
34
	/**
35
	 * Save the time to the store.
36
	 */
37
	void save_time();
38
39
	/**
62 by edam
moved some stuf round, created a re-usable pool of message buffers, genericised "modes" for messages
40
	 * Get year.
41
	 *
42
	 * @return year
43
	 */
44
	int get_year();
45
46
	/**
47
	 * Get month.
48
	 *
49
	 * @return month, 1 to 12
50
	 */
51
	int get_month();
52
53
	/**
54
	 * Get month name.
55
	 *
56
	 * @return month name
57
	 */
58
	const char *get_month_name();
59
60
	/**
61
	 * Get day.
62
	 *
63
	 * @return date, 1 to 31
64
	 */
65
	int get_day();
66
67
	/**
68
	 * Get number suffix.
69
	 *
70
	 * @param number
71
	 * @return suffix
72
	 */
73
	const char *get_day_suffix();
74
75
	/**
56 by edam
updated software to include drawing abstraction infrastructure
76
	 * Get hours.
77
	 *
78
	 * @return hours, 0 to 23
79
	 */
80
	int get_hours();
81
82
	/**
83
	 * Get minutes.
84
	 *
85
	 * @return minutes, 0 to 59
86
	 */
87
	int get_minutes();
88
89
	/**
90
	 * Get seconds.
91
	 *
92
	 * @return seconds, 0 to 59
93
	 */
94
	int get_seconds();
95
96
	/**
97
	 * Update the time.
98
	 */
99
	void update();
100
66 by Tim Marston
removed time singleton, not cause it saved much space, but cause i don't want singletons in this project!
101
	/**
71 by Tim Marston
added time set mode, made text renderer's buffer auto reset/output
102
	 * Increment the hours and save the time.
103
	 */
104
	void inc_hours();
105
106
	/**
107
	 * Increment the minutes and save the time.
108
	 */
109
	void inc_minutes();
110
111
	/**
112
	 * Reset the seconds and save the time.
113
	 */
114
	void reset_seconds();
115
116
	/**
117
	 * Increment the year and save the time.
118
	 */
119
	void inc_year();
120
121
	/**
122
	 * Increment the month and save the time.
123
	 */
124
	void inc_month();
125
126
	/**
127
	 * Increment the day and save the time.
128
	 */
129
	void inc_day();
130
56 by edam
updated software to include drawing abstraction infrastructure
131
};
58 by edam
removed Bounce library and updated/fixed new code
132
133
74 by Tim Marston
fixed bug initialising text services on mode activation
134
#endif //_TIME_H_