MG32F10x Standard Peripherals Firmware Library

mg32f10x_rtc.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F10x_RTC_H
12 #define __MG32F10x_RTC_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20
29 /* Exported types ------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31
40 #define RTC_IT_OW ((uint16_t)0x0004)
41 #define RTC_IT_ALR ((uint16_t)0x0002)
42 #define RTC_IT_SEC ((uint16_t)0x0001)
43 #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00))
44 #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \
45 ((IT) == RTC_IT_SEC))
46
54 #define RTC_FLAG_RTOFF ((uint16_t)0x0020)
55 #define RTC_FLAG_RSF ((uint16_t)0x0008)
56 #define RTC_FLAG_OW ((uint16_t)0x0004)
57 #define RTC_FLAG_ALR ((uint16_t)0x0002)
58 #define RTC_FLAG_SEC ((uint16_t)0x0001)
59 #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00))
60 #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \
61 ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \
62 ((FLAG) == RTC_FLAG_SEC))
63 #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF)
64
73 /* Exported macro ------------------------------------------------------------*/
74 /* Exported functions --------------------------------------------------------*/
75
76 void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
77 void RTC_EnterConfigMode(void);
78 void RTC_ExitConfigMode(void);
79 uint32_t RTC_GetCounter(void);
80 void RTC_SetCounter(uint32_t CounterValue);
81 void RTC_SetPrescaler(uint32_t PrescalerValue);
82 void RTC_SetAlarm(uint32_t AlarmValue);
83 uint32_t RTC_GetDivider(void);
84 void RTC_WaitForLastTask(void);
85 void RTC_WaitForSynchro(void);
86 FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
87 void RTC_ClearFlag(uint16_t RTC_FLAG);
88 ITStatus RTC_GetITStatus(uint16_t RTC_IT);
89 void RTC_ClearITPendingBit(uint16_t RTC_IT);
90
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif /* __MG32F10x_RTC_H */
RTC_ExitConfigMode
void RTC_ExitConfigMode(void)
Exits from the RTC configuration mode.
Definition: mg32f10x_rtc.c:86
RTC_GetFlagStatus
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG)
Checks whether the specified RTC flag is set or not.
Definition: mg32f10x_rtc.c:203
RTC_SetCounter
void RTC_SetCounter(uint32_t CounterValue)
Sets the RTC counter value.
Definition: mg32f10x_rtc.c:107
RTC_WaitForLastTask
void RTC_WaitForLastTask(void)
Waits until last write operation on RTC registers has finished.
Definition: mg32f10x_rtc.c:166
RTC_GetITStatus
ITStatus RTC_GetITStatus(uint16_t RTC_IT)
Checks whether the specified RTC interrupt has occurred or not.
Definition: mg32f10x_rtc.c:250
RTC_ITConfig
void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState)
Enables or disables the specified RTC interrupts.
Definition: mg32f10x_rtc.c:54
RTC_ClearITPendingBit
void RTC_ClearITPendingBit(uint16_t RTC_IT)
Clears the RTC's interrupt pending bits.
Definition: mg32f10x_rtc.c:277
RTC_SetAlarm
void RTC_SetAlarm(uint32_t AlarmValue)
Sets the RTC alarm value.
Definition: mg32f10x_rtc.c:140
RTC_GetDivider
uint32_t RTC_GetDivider(void)
Gets the RTC divider value.
Definition: mg32f10x_rtc.c:155
RTC_WaitForSynchro
void RTC_WaitForSynchro(void)
Waits until the RTC registers (RTC_CNT, RTC_ALR and RTC_PRL) are synchronized with RTC APB clock.
Definition: mg32f10x_rtc.c:182
RTC_EnterConfigMode
void RTC_EnterConfigMode(void)
Enters the RTC configuration mode.
Definition: mg32f10x_rtc.c:75
RTC_SetPrescaler
void RTC_SetPrescaler(uint32_t PrescalerValue)
Sets the RTC prescaler value.
Definition: mg32f10x_rtc.c:122
RTC_GetCounter
uint32_t RTC_GetCounter(void)
Gets the RTC counter value.
Definition: mg32f10x_rtc.c:97
RTC_ClearFlag
void RTC_ClearFlag(uint16_t RTC_FLAG)
Clears the RTC's pending flags.
Definition: mg32f10x_rtc.c:232