| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

BlueNRG1_rtc.h
Go to the documentation of this file.
1
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef BLUENRG1_RTC_H
25 #define BLUENRG1_RTC_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* Includes ------------------------------------------------------------------*/
32 #include "BlueNRG1.h"
33
49 typedef struct
50 {
51 uint8_t RTC_operatingMode;
54 uint32_t RTC_TLR1;
57 uint32_t RTC_TLR2;
60 uint32_t RTC_PATTERN_SIZE;
63 uint32_t RTC_PATTERN1;
66 uint32_t RTC_PATTERN2;
69 uint32_t RTC_PATTERN3;
72 uint32_t RTC_PATTERN4;
74 } RTC_InitType;
75
76
80 typedef struct
81 {
82 uint8_t Second;
85 uint8_t Minute;
88 uint8_t Hour;
91 uint8_t WeekDay;
94 uint8_t MonthDay;
97 uint8_t Month;
100 uint16_t Year;
103 } RTC_DateTimeType;
104
118 #define RTC_Month_January ((uint8_t)0x01)
119 #define RTC_Month_February ((uint8_t)0x02)
120 #define RTC_Month_March ((uint8_t)0x03)
121 #define RTC_Month_April ((uint8_t)0x04)
122 #define RTC_Month_May ((uint8_t)0x05)
123 #define RTC_Month_June ((uint8_t)0x06)
124 #define RTC_Month_July ((uint8_t)0x07)
125 #define RTC_Month_August ((uint8_t)0x08)
126 #define RTC_Month_September ((uint8_t)0x09)
127 #define RTC_Month_October ((uint8_t)0x10)
128 #define RTC_Month_November ((uint8_t)0x11)
129 #define RTC_Month_December ((uint8_t)0x12)
130
131 #define RTC_Weekday_Monday ((uint8_t)0x01)
132 #define RTC_Weekday_Tuesday ((uint8_t)0x02)
133 #define RTC_Weekday_Wednesday ((uint8_t)0x03)
134 #define RTC_Weekday_Thursday ((uint8_t)0x04)
135 #define RTC_Weekday_Friday ((uint8_t)0x05)
136 #define RTC_Weekday_Saturday ((uint8_t)0x06)
137 #define RTC_Weekday_Sunday ((uint8_t)0x07)
138
139 #define IS_SECOND(N) ((N) < 60)
140 #define IS_MINUTE(N) ((N) < 60)
141 #define IS_HOUR(N) ((N) < 24)
142 #define IS_WEEKDAY(N) (((N) > 0) && ((N) < 8))
143 #define IS_MONTHDAY(N) (((N) > 0) && ((N) < 32))
144 #define IS_MONTH(N) (((N) > 0) && ((N) < 13))
145 #define IS_YEAR(N) (((N) > 0) && ((N) < 4000))
146
147 #define IS_MATCH_WEEKDAY(N) ((N) < 8)
148 #define IS_MATCH_MONTHDAY(N) ((N) < 32)
149 #define IS_MATCH_MONTH(N) ((N) < 13)
150 #define IS_MATCH_YEAR(N) ((N) < 4000)
151
152
162 #define RTC_IT_CLOCKWATCH ((uint8_t)1)
163 #define RTC_IT_TIMER ((uint8_t)2)
167 #define IS_RTC_IT(IT) (((IT) == RTC_IT_CLOCKWATCH) || \
168 ((IT) == RTC_IT_TIMER))
169
177 #define RTC_TIMER_PERIODIC ((uint8_t)0)
178 #define RTC_TIMER_ONESHOT ((uint8_t)1)
182 #define IS_RTC_TIMER_MODE(IT) (((IT) == RTC_TIMER_PERIODIC) || \
183 ((IT) == RTC_TIMER_ONESHOT))
184
193 #define IS_PATTERN(N) ((N) < 0x80)
194
207 void RTC_Init(RTC_InitType* RTC_InitStruct);
208 void RTC_Cmd(FunctionalState NewState);
209 void RTC_IT_Config(uint8_t RTC_IT, FunctionalState NewState);
210 ITStatus RTC_IT_Status(uint8_t RTC_IT);
211 void RTC_IT_Clear(uint8_t RTC_IT);
212
213 void RTC_ClockwatchCmd(FunctionalState NewState);
214 void RTC_SetTimeDate(RTC_DateTimeType* RTC_DateTime);
215 void RTC_SetMatchTimeDate(RTC_DateTimeType* RTC_MatchDataTime);
216 void RTC_GetTimeDate(RTC_DateTimeType* RTC_DataTime);
217
218 uint32_t RTC_GetTimerValue(void);
219 void RTC_AutoStart(FunctionalState NewState);
220 void RTC_SelectTrimmedClock(FunctionalState NewState);
221 uint32_t RTC_GetNumberIrqGenerated(void);
222
235 #ifdef __cplusplus
236 }
237 #endif
238
239 #endif /* BLUENRG1_RTC_H */
240
241 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
RTC_GetTimeDate
void RTC_GetTimeDate(RTC_DateTimeType *RTC_DataTime)
Set the RTC clockwatch match date and time registers.
Definition: BlueNRG1_rtc.c:291
RTC_DateTimeType::Hour
uint8_t Hour
Definition: BlueNRG1_rtc.h:88
RTC_InitType::RTC_PATTERN4
uint32_t RTC_PATTERN4
Definition: BlueNRG1_rtc.h:72
RTC_IT_Status
ITStatus RTC_IT_Status(uint8_t RTC_IT)
Return the RTC interrupt status for the specified IT.
Definition: BlueNRG1_rtc.c:156
RTC_DateTimeType::Second
uint8_t Second
Definition: BlueNRG1_rtc.h:82
RTC_SetTimeDate
void RTC_SetTimeDate(RTC_DateTimeType *RTC_DateTime)
Initialize the RTC clockwatch with present time and date.
Definition: BlueNRG1_rtc.c:213
RTC_DateTimeType::Month
uint8_t Month
Definition: BlueNRG1_rtc.h:97
RTC_InitType::RTC_PATTERN3
uint32_t RTC_PATTERN3
Definition: BlueNRG1_rtc.h:69
RTC_SetMatchTimeDate
void RTC_SetMatchTimeDate(RTC_DateTimeType *RTC_MatchDataTime)
Set the RTC clockwatch match date and time registers.
Definition: BlueNRG1_rtc.c:252
RTC_DateTimeType::WeekDay
uint8_t WeekDay
Definition: BlueNRG1_rtc.h:91
RTC_DateTimeType
Structure definition of RTC DateTime.
Definition: BlueNRG1_rtc.h:80
RTC_InitType::RTC_operatingMode
uint8_t RTC_operatingMode
Definition: BlueNRG1_rtc.h:51
RTC_InitType::RTC_PATTERN2
uint32_t RTC_PATTERN2
Definition: BlueNRG1_rtc.h:66
RTC_DateTimeType::MonthDay
uint8_t MonthDay
Definition: BlueNRG1_rtc.h:94
RTC_InitType
Structure definition of RTC initialization.
Definition: BlueNRG1_rtc.h:49
RTC_GetTimerValue
uint32_t RTC_GetTimerValue(void)
Return the actual timer counter.
Definition: BlueNRG1_rtc.c:320
RTC_InitType::RTC_TLR1
uint32_t RTC_TLR1
Definition: BlueNRG1_rtc.h:54
RTC_InitType::RTC_TLR2
uint32_t RTC_TLR2
Definition: BlueNRG1_rtc.h:57
RTC_InitType::RTC_PATTERN_SIZE
uint32_t RTC_PATTERN_SIZE
Definition: BlueNRG1_rtc.h:60
RTC_Cmd
void RTC_Cmd(FunctionalState NewState)
Enables or disables selected RTC peripheral.
Definition: BlueNRG1_rtc.c:109
RTC_Init
void RTC_Init(RTC_InitType *RTC_InitStruct)
Initializes the RTC peripheral according to the specified parameters in the RTC_InitStruct.
Definition: BlueNRG1_rtc.c:85
RTC_SelectTrimmedClock
void RTC_SelectTrimmedClock(FunctionalState NewState)
Enables or disables the use of the trimmed 32 kHz clock.
Definition: BlueNRG1_rtc.c:364
RTC_AutoStart
void RTC_AutoStart(FunctionalState NewState)
Enables or disables the auto start on load register or pattern register write operation.
Definition: BlueNRG1_rtc.c:344
RTC_InitType::RTC_PATTERN1
uint32_t RTC_PATTERN1
Definition: BlueNRG1_rtc.h:63
RTC_DateTimeType::Year
uint16_t Year
Definition: BlueNRG1_rtc.h:100
RTC_ClockwatchCmd
void RTC_ClockwatchCmd(FunctionalState NewState)
Enables or disables selected RTC clockwatch.
Definition: BlueNRG1_rtc.c:194
RTC_IT_Clear
void RTC_IT_Clear(uint8_t RTC_IT)
Clear selected RTC interrupt.
Definition: BlueNRG1_rtc.c:179
RTC_GetNumberIrqGenerated
uint32_t RTC_GetNumberIrqGenerated(void)
Return the actual number of interrupt generated by RTC.
Definition: BlueNRG1_rtc.c:331
RTC_DateTimeType::Minute
uint8_t Minute
Definition: BlueNRG1_rtc.h:85
RTC_IT_Config
void RTC_IT_Config(uint8_t RTC_IT, FunctionalState NewState)
Enables or disables selected RTC interrupt.
Definition: BlueNRG1_rtc.c:132