/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
	/**
62 by edam
moved some stuf round, created a re-usable pool of message buffers, genericised "modes" for messages
30
	 * Get year.
31
	 *
32
	 * @return year
33
	 */
34
	int get_year();
35
36
	/**
37
	 * Get month.
38
	 *
39
	 * @return month, 1 to 12
40
	 */
41
	int get_month();
42
43
	/**
44
	 * Get month name.
45
	 *
46
	 * @return month name
47
	 */
48
	const char *get_month_name();
49
50
	/**
51
	 * Get day.
52
	 *
53
	 * @return date, 1 to 31
54
	 */
55
	int get_day();
56
57
	/**
58
	 * Get number suffix.
59
	 *
60
	 * @param number
61
	 * @return suffix
62
	 */
63
	const char *get_day_suffix();
64
65
	/**
56 by edam
updated software to include drawing abstraction infrastructure
66
	 * Get hours.
67
	 *
68
	 * @return hours, 0 to 23
69
	 */
70
	int get_hours();
71
72
	/**
73
	 * Get minutes.
74
	 *
75
	 * @return minutes, 0 to 59
76
	 */
77
	int get_minutes();
78
79
	/**
80
	 * Get seconds.
81
	 *
82
	 * @return seconds, 0 to 59
83
	 */
84
	int get_seconds();
85
86
	/**
87
	 * Update the time.
88
	 */
89
	void update();
90
66 by Tim Marston
removed time singleton, not cause it saved much space, but cause i don't want singletons in this project!
91
	/**
92
	 * Initialise time data
93
	 */
94
	void init();
56 by edam
updated software to include drawing abstraction infrastructure
95
71 by Tim Marston
added time set mode, made text renderer's buffer auto reset/output
96
	/**
97
	 * Increment the hours and save the time.
98
	 */
99
	void inc_hours();
100
101
	/**
102
	 * Increment the minutes and save the time.
103
	 */
104
	void inc_minutes();
105
106
	/**
107
	 * Reset the seconds and save the time.
108
	 */
109
	void reset_seconds();
110
111
	/**
112
	 * Increment the year and save the time.
113
	 */
114
	void inc_year();
115
116
	/**
117
	 * Increment the month and save the time.
118
	 */
119
	void inc_month();
120
121
	/**
122
	 * Increment the day and save the time.
123
	 */
124
	void inc_day();
125
56 by edam
updated software to include drawing abstraction infrastructure
126
};
58 by edam
removed Bounce library and updated/fixed new code
127
128
74 by Tim Marston
fixed bug initialising text services on mode activation
129
#endif //_TIME_H_