root / proj / include / rtc_macros.h @ 250
History | View | Annotate | Download (2.07 KB)
1 | 234 | up20180655 | #ifndef RTC_MACROS_H_INCLUDED
|
---|---|---|---|
2 | #define RTC_MACROS_H_INCLUDED
|
||
3 | |||
4 | #include <lcom/lcf.h> |
||
5 | |||
6 | // RTC IRQ Line
|
||
7 | |||
8 | #define KBC_IRQ 8 /* @brief KBC IRQ Line */ |
||
9 | |||
10 | // RTC Ports
|
||
11 | |||
12 | #define RTC_ADDR_REG 0x70 |
||
13 | #define RTC_DATA_REG 0x71 |
||
14 | |||
15 | // RTC Registers (Byte)
|
||
16 | |||
17 | #define RTC_SEC 0 |
||
18 | #define RTC_SEC_ALARM 1 |
||
19 | #define RTC_MIN 2 |
||
20 | #define RTC_MIN_ALARM 3 |
||
21 | #define RTC_HOUR 4 |
||
22 | #define RTC_HOUR_ALARM 5 |
||
23 | #define RTC_WEEK_DAY 6 |
||
24 | #define RTC_MONTH_DAY 7 |
||
25 | #define RTC_MONTH 8 |
||
26 | #define RTC_YEAR 9 |
||
27 | #define RTC_REG_A 10 |
||
28 | #define RTC_REG_B 11 |
||
29 | #define RTC_REG_C 12 |
||
30 | #define RTC_REG_D 13 |
||
31 | |||
32 | // Register A
|
||
33 | |||
34 | #define RS0 BIT(0) /** @brief Rate selector */ |
||
35 | #define RS1 BIT(1) /** @brief Rate selector */ |
||
36 | #define RS2 BIT(2) /** @brief Rate selector */ |
||
37 | #define RS3 BIT(3) /** @brief Rate selector */ |
||
38 | #define UIP BIT(7) /** @brief Update in progress */ |
||
39 | |||
40 | // Register B
|
||
41 | |||
42 | #define DSE BIT(0) /** @brief Enable Daylight Saving Time */ |
||
43 | #define HOUR_FORM BIT(1) /** @brief Set to 1 for 24h format (0-23), 0 to 12h format (1-12) */ |
||
44 | #define DM BIT(2) /** @brief Set to 1 if registers are in binary, 0 if in BCD */ |
||
45 | #define SQWE BIT(3) /** @brief Enable square wave generation */ |
||
46 | #define UIE BIT(4) /** @brief Enable Update interrupts */ |
||
47 | #define AIE BIT(5) /** @brief Enable alarm interrupts */ |
||
48 | #define PIE BIT(6) /** @brief Enable periodic interrupts */ |
||
49 | #define SET BIT(7) /** @brief Set to 1 to inhibit updates of time/date registers */ |
||
50 | |||
51 | // Register C
|
||
52 | |||
53 | #define UF BIT(4) /** @brief Update Interrupt Pending */ |
||
54 | #define AF BIT(5) /** @brief Alarm Interrupt Pending */ |
||
55 | #define PF BIT(6) /** @brief Periodic Interrupt Pending */ |
||
56 | #define IRQF BIT(7) /** @brief IRQ Line Active */ |
||
57 | |||
58 | // Register D
|
||
59 | |||
60 | #define VRT BIT(7) /** @brief Valid RAM/time - If set to 0 RTC reading aren't valid */ |
||
61 | |||
62 | #endif /* end of include guard: RTC_MACROS_H_INCLUDED */ |