root / proj / libs / rtc / include / rtc.h @ 345
History | View | Annotate | Download (2.35 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 |
/**
|
23 |
* @brief Read RTC register.
|
24 |
* @param reg Register to read from
|
25 |
* @param data Pointer to save read data
|
26 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
27 |
* @see {_ERRORS_H_::errors}
|
28 |
*/
|
29 |
int (rtc_read_register)(uint32_t reg, uint8_t *data);
|
30 |
/**
|
31 |
* @brief Write RTC register.
|
32 |
* @param reg Register to write to
|
33 |
* @param data Data to write in register
|
34 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
35 |
* @see {_ERRORS_H_::errors}
|
36 |
*/
|
37 |
int (rtc_write_register)(uint32_t reg, uint8_t data);
|
38 |
|
39 |
/**
|
40 |
* @brief Checks if there's an update in progress.
|
41 |
* @return The value of the flag UIP, or ERROR_CODE if error occurs.
|
42 |
*/
|
43 |
int (rtc_check_update)(void); |
44 |
|
45 |
/**
|
46 |
* @brief Enables/Disables updates of time/date registers.
|
47 |
* @param on zero to disable, any other value to enable
|
48 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
49 |
*/
|
50 |
int (rtc_set_updates)(int on); |
51 |
|
52 |
/**
|
53 |
* @brief Reads time from RTC.
|
54 |
* @param time Pointer to array of 3 bytes to store the information about time (hours, minutes, seconds)
|
55 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
56 |
*/
|
57 |
int (rtc_read_time)(uint8_t *time);
|
58 |
|
59 |
/**
|
60 |
* @brief Reads date from RTC.
|
61 |
* @param date Pointer to array of 4 bytes to store the information about date (year, month, day, weekday)
|
62 |
* @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
|
63 |
*/
|
64 |
int (rtc_read_date)(uint8_t *date);
|
65 |
|
66 |
/**
|
67 |
* @}
|
68 |
*/
|
69 |
|
70 |
#endif /* end of include guard: RTC_H_INCLUDED */ |