root / proj / libs / rtc / include / rtc.h @ 334
History | View | Annotate | Download (1.81 KB)
1 |
#ifndef RTC_H_INCLUDED
|
---|---|
2 |
#define RTC_H_INCLUDED
|
3 |
|
4 |
/**
|
5 |
* @defgroup rtc rtc
|
6 |
* @brief RTC (Real-Time Clock) module.
|
7 |
*
|
8 |
* @{
|
9 |
*/
|
10 |
|
11 |
#include <stdint.h> |
12 |
|
13 |
/**
|
14 |
* @brief Subscribes RTC Interrupts
|
15 |
* @param interrupt_bit Bit of Interrupt Vector that will be set when RTC Interrupt is pending
|
16 |
* @param interrupt_id RTC Interrupt ID to specify the RTC Interrupt in other calls
|
17 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
18 |
* @see {_ERRORS_H_::errors}
|
19 |
*/
|
20 |
int (subscribe_rtc_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
21 |
|
22 |
int (rtc_read_register)(uint32_t reg, uint8_t *data);
|
23 |
|
24 |
int (rtc_write_register)(uint32_t reg, uint8_t data);
|
25 |
|
26 |
/**
|
27 |
* @brief Checks if there's an update in progress.
|
28 |
* @return The value of the flag UIP, or ERROR_CODE if error occurs.
|
29 |
*/
|
30 |
int (rtc_check_update)(void); |
31 |
|
32 |
/**
|
33 |
* @brief Enables/Disables updates of time/date registers.
|
34 |
* @param on zero to disable, any other value to enable
|
35 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
36 |
*/
|
37 |
int (rtc_set_updates)(int on); |
38 |
|
39 |
/**
|
40 |
* @brief Reads time from RTC.
|
41 |
* @param time Pointer to array of 3 bytes to store the information about time (hours, minutes, seconds)
|
42 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
43 |
*/
|
44 |
int (rtc_read_time)(uint8_t *time);
|
45 |
|
46 |
/**
|
47 |
* @brief Reads date from RTC.
|
48 |
* @param date Pointer to array of 4 bytes to store the information about date (year, month, day, weekday)
|
49 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
50 |
*/
|
51 |
int (rtc_read_date)(uint8_t *date);
|
52 |
|
53 |
/**
|
54 |
* @}
|
55 |
*/
|
56 |
|
57 |
#endif /* end of include guard: RTC_H_INCLUDED */ |