3328 |
povik |
1 |
/** |
|
|
2 |
****************************************************************************** |
|
|
3 |
* @file stm32f10x_rtc.h |
|
|
4 |
* @author MCD Application Team |
|
|
5 |
* @version V3.1.0 |
|
|
6 |
* @date 06/19/2009 |
|
|
7 |
* @brief This file contains all the functions prototypes for the RTC firmware |
|
|
8 |
* library. |
|
|
9 |
****************************************************************************** |
|
|
10 |
* @copy |
|
|
11 |
* |
|
|
12 |
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
|
|
13 |
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE |
|
|
14 |
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY |
|
|
15 |
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING |
|
|
16 |
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE |
|
|
17 |
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
|
|
18 |
* |
|
|
19 |
* <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2> |
|
|
20 |
*/ |
|
|
21 |
|
|
|
22 |
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
|
23 |
#ifndef __STM32F10x_RTC_H |
|
|
24 |
#define __STM32F10x_RTC_H |
|
|
25 |
|
|
|
26 |
#ifdef __cplusplus |
|
|
27 |
extern "C" { |
|
|
28 |
#endif |
|
|
29 |
|
|
|
30 |
/* Includes ------------------------------------------------------------------*/ |
|
|
31 |
#include "stm32f10x.h" |
|
|
32 |
|
|
|
33 |
/** @addtogroup STM32F10x_StdPeriph_Driver |
|
|
34 |
* @{ |
|
|
35 |
*/ |
|
|
36 |
|
|
|
37 |
/** @addtogroup RTC |
|
|
38 |
* @{ |
|
|
39 |
*/ |
|
|
40 |
|
|
|
41 |
/** @defgroup RTC_Exported_Types |
|
|
42 |
* @{ |
|
|
43 |
*/ |
|
|
44 |
|
|
|
45 |
/** |
|
|
46 |
* @} |
|
|
47 |
*/ |
|
|
48 |
|
|
|
49 |
/** @defgroup RTC_Exported_Constants |
|
|
50 |
* @{ |
|
|
51 |
*/ |
|
|
52 |
|
|
|
53 |
/** @defgroup RTC_interrupts_define |
|
|
54 |
* @{ |
|
|
55 |
*/ |
|
|
56 |
|
|
|
57 |
#define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ |
|
|
58 |
#define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ |
|
|
59 |
#define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ |
|
|
60 |
#define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) |
|
|
61 |
#define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ |
|
|
62 |
((IT) == RTC_IT_SEC)) |
|
|
63 |
/** |
|
|
64 |
* @} |
|
|
65 |
*/ |
|
|
66 |
|
|
|
67 |
/** @defgroup RTC_interrupts_flags |
|
|
68 |
* @{ |
|
|
69 |
*/ |
|
|
70 |
|
|
|
71 |
#define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ |
|
|
72 |
#define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ |
|
|
73 |
#define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ |
|
|
74 |
#define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ |
|
|
75 |
#define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ |
|
|
76 |
#define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) |
|
|
77 |
#define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ |
|
|
78 |
((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ |
|
|
79 |
((FLAG) == RTC_FLAG_SEC)) |
|
|
80 |
#define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) |
|
|
81 |
|
|
|
82 |
/** |
|
|
83 |
* @} |
|
|
84 |
*/ |
|
|
85 |
|
|
|
86 |
/** |
|
|
87 |
* @} |
|
|
88 |
*/ |
|
|
89 |
|
|
|
90 |
/** @defgroup RTC_Exported_Macros |
|
|
91 |
* @{ |
|
|
92 |
*/ |
|
|
93 |
|
|
|
94 |
/** |
|
|
95 |
* @} |
|
|
96 |
*/ |
|
|
97 |
|
|
|
98 |
/** @defgroup RTC_Exported_Functions |
|
|
99 |
* @{ |
|
|
100 |
*/ |
|
|
101 |
|
|
|
102 |
void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); |
|
|
103 |
void RTC_EnterConfigMode(void); |
|
|
104 |
void RTC_ExitConfigMode(void); |
|
|
105 |
uint32_t RTC_GetCounter(void); |
|
|
106 |
void RTC_SetCounter(uint32_t CounterValue); |
|
|
107 |
void RTC_SetPrescaler(uint32_t PrescalerValue); |
|
|
108 |
void RTC_SetAlarm(uint32_t AlarmValue); |
|
|
109 |
uint32_t RTC_GetDivider(void); |
|
|
110 |
void RTC_WaitForLastTask(void); |
|
|
111 |
void RTC_WaitForSynchro(void); |
|
|
112 |
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); |
|
|
113 |
void RTC_ClearFlag(uint16_t RTC_FLAG); |
|
|
114 |
ITStatus RTC_GetITStatus(uint16_t RTC_IT); |
|
|
115 |
void RTC_ClearITPendingBit(uint16_t RTC_IT); |
|
|
116 |
|
|
|
117 |
#ifdef __cplusplus |
|
|
118 |
} |
|
|
119 |
#endif |
|
|
120 |
|
|
|
121 |
#endif /* __STM32F10x_RTC_H */ |
|
|
122 |
/** |
|
|
123 |
* @} |
|
|
124 |
*/ |
|
|
125 |
|
|
|
126 |
/** |
|
|
127 |
* @} |
|
|
128 |
*/ |
|
|
129 |
|
|
|
130 |
/** |
|
|
131 |
* @} |
|
|
132 |
*/ |
|
|
133 |
|
|
|
134 |
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ |