Revision 193
added get and reset functions back in to work with existing code, added get from a particular function, and reset all
time.c | ||
---|---|---|
79 | 79 |
int rtc_multi_init(int* prescale_opt, void (*rtc_func[])(void), int argc) { |
80 | 80 |
|
81 | 81 |
//Check that the number of functions doesn't exceed alloted space |
82 |
if(argc >= MAX_FUNCTIONS)
|
|
82 |
if(argc > MAX_FUNCTIONS) |
|
83 | 83 |
return -1; |
84 | 84 |
|
85 | 85 |
function_count = argc; |
... | ... | |
147 | 147 |
* |
148 | 148 |
* @see rtc_init, rtc_reset |
149 | 149 |
**/ |
150 |
/* |
|
150 |
|
|
151 | 151 |
int rtc_get(void){ |
152 |
return _rtc_val; |
|
153 |
}*/
|
|
152 |
return _rtc_val[0];
|
|
153 |
} |
|
154 | 154 |
|
155 |
int rtc_get_pos(int pos){ |
|
156 |
return _rtc_val[pos]; |
|
157 |
} |
|
158 |
|
|
155 | 159 |
/** |
156 | 160 |
* Resets the real time clock counter to 0. |
157 | 161 |
* |
158 | 162 |
* @see rtc_init, rtc_get |
159 | 163 |
**/ |
160 |
/* |
|
164 |
|
|
161 | 165 |
void rtc_reset(void){ |
162 |
_rtc_val = 0; |
|
163 |
}*/
|
|
166 |
_rtc_val[0] = 0;
|
|
167 |
} |
|
164 | 168 |
|
169 |
void rtc_reset_all(void) |
|
170 |
{ |
|
171 |
for(int i =0; i <MAX_FUNCTIONS; i++) |
|
172 |
_rtc_val[i] = 0; |
|
173 |
} |
|
174 |
|
|
165 | 175 |
/** @} **/ //end defgroup |
166 | 176 |
|
167 | 177 |
/* Called every pulse. Function in _rtc_f is called every _rtc_scale and also the counter is updated. |
Also available in: Unified diff