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