Subversion Repositories DashDisplay

Rev

Rev 56 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 56 Rev 77
Line 1... Line 1...
1
/**
1
/**
2
  ******************************************************************************
2
  ******************************************************************************
3
  * @file    stm32l1xx_ll_rtc.h
3
  * @file    stm32l1xx_ll_rtc.h
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of RTC LL module.
5
  * @brief   Header file of RTC LL module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
9
  * Copyright (c) 2016 STMicroelectronics.
10
  * All rights reserved.</center></h2>
10
  * All rights reserved.
11
  *
11
  *
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * This software is licensed under terms that can be found in the LICENSE file
13
  * the "License"; You may not use this file except in compliance with the
13
  * in the root directory of this software component.
14
  * License. You may obtain a copy of the License at:
14
  * If no LICENSE file comes with this software, it is provided AS-IS.
15
  *                        opensource.org/licenses/BSD-3-Clause
15
  *
16
  *
16
  ******************************************************************************
17
  ******************************************************************************
17
  */
18
  */
18
 
19
 
19
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
20
#ifndef STM32L1xx_LL_RTC_H
21
#ifndef __STM32L1xx_LL_RTC_H
21
#define STM32L1xx_LL_RTC_H
22
#define __STM32L1xx_LL_RTC_H
22
 
23
 
23
#ifdef __cplusplus
24
#ifdef __cplusplus
24
extern "C" {
25
extern "C" {
25
#endif
26
#endif
26
 
27
 
27
/* Includes ------------------------------------------------------------------*/
28
/* Includes ------------------------------------------------------------------*/
28
#include "stm32l1xx.h"
29
#include "stm32l1xx.h"
29
 
30
 
30
/** @addtogroup STM32L1xx_LL_Driver
31
/** @addtogroup STM32L1xx_LL_Driver
31
  * @{
32
  * @{
32
  */
33
  */
33
 
34
 
34
#if defined(RTC)
35
#if defined(RTC)
35
 
36
 
36
/** @defgroup RTC_LL RTC
37
/** @defgroup RTC_LL RTC
37
  * @{
38
  * @{
38
  */
39
  */
39
 
40
 
40
/* Private types -------------------------------------------------------------*/
41
/* Private types -------------------------------------------------------------*/
41
/* Private variables ---------------------------------------------------------*/
42
/* Private variables ---------------------------------------------------------*/
42
/* Private constants ---------------------------------------------------------*/
43
/* Private constants ---------------------------------------------------------*/
43
/** @defgroup RTC_LL_Private_Constants RTC Private Constants
44
/** @defgroup RTC_LL_Private_Constants RTC Private Constants
44
  * @{
45
  * @{
45
  */
46
  */
46
/* Masks Definition */
47
/* Masks Definition */
47
#define RTC_INIT_MASK                 0xFFFFFFFFU
48
#define LL_RTC_INIT_MASK              0xFFFFFFFFU
48
#define RTC_RSF_MASK                  ((uint32_t)~(RTC_ISR_INIT | RTC_ISR_RSF))
49
 
49
 
50
/* Write protection defines */
50
/* Write protection defines */
51
#define RTC_WRITE_PROTECTION_DISABLE  ((uint8_t)0xFFU)
51
#define RTC_WRITE_PROTECTION_DISABLE  ((uint8_t)0xFFU)
52
#define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU)
52
#define RTC_WRITE_PROTECTION_ENABLE_1 ((uint8_t)0xCAU)
53
#define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U)
53
#define RTC_WRITE_PROTECTION_ENABLE_2 ((uint8_t)0x53U)
54
 
54
 
55
/* Defines used to combine date & time */
55
/* Defines used to combine date & time */
56
#define RTC_OFFSET_WEEKDAY            24U
56
#define RTC_OFFSET_WEEKDAY            24U
57
#define RTC_OFFSET_DAY                16U
57
#define RTC_OFFSET_DAY                16U
58
#define RTC_OFFSET_MONTH              8U
58
#define RTC_OFFSET_MONTH              8U
59
#define RTC_OFFSET_HOUR               16U
59
#define RTC_OFFSET_HOUR               16U
60
#define RTC_OFFSET_MINUTE             8U
60
#define RTC_OFFSET_MINUTE             8U
61
 
61
 
62
/**
62
/**
63
  * @}
63
  * @}
64
  */
64
  */
65
 
65
 
66
/* Private macros ------------------------------------------------------------*/
66
/* Private macros ------------------------------------------------------------*/
67
#if defined(USE_FULL_LL_DRIVER)
67
#if defined(USE_FULL_LL_DRIVER)
68
/** @defgroup RTC_LL_Private_Macros RTC Private Macros
68
/** @defgroup RTC_LL_Private_Macros RTC Private Macros
69
  * @{
69
  * @{
70
  */
70
  */
71
/**
71
/**
72
  * @}
72
  * @}
73
  */
73
  */
74
#endif /*USE_FULL_LL_DRIVER*/
74
#endif /*USE_FULL_LL_DRIVER*/
75
 
75
 
76
/* Exported types ------------------------------------------------------------*/
76
/* Exported types ------------------------------------------------------------*/
77
#if defined(USE_FULL_LL_DRIVER)
77
#if defined(USE_FULL_LL_DRIVER)
78
/** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
78
/** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
79
  * @{
79
  * @{
80
  */
80
  */
81
 
81
 
82
/**
82
/**
83
  * @brief  RTC Init structures definition
83
  * @brief  RTC Init structures definition
84
  */
84
  */
85
typedef struct
85
typedef struct
86
{
86
{
87
  uint32_t HourFormat;   /*!< Specifies the RTC Hours Format.
87
  uint32_t HourFormat;   /*!< Specifies the RTC Hours Format.
88
                              This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
88
                              This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
89
 
89
 
90
                              This feature can be modified afterwards using unitary function
90
                              This feature can be modified afterwards using unitary function
91
                              @ref LL_RTC_SetHourFormat(). */
91
                              @ref LL_RTC_SetHourFormat(). */
92
 
92
 
93
  uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
93
  uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
94
                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
94
                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
95
 
95
 
96
                              This feature can be modified afterwards using unitary function
96
                              This feature can be modified afterwards using unitary function
97
                              @ref LL_RTC_SetAsynchPrescaler(). */
97
                              @ref LL_RTC_SetAsynchPrescaler(). */
98
 
98
 
99
  uint32_t SynchPrescaler;  /*!< Specifies the RTC Synchronous Predivider value.
99
  uint32_t SynchPrescaler;  /*!< Specifies the RTC Synchronous Predivider value.
100
                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
100
                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
101
 
101
 
102
                              This feature can be modified afterwards using unitary function
102
                              This feature can be modified afterwards using unitary function
103
                              @ref LL_RTC_SetSynchPrescaler(). */
103
                              @ref LL_RTC_SetSynchPrescaler(). */
104
} LL_RTC_InitTypeDef;
104
} LL_RTC_InitTypeDef;
105
 
105
 
106
/**
106
/**
107
  * @brief  RTC Time structure definition
107
  * @brief  RTC Time structure definition
108
  */
108
  */
109
typedef struct
109
typedef struct
110
{
110
{
111
  uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
111
  uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
112
                            This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
112
                            This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
113
 
113
 
114
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
114
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
115
 
115
 
116
  uint8_t Hours;       /*!< Specifies the RTC Time Hours.
116
  uint8_t Hours;       /*!< Specifies the RTC Time Hours.
117
                            This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
117
                            This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
118
                            This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
118
                            This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
119
 
119
 
120
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
120
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
121
 
121
 
122
  uint8_t Minutes;     /*!< Specifies the RTC Time Minutes.
122
  uint8_t Minutes;     /*!< Specifies the RTC Time Minutes.
123
                            This parameter must be a number between Min_Data = 0 and Max_Data = 59
123
                            This parameter must be a number between Min_Data = 0 and Max_Data = 59
124
 
124
 
125
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
125
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
126
 
126
 
127
  uint8_t Seconds;     /*!< Specifies the RTC Time Seconds.
127
  uint8_t Seconds;     /*!< Specifies the RTC Time Seconds.
128
                            This parameter must be a number between Min_Data = 0 and Max_Data = 59
128
                            This parameter must be a number between Min_Data = 0 and Max_Data = 59
129
 
129
 
130
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
130
                            This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
131
} LL_RTC_TimeTypeDef;
131
} LL_RTC_TimeTypeDef;
132
 
132
 
133
/**
133
/**
134
  * @brief  RTC Date structure definition
134
  * @brief  RTC Date structure definition
135
  */
135
  */
136
typedef struct
136
typedef struct
137
{
137
{
138
  uint8_t WeekDay;  /*!< Specifies the RTC Date WeekDay.
138
  uint8_t WeekDay;  /*!< Specifies the RTC Date WeekDay.
139
                         This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
139
                         This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
140
 
140
 
141
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
141
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
142
 
142
 
143
  uint8_t Month;    /*!< Specifies the RTC Date Month.
143
  uint8_t Month;    /*!< Specifies the RTC Date Month.
144
                         This parameter can be a value of @ref RTC_LL_EC_MONTH
144
                         This parameter can be a value of @ref RTC_LL_EC_MONTH
145
 
145
 
146
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
146
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
147
 
147
 
148
  uint8_t Day;      /*!< Specifies the RTC Date Day.
148
  uint8_t Day;      /*!< Specifies the RTC Date Day.
149
                         This parameter must be a number between Min_Data = 1 and Max_Data = 31
149
                         This parameter must be a number between Min_Data = 1 and Max_Data = 31
150
 
150
 
151
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
151
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
152
 
152
 
153
  uint8_t Year;     /*!< Specifies the RTC Date Year.
153
  uint8_t Year;     /*!< Specifies the RTC Date Year.
154
                         This parameter must be a number between Min_Data = 0 and Max_Data = 99
154
                         This parameter must be a number between Min_Data = 0 and Max_Data = 99
155
 
155
 
156
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
156
                         This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
157
} LL_RTC_DateTypeDef;
157
} LL_RTC_DateTypeDef;
158
 
158
 
159
/**
159
/**
160
  * @brief  RTC Alarm structure definition
160
  * @brief  RTC Alarm structure definition
161
  */
161
  */
162
typedef struct
162
typedef struct
163
{
163
{
164
  LL_RTC_TimeTypeDef AlarmTime;  /*!< Specifies the RTC Alarm Time members. */
164
  LL_RTC_TimeTypeDef AlarmTime;  /*!< Specifies the RTC Alarm Time members. */
165
 
165
 
166
  uint32_t AlarmMask;            /*!< Specifies the RTC Alarm Masks.
166
  uint32_t AlarmMask;            /*!< Specifies the RTC Alarm Masks.
167
                                      This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
167
                                      This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
168
 
168
 
169
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
169
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
170
                                      or @ref LL_RTC_ALMB_SetMask() for ALARM B
170
                                      or @ref LL_RTC_ALMB_SetMask() for ALARM B.
171
                                 */
171
                                 */
172
 
172
 
173
  uint32_t AlarmDateWeekDaySel;  /*!< Specifies the RTC Alarm is on day or WeekDay.
173
  uint32_t AlarmDateWeekDaySel;  /*!< Specifies the RTC Alarm is on day or WeekDay.
174
                                      This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
174
                                      This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
175
 
175
 
176
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
176
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
177
                                      for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
177
                                      for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
178
                                 */
178
                                 */
179
 
179
 
180
  uint8_t AlarmDateWeekDay;      /*!< Specifies the RTC Alarm Day/WeekDay.
180
  uint8_t AlarmDateWeekDay;      /*!< Specifies the RTC Alarm Day/WeekDay.
181
                                      If AlarmDateWeekDaySel set to day, this parameter  must be a number between Min_Data = 1 and Max_Data = 31.
181
                                      If AlarmDateWeekDaySel set to day, this parameter  must be a number between Min_Data = 1 and Max_Data = 31.
182
 
182
 
183
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
183
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
184
                                      for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
184
                                      for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
185
 
185
 
186
                                      If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
186
                                      If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
187
 
187
 
188
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
188
                                      This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
189
                                      for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
189
                                      for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
190
                                 */
190
                                 */
191
} LL_RTC_AlarmTypeDef;
191
} LL_RTC_AlarmTypeDef;
192
 
192
 
193
/**
193
/**
194
  * @}
194
  * @}
195
  */
195
  */
196
#endif /* USE_FULL_LL_DRIVER */
196
#endif /* USE_FULL_LL_DRIVER */
197
 
197
 
198
/* Exported constants --------------------------------------------------------*/
198
/* Exported constants --------------------------------------------------------*/
199
/** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
199
/** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
200
  * @{
200
  * @{
201
  */
201
  */
202
 
202
 
203
#if defined(USE_FULL_LL_DRIVER)
203
#if defined(USE_FULL_LL_DRIVER)
204
/** @defgroup RTC_LL_EC_FORMAT FORMAT
204
/** @defgroup RTC_LL_EC_FORMAT FORMAT
205
  * @{
205
  * @{
206
  */
206
  */
207
#define LL_RTC_FORMAT_BIN                  0x000000000U /*!< Binary data format */
207
#define LL_RTC_FORMAT_BIN                  0x00000000U /*!< Binary data format */
208
#define LL_RTC_FORMAT_BCD                  0x000000001U /*!< BCD data format */
208
#define LL_RTC_FORMAT_BCD                  0x00000001U /*!< BCD data format */
209
/**
209
/**
210
  * @}
210
  * @}
211
  */
211
  */
212
 
212
 
213
/** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
213
/** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
214
  * @{
214
  * @{
215
  */
215
  */
216
#define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm A Date is selected */
216
#define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm A Date is selected */
217
#define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL        /*!< Alarm A WeekDay is selected */
217
#define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL        /*!< Alarm A WeekDay is selected */
218
/**
218
/**
219
  * @}
219
  * @}
220
  */
220
  */
221
 
221
 
222
/** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
222
/** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
223
  * @{
223
  * @{
224
  */
224
  */
225
#define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm B Date is selected */
225
#define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE    0x00000000U             /*!< Alarm B Date is selected */
226
#define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL        /*!< Alarm B WeekDay is selected */
226
#define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL        /*!< Alarm B WeekDay is selected */
227
/**
227
/**
228
  * @}
228
  * @}
229
  */
229
  */
230
 
230
 
231
#endif /* USE_FULL_LL_DRIVER */
231
#endif /* USE_FULL_LL_DRIVER */
232
 
232
 
233
/** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
233
/** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
234
  * @brief    Flags defines which can be used with LL_RTC_ReadReg function
234
  * @brief    Flags defines which can be used with LL_RTC_ReadReg function
235
  * @{
235
  * @{
236
  */
236
  */
237
#if defined(RTC_SMOOTHCALIB_SUPPORT)
237
#if defined(RTC_SMOOTHCALIB_SUPPORT)
238
#define LL_RTC_ISR_RECALPF                 RTC_ISR_RECALPF
238
#define LL_RTC_ISR_RECALPF                 RTC_ISR_RECALPF
239
#endif /* RTC_SMOOTHCALIB_SUPPORT */
239
#endif /* RTC_SMOOTHCALIB_SUPPORT */
240
#define LL_RTC_ISR_TAMP3F                  RTC_ISR_TAMP3F
240
#if defined(RTC_TAMPER3_SUPPORT)
241
#define LL_RTC_ISR_TAMP2F                  RTC_ISR_TAMP2F
241
#define LL_RTC_ISR_TAMP3F                  RTC_ISR_TAMP3F
242
#define LL_RTC_ISR_TAMP1F                  RTC_ISR_TAMP1F
242
#endif /* RTC_TAMPER3_SUPPORT */
243
#define LL_RTC_ISR_TSOVF                   RTC_ISR_TSOVF
243
#if defined(RTC_TAMPER2_SUPPORT)
244
#define LL_RTC_ISR_TSF                     RTC_ISR_TSF
244
#define LL_RTC_ISR_TAMP2F                  RTC_ISR_TAMP2F
245
#define LL_RTC_ISR_WUTF                    RTC_ISR_WUTF
245
#endif /* RTC_TAMPER2_SUPPORT */
246
#define LL_RTC_ISR_ALRBF                   RTC_ISR_ALRBF
246
#define LL_RTC_ISR_TAMP1F                  RTC_ISR_TAMP1F
247
#define LL_RTC_ISR_ALRAF                   RTC_ISR_ALRAF
247
#define LL_RTC_ISR_TSOVF                   RTC_ISR_TSOVF
248
#define LL_RTC_ISR_INITF                   RTC_ISR_INITF
248
#define LL_RTC_ISR_TSF                     RTC_ISR_TSF
249
#define LL_RTC_ISR_RSF                     RTC_ISR_RSF
249
#define LL_RTC_ISR_WUTF                    RTC_ISR_WUTF
250
#define LL_RTC_ISR_INITS                   RTC_ISR_INITS
250
#define LL_RTC_ISR_ALRBF                   RTC_ISR_ALRBF
251
#define LL_RTC_ISR_SHPF                    RTC_ISR_SHPF
251
#define LL_RTC_ISR_ALRAF                   RTC_ISR_ALRAF
252
#define LL_RTC_ISR_WUTWF                   RTC_ISR_WUTWF
252
#define LL_RTC_ISR_INITF                   RTC_ISR_INITF
253
#define LL_RTC_ISR_ALRBWF                  RTC_ISR_ALRBWF
253
#define LL_RTC_ISR_RSF                     RTC_ISR_RSF
254
#define LL_RTC_ISR_ALRAWF                  RTC_ISR_ALRAWF
254
#define LL_RTC_ISR_INITS                   RTC_ISR_INITS
255
/**
255
#define LL_RTC_ISR_SHPF                    RTC_ISR_SHPF
256
  * @}
256
#define LL_RTC_ISR_WUTWF                   RTC_ISR_WUTWF
257
  */
257
#define LL_RTC_ISR_ALRBWF                  RTC_ISR_ALRBWF
258
 
258
#define LL_RTC_ISR_ALRAWF                  RTC_ISR_ALRAWF
259
/** @defgroup RTC_LL_EC_IT IT Defines
259
/**
260
  * @brief    IT defines which can be used with LL_RTC_ReadReg and  LL_RTC_WriteReg functions
260
  * @}
261
  * @{
261
  */
262
  */
262
 
263
#define LL_RTC_CR_TSIE                     RTC_CR_TSIE
263
/** @defgroup RTC_LL_EC_IT IT Defines
264
#define LL_RTC_CR_WUTIE                    RTC_CR_WUTIE
264
  * @brief    IT defines which can be used with LL_RTC_ReadReg and  LL_RTC_WriteReg functions
265
#define LL_RTC_CR_ALRBIE                   RTC_CR_ALRBIE
265
  * @{
266
#define LL_RTC_CR_ALRAIE                   RTC_CR_ALRAIE
266
  */
267
#define LL_RTC_TAFCR_TAMPIE               RTC_TAFCR_TAMPIE
267
#define LL_RTC_CR_TSIE                     RTC_CR_TSIE
268
/**
268
#define LL_RTC_CR_WUTIE                    RTC_CR_WUTIE
269
  * @}
269
#define LL_RTC_CR_ALRBIE                   RTC_CR_ALRBIE
270
  */
270
#define LL_RTC_CR_ALRAIE                   RTC_CR_ALRAIE
271
 
271
#define LL_RTC_TAFCR_TAMPIE               RTC_TAFCR_TAMPIE
272
/** @defgroup RTC_LL_EC_WEEKDAY  WEEK DAY
272
/**
273
  * @{
273
  * @}
274
  */
274
  */
275
#define LL_RTC_WEEKDAY_MONDAY              ((uint8_t)0x01U) /*!< Monday    */
275
 
276
#define LL_RTC_WEEKDAY_TUESDAY             ((uint8_t)0x02U) /*!< Tuesday   */
276
/** @defgroup RTC_LL_EC_WEEKDAY  WEEK DAY
277
#define LL_RTC_WEEKDAY_WEDNESDAY           ((uint8_t)0x03U) /*!< Wednesday */
277
  * @{
278
#define LL_RTC_WEEKDAY_THURSDAY            ((uint8_t)0x04U) /*!< Thrusday  */
278
  */
279
#define LL_RTC_WEEKDAY_FRIDAY              ((uint8_t)0x05U) /*!< Friday    */
279
#define LL_RTC_WEEKDAY_MONDAY              ((uint8_t)0x01U) /*!< Monday    */
280
#define LL_RTC_WEEKDAY_SATURDAY            ((uint8_t)0x06U) /*!< Saturday  */
280
#define LL_RTC_WEEKDAY_TUESDAY             ((uint8_t)0x02U) /*!< Tuesday   */
281
#define LL_RTC_WEEKDAY_SUNDAY              ((uint8_t)0x07U) /*!< Sunday    */
281
#define LL_RTC_WEEKDAY_WEDNESDAY           ((uint8_t)0x03U) /*!< Wednesday */
282
/**
282
#define LL_RTC_WEEKDAY_THURSDAY            ((uint8_t)0x04U) /*!< Thrusday  */
283
  * @}
283
#define LL_RTC_WEEKDAY_FRIDAY              ((uint8_t)0x05U) /*!< Friday    */
284
  */
284
#define LL_RTC_WEEKDAY_SATURDAY            ((uint8_t)0x06U) /*!< Saturday  */
285
 
285
#define LL_RTC_WEEKDAY_SUNDAY              ((uint8_t)0x07U) /*!< Sunday    */
286
/** @defgroup RTC_LL_EC_MONTH  MONTH
286
/**
287
  * @{
287
  * @}
288
  */
288
  */
289
#define LL_RTC_MONTH_JANUARY               ((uint8_t)0x01U)  /*!< January   */
289
 
290
#define LL_RTC_MONTH_FEBRUARY              ((uint8_t)0x02U)  /*!< February  */
290
/** @defgroup RTC_LL_EC_MONTH  MONTH
291
#define LL_RTC_MONTH_MARCH                 ((uint8_t)0x03U)  /*!< March     */
291
  * @{
292
#define LL_RTC_MONTH_APRIL                 ((uint8_t)0x04U)  /*!< April     */
292
  */
293
#define LL_RTC_MONTH_MAY                   ((uint8_t)0x05U)  /*!< May       */
293
#define LL_RTC_MONTH_JANUARY               ((uint8_t)0x01U)  /*!< January   */
294
#define LL_RTC_MONTH_JUNE                  ((uint8_t)0x06U)  /*!< June      */
294
#define LL_RTC_MONTH_FEBRUARY              ((uint8_t)0x02U)  /*!< February  */
295
#define LL_RTC_MONTH_JULY                  ((uint8_t)0x07U)  /*!< July      */
295
#define LL_RTC_MONTH_MARCH                 ((uint8_t)0x03U)  /*!< March     */
296
#define LL_RTC_MONTH_AUGUST                ((uint8_t)0x08U)  /*!< August    */
296
#define LL_RTC_MONTH_APRIL                 ((uint8_t)0x04U)  /*!< April     */
297
#define LL_RTC_MONTH_SEPTEMBER             ((uint8_t)0x09U)  /*!< September */
297
#define LL_RTC_MONTH_MAY                   ((uint8_t)0x05U)  /*!< May       */
298
#define LL_RTC_MONTH_OCTOBER               ((uint8_t)0x10U)  /*!< October   */
298
#define LL_RTC_MONTH_JUNE                  ((uint8_t)0x06U)  /*!< June      */
299
#define LL_RTC_MONTH_NOVEMBER              ((uint8_t)0x11U)  /*!< November  */
299
#define LL_RTC_MONTH_JULY                  ((uint8_t)0x07U)  /*!< July      */
300
#define LL_RTC_MONTH_DECEMBER              ((uint8_t)0x12U)  /*!< December  */
300
#define LL_RTC_MONTH_AUGUST                ((uint8_t)0x08U)  /*!< August    */
301
/**
301
#define LL_RTC_MONTH_SEPTEMBER             ((uint8_t)0x09U)  /*!< September */
302
  * @}
302
#define LL_RTC_MONTH_OCTOBER               ((uint8_t)0x10U)  /*!< October   */
303
  */
303
#define LL_RTC_MONTH_NOVEMBER              ((uint8_t)0x11U)  /*!< November  */
304
 
304
#define LL_RTC_MONTH_DECEMBER              ((uint8_t)0x12U)  /*!< December  */
305
/** @defgroup RTC_LL_EC_HOURFORMAT  HOUR FORMAT
305
/**
306
  * @{
306
  * @}
307
  */
307
  */
308
#define LL_RTC_HOURFORMAT_24HOUR           0x00000000U           /*!< 24 hour/day format */
308
 
309
#define LL_RTC_HOURFORMAT_AMPM             RTC_CR_FMT            /*!< AM/PM hour format */
309
/** @defgroup RTC_LL_EC_HOURFORMAT  HOUR FORMAT
310
/**
310
  * @{
311
  * @}
311
  */
312
  */
312
#define LL_RTC_HOURFORMAT_24HOUR           0x00000000U           /*!< 24 hour/day format */
313
 
313
#define LL_RTC_HOURFORMAT_AMPM             RTC_CR_FMT            /*!< AM/PM hour format */
314
/** @defgroup RTC_LL_EC_ALARMOUT  ALARM OUTPUT
314
/**
315
  * @{
315
  * @}
316
  */
316
  */
317
#define LL_RTC_ALARMOUT_DISABLE            0x00000000U             /*!< Output disabled */
317
 
318
#define LL_RTC_ALARMOUT_ALMA               RTC_CR_OSEL_0           /*!< Alarm A output enabled */
318
/** @defgroup RTC_LL_EC_ALARMOUT  ALARM OUTPUT
319
#define LL_RTC_ALARMOUT_ALMB               RTC_CR_OSEL_1           /*!< Alarm B output enabled */
319
  * @{
320
#define LL_RTC_ALARMOUT_WAKEUP             RTC_CR_OSEL             /*!< Wakeup output enabled */
320
  */
321
/**
321
#define LL_RTC_ALARMOUT_DISABLE            0x00000000U             /*!< Output disabled */
322
  * @}
322
#define LL_RTC_ALARMOUT_ALMA               RTC_CR_OSEL_0           /*!< Alarm A output enabled */
323
  */
323
#define LL_RTC_ALARMOUT_ALMB               RTC_CR_OSEL_1           /*!< Alarm B output enabled */
324
 
324
#define LL_RTC_ALARMOUT_WAKEUP             RTC_CR_OSEL             /*!< Wakeup output enabled */
325
/** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE  ALARM OUTPUT TYPE
325
/**
326
  * @{
326
  * @}
327
  */
327
  */
328
#define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN  0x00000000U                          /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
328
 
329
#define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL   RTC_TAFCR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
329
/** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE  ALARM OUTPUT TYPE
330
/**
330
  * @{
331
  * @}
331
  */
332
  */
332
#define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN  0x00000000U                          /*!< RTC_ALARM, when mapped on PC13, is open-drain output */
333
 
333
#define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL   RTC_TAFCR_ALARMOUTTYPE /*!< RTC_ALARM, when mapped on PC13, is push-pull output */
334
/** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN  OUTPUT POLARITY PIN
334
/**
335
  * @{
335
  * @}
336
  */
336
  */
337
#define LL_RTC_OUTPUTPOLARITY_PIN_HIGH     0x00000000U           /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
337
 
338
#define LL_RTC_OUTPUTPOLARITY_PIN_LOW      RTC_CR_POL            /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
338
/** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN  OUTPUT POLARITY PIN
339
/**
339
  * @{
340
  * @}
340
  */
341
  */
341
#define LL_RTC_OUTPUTPOLARITY_PIN_HIGH     0x00000000U           /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
342
 
342
#define LL_RTC_OUTPUTPOLARITY_PIN_LOW      RTC_CR_POL            /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
343
/** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
343
/**
344
  * @{
344
  * @}
345
  */
345
  */
346
#define LL_RTC_TIME_FORMAT_AM_OR_24        0x00000000U           /*!< AM or 24-hour format */
346
 
347
#define LL_RTC_TIME_FORMAT_PM              RTC_TR_PM             /*!< PM */
347
/** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
348
/**
348
  * @{
349
  * @}
349
  */
350
  */
350
#define LL_RTC_TIME_FORMAT_AM_OR_24        0x00000000U           /*!< AM or 24-hour format */
351
 
351
#define LL_RTC_TIME_FORMAT_PM              RTC_TR_PM             /*!< PM */
352
#if defined(RTC_SHIFTR_ADD1S)
352
/**
353
/** @defgroup RTC_LL_EC_SHIFT_SECOND  SHIFT SECOND
353
  * @}
354
  * @{
354
  */
355
  */
355
 
356
#define LL_RTC_SHIFT_SECOND_DELAY          0x00000000U           /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
356
#if defined(RTC_SUBSECOND_SUPPORT)
357
#define LL_RTC_SHIFT_SECOND_ADVANCE        RTC_SHIFTR_ADD1S      /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
357
/** @defgroup RTC_LL_EC_SHIFT_SECOND  SHIFT SECOND
358
/**
358
  * @{
359
  * @}
359
  */
360
  */
360
#define LL_RTC_SHIFT_SECOND_DELAY          0x00000000U           /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
361
#endif /* RTC_SHIFTR_ADD1S */
361
#define LL_RTC_SHIFT_SECOND_ADVANCE        RTC_SHIFTR_ADD1S      /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
362
 
362
/**
363
/** @defgroup RTC_LL_EC_ALMA_MASK  ALARMA MASK
363
  * @}
364
  * @{
364
  */
365
  */
365
#endif /* RTC_SUBSECOND_SUPPORT */
366
#define LL_RTC_ALMA_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm A*/
366
 
367
#define LL_RTC_ALMA_MASK_DATEWEEKDAY       RTC_ALRMAR_MSK4         /*!< Date/day do not care in Alarm A comparison */
367
/** @defgroup RTC_LL_EC_ALMA_MASK  ALARMA MASK
368
#define LL_RTC_ALMA_MASK_HOURS             RTC_ALRMAR_MSK3         /*!< Hours do not care in Alarm A comparison */
368
  * @{
369
#define LL_RTC_ALMA_MASK_MINUTES           RTC_ALRMAR_MSK2         /*!< Minutes do not care in Alarm A comparison */
369
  */
370
#define LL_RTC_ALMA_MASK_SECONDS           RTC_ALRMAR_MSK1         /*!< Seconds do not care in Alarm A comparison */
370
#define LL_RTC_ALMA_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm A*/
371
#define LL_RTC_ALMA_MASK_ALL               (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
371
#define LL_RTC_ALMA_MASK_DATEWEEKDAY       RTC_ALRMAR_MSK4         /*!< Date/day do not care in Alarm A comparison */
372
/**
372
#define LL_RTC_ALMA_MASK_HOURS             RTC_ALRMAR_MSK3         /*!< Hours do not care in Alarm A comparison */
373
  * @}
373
#define LL_RTC_ALMA_MASK_MINUTES           RTC_ALRMAR_MSK2         /*!< Minutes do not care in Alarm A comparison */
374
  */
374
#define LL_RTC_ALMA_MASK_SECONDS           RTC_ALRMAR_MSK1         /*!< Seconds do not care in Alarm A comparison */
375
 
375
#define LL_RTC_ALMA_MASK_ALL               (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
376
/** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT  ALARMA TIME FORMAT
376
/**
377
  * @{
377
  * @}
378
  */
378
  */
379
#define LL_RTC_ALMA_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
379
 
380
#define LL_RTC_ALMA_TIME_FORMAT_PM         RTC_ALRMAR_PM         /*!< PM */
380
/** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT  ALARMA TIME FORMAT
381
/**
381
  * @{
382
  * @}
382
  */
383
  */
383
#define LL_RTC_ALMA_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
384
 
384
#define LL_RTC_ALMA_TIME_FORMAT_PM         RTC_ALRMAR_PM         /*!< PM */
385
/** @defgroup RTC_LL_EC_ALMB_MASK  ALARMB MASK
385
/**
386
  * @{
386
  * @}
387
  */
387
  */
388
#define LL_RTC_ALMB_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm B*/
388
 
389
#define LL_RTC_ALMB_MASK_DATEWEEKDAY       RTC_ALRMBR_MSK4         /*!< Date/day do not care in Alarm B comparison */
389
/** @defgroup RTC_LL_EC_ALMB_MASK  ALARMB MASK
390
#define LL_RTC_ALMB_MASK_HOURS             RTC_ALRMBR_MSK3         /*!< Hours do not care in Alarm B comparison */
390
  * @{
391
#define LL_RTC_ALMB_MASK_MINUTES           RTC_ALRMBR_MSK2         /*!< Minutes do not care in Alarm B comparison */
391
  */
392
#define LL_RTC_ALMB_MASK_SECONDS           RTC_ALRMBR_MSK1         /*!< Seconds do not care in Alarm B comparison */
392
#define LL_RTC_ALMB_MASK_NONE              0x00000000U             /*!< No masks applied on Alarm B                */
393
#define LL_RTC_ALMB_MASK_ALL               (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
393
#define LL_RTC_ALMB_MASK_DATEWEEKDAY       RTC_ALRMBR_MSK4         /*!< Date/day do not care in Alarm B comparison */
394
/**
394
#define LL_RTC_ALMB_MASK_HOURS             RTC_ALRMBR_MSK3         /*!< Hours do not care in Alarm B comparison    */
395
  * @}
395
#define LL_RTC_ALMB_MASK_MINUTES           RTC_ALRMBR_MSK2         /*!< Minutes do not care in Alarm B comparison  */
396
  */
396
#define LL_RTC_ALMB_MASK_SECONDS           RTC_ALRMBR_MSK1         /*!< Seconds do not care in Alarm B comparison  */
397
 
397
#define LL_RTC_ALMB_MASK_ALL               (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
398
/** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT  ALARMB TIME FORMAT
398
/**
399
  * @{
399
  * @}
400
  */
400
  */
401
#define LL_RTC_ALMB_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
401
 
402
#define LL_RTC_ALMB_TIME_FORMAT_PM         RTC_ALRMBR_PM         /*!< PM */
402
/** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT  ALARMB TIME FORMAT
403
/**
403
  * @{
404
  * @}
404
  */
405
  */
405
#define LL_RTC_ALMB_TIME_FORMAT_AM         0x00000000U           /*!< AM or 24-hour format */
406
 
406
#define LL_RTC_ALMB_TIME_FORMAT_PM         RTC_ALRMBR_PM         /*!< PM */
407
/** @defgroup RTC_LL_EC_TIMESTAMP_EDGE  TIMESTAMP EDGE
407
/**
408
  * @{
408
  * @}
409
  */
409
  */
410
#define LL_RTC_TIMESTAMP_EDGE_RISING       0x00000000U           /*!< RTC_TS input rising edge generates a time-stamp event */
410
 
411
#define LL_RTC_TIMESTAMP_EDGE_FALLING      RTC_CR_TSEDGE         /*!< RTC_TS input falling edge generates a time-stamp even */
411
/** @defgroup RTC_LL_EC_TIMESTAMP_EDGE  TIMESTAMP EDGE
412
/**
412
  * @{
413
  * @}
413
  */
414
  */
414
#define LL_RTC_TIMESTAMP_EDGE_RISING       0x00000000U           /*!< RTC_TS input rising edge generates a time-stamp event */
415
 
415
#define LL_RTC_TIMESTAMP_EDGE_FALLING      RTC_CR_TSEDGE         /*!< RTC_TS input falling edge generates a time-stamp even */
416
/** @defgroup RTC_LL_EC_TS_TIME_FORMAT  TIMESTAMP TIME FORMAT
416
/**
417
  * @{
417
  * @}
418
  */
418
  */
419
#define LL_RTC_TS_TIME_FORMAT_AM           0x00000000U           /*!< AM or 24-hour format */
419
 
420
#define LL_RTC_TS_TIME_FORMAT_PM           RTC_TSTR_PM           /*!< PM */
420
/** @defgroup RTC_LL_EC_TS_TIME_FORMAT  TIMESTAMP TIME FORMAT
421
/**
421
  * @{
422
  * @}
422
  */
423
  */
423
#define LL_RTC_TS_TIME_FORMAT_AM           0x00000000U           /*!< AM or 24-hour format */
424
 
424
#define LL_RTC_TS_TIME_FORMAT_PM           RTC_TSTR_PM           /*!< PM */
425
/** @defgroup RTC_LL_EC_TAMPER  TAMPER
425
/**
426
  * @{
426
  * @}
427
  */
427
  */
428
#if defined(RTC_TAMPER1_SUPPORT)
428
 
429
#define LL_RTC_TAMPER_1                    RTC_TAFCR_TAMP1E /*!< RTC_TAMP1 input detection */
429
/** @defgroup RTC_LL_EC_TAMPER  TAMPER
430
#endif /* RTC_TAMPER1_SUPPORT */
430
  * @{
431
#if defined(RTC_TAMPER2_SUPPORT)
431
  */
432
#define LL_RTC_TAMPER_2                    RTC_TAFCR_TAMP2E /*!< RTC_TAMP2 input detection */
432
#define LL_RTC_TAMPER_1                    RTC_TAFCR_TAMP1E /*!< RTC_TAMP1 input detection */
433
#endif /* RTC_TAMPER2_SUPPORT */
433
#if defined(RTC_TAMPER2_SUPPORT)
434
#if defined(RTC_TAMPER3_SUPPORT)
434
#define LL_RTC_TAMPER_2                    RTC_TAFCR_TAMP2E /*!< RTC_TAMP2 input detection */
435
#define LL_RTC_TAMPER_3                    RTC_TAFCR_TAMP3E /*!< RTC_TAMP3 input detection */
435
#endif /* RTC_TAMPER2_SUPPORT */
436
#endif /* RTC_TAMPER3_SUPPORT */
436
#if defined(RTC_TAMPER3_SUPPORT)
437
/**
437
#define LL_RTC_TAMPER_3                    RTC_TAFCR_TAMP3E /*!< RTC_TAMP3 input detection */
438
  * @}
438
#endif /* RTC_TAMPER3_SUPPORT */
439
  */
439
/**
440
 
440
  * @}
441
/** @defgroup RTC_LL_EC_TAMPER_MASK  TAMPER MASK
441
  */
442
  * @{
442
 
443
  */
443
#if defined(RTC_TAFCR_TAMPFLT)
444
#if defined(RTC_TAMPER1_SUPPORT)
444
/** @defgroup RTC_LL_EC_TAMPER_DURATION  TAMPER DURATION
445
#define LL_RTC_TAMPER_MASK_TAMPER1         RTC_TAFCR_TAMP1MF /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
445
  * @{
446
#endif /* RTC_TAMPER1_SUPPORT */
446
  */
447
#if defined(RTC_TAMPER2_SUPPORT)
447
#define LL_RTC_TAMPER_DURATION_1RTCCLK     0x00000000U                             /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle  */
448
#define LL_RTC_TAMPER_MASK_TAMPER2         RTC_TAFCR_TAMP2MF /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
448
#define LL_RTC_TAMPER_DURATION_2RTCCLK     RTC_TAFCR_TAMPPRCH_0  /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
449
#endif /* RTC_TAMPER2_SUPPORT */
449
#define LL_RTC_TAMPER_DURATION_4RTCCLK     RTC_TAFCR_TAMPPRCH_1  /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
450
#if defined(RTC_TAMPER3_SUPPORT)
450
#define LL_RTC_TAMPER_DURATION_8RTCCLK     RTC_TAFCR_TAMPPRCH    /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
451
#define LL_RTC_TAMPER_MASK_TAMPER3         RTC_TAFCR_TAMP3MF /*!< Tamper 3 event generates a trigger event. TAMP3F is masked and internally cleared by hardware. The backup registers are not erased */
451
/**
452
#endif /* RTC_TAMPER3_SUPPORT */
452
  * @}
453
/**
453
  */
454
  * @}
454
 
455
  */
455
/** @defgroup RTC_LL_EC_TAMPER_FILTER  TAMPER FILTER
456
 
456
  * @{
457
/** @defgroup RTC_LL_EC_TAMPER_NOERASE  TAMPER NO ERASE
457
  */
458
  * @{
458
#define LL_RTC_TAMPER_FILTER_DISABLE       0x00000000U                              /*!< Tamper filter is disabled */
459
  */
459
#define LL_RTC_TAMPER_FILTER_2SAMPLE       RTC_TAFCR_TAMPFLT_0    /*!< Tamper is activated after 2 consecutive samples at the active level */
460
#if defined(RTC_TAMPER1_SUPPORT)
460
#define LL_RTC_TAMPER_FILTER_4SAMPLE       RTC_TAFCR_TAMPFLT_1    /*!< Tamper is activated after 4 consecutive samples at the active level */
461
#define LL_RTC_TAMPER_NOERASE_TAMPER1      RTC_TAFCR_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
461
#define LL_RTC_TAMPER_FILTER_8SAMPLE       RTC_TAFCR_TAMPFLT      /*!< Tamper is activated after 8 consecutive samples at the active level. */
462
#endif /* RTC_TAMPER1_SUPPORT */
462
/**
463
#if defined(RTC_TAMPER2_SUPPORT)
463
  * @}
464
#define LL_RTC_TAMPER_NOERASE_TAMPER2      RTC_TAFCR_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
464
  */
465
#endif /* RTC_TAMPER2_SUPPORT */
465
 
466
#if defined(RTC_TAMPER3_SUPPORT)
466
/** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV  TAMPER SAMPLING FREQUENCY DIVIDER
467
#define LL_RTC_TAMPER_NOERASE_TAMPER3      RTC_TAFCR_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
467
  * @{
468
#endif /* RTC_TAMPER3_SUPPORT */
468
  */
469
/**
469
#define LL_RTC_TAMPER_SAMPLFREQDIV_32768   0x00000000U                                                      /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 32768 */
470
  * @}
470
#define LL_RTC_TAMPER_SAMPLFREQDIV_16384   RTC_TAFCR_TAMPFREQ_0                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 16384 */
471
  */
471
#define LL_RTC_TAMPER_SAMPLFREQDIV_8192    RTC_TAFCR_TAMPFREQ_1                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 8192 */
472
 
472
#define LL_RTC_TAMPER_SAMPLFREQDIV_4096    (RTC_TAFCR_TAMPFREQ_1 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 4096 */
473
#if defined(RTC_TAFCR_TAMPPRCH)
473
#define LL_RTC_TAMPER_SAMPLFREQDIV_2048    RTC_TAFCR_TAMPFREQ_2                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 2048 */
474
/** @defgroup RTC_LL_EC_TAMPER_DURATION  TAMPER DURATION
474
#define LL_RTC_TAMPER_SAMPLFREQDIV_1024    (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 1024 */
475
  * @{
475
#define LL_RTC_TAMPER_SAMPLFREQDIV_512     (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 512 */
476
  */
476
#define LL_RTC_TAMPER_SAMPLFREQDIV_256     RTC_TAFCR_TAMPFREQ                             /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 256 */
477
#define LL_RTC_TAMPER_DURATION_1RTCCLK     0x00000000U                             /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle  */
477
/**
478
#define LL_RTC_TAMPER_DURATION_2RTCCLK     RTC_TAFCR_TAMPPRCH_0  /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
478
  * @}
479
#define LL_RTC_TAMPER_DURATION_4RTCCLK     RTC_TAFCR_TAMPPRCH_1  /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
479
  */
480
#define LL_RTC_TAMPER_DURATION_8RTCCLK     RTC_TAFCR_TAMPPRCH    /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
480
#endif /* RTC_TAFCR_TAMPFLT */
481
/**
481
 
482
  * @}
482
/** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL  TAMPER ACTIVE LEVEL
483
  */
483
  * @{
484
#endif /* RTC_TAFCR_TAMPPRCH */
484
  */
485
 
485
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1    RTC_TAFCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
486
#if defined(RTC_TAFCR_TAMPFLT)
486
#if defined(RTC_TAMPER2_SUPPORT)
487
/** @defgroup RTC_LL_EC_TAMPER_FILTER  TAMPER FILTER
487
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2    RTC_TAFCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
488
  * @{
488
#endif /* RTC_TAMPER2_SUPPORT */
489
  */
489
#if defined(RTC_TAMPER3_SUPPORT)
490
#define LL_RTC_TAMPER_FILTER_DISABLE       0x00000000U                              /*!< Tamper filter is disabled */
490
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3    RTC_TAFCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
491
#define LL_RTC_TAMPER_FILTER_2SAMPLE       RTC_TAFCR_TAMPFLT_0    /*!< Tamper is activated after 2 consecutive samples at the active level */
491
#endif /* RTC_TAMPER3_SUPPORT */
492
#define LL_RTC_TAMPER_FILTER_4SAMPLE       RTC_TAFCR_TAMPFLT_1    /*!< Tamper is activated after 4 consecutive samples at the active level */
492
/**
493
#define LL_RTC_TAMPER_FILTER_8SAMPLE       RTC_TAFCR_TAMPFLT      /*!< Tamper is activated after 8 consecutive samples at the active level. */
493
  * @}
494
/**
494
  */
495
  * @}
495
 
496
  */
496
/** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV  WAKEUP CLOCK DIV
497
#endif /* RTC_TAFCR_TAMPFLT */
497
  * @{
498
 
498
  */
499
#if defined(RTC_TAFCR_TAMPFREQ)
499
#define LL_RTC_WAKEUPCLOCK_DIV_16          0x00000000U                           /*!< RTC/16 clock is selected */
500
/** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV  TAMPER SAMPLING FREQUENCY DIVIDER
500
#define LL_RTC_WAKEUPCLOCK_DIV_8           (RTC_CR_WUCKSEL_0)                    /*!< RTC/8 clock is selected */
501
  * @{
501
#define LL_RTC_WAKEUPCLOCK_DIV_4           (RTC_CR_WUCKSEL_1)                    /*!< RTC/4 clock is selected */
502
  */
502
#define LL_RTC_WAKEUPCLOCK_DIV_2           (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
503
#define LL_RTC_TAMPER_SAMPLFREQDIV_32768   0x00000000U                                                      /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 32768 */
503
#define LL_RTC_WAKEUPCLOCK_CKSPRE          (RTC_CR_WUCKSEL_2)                    /*!< ck_spre (usually 1 Hz) clock is selected */
504
#define LL_RTC_TAMPER_SAMPLFREQDIV_16384   RTC_TAFCR_TAMPFREQ_0                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 16384 */
504
#define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT      (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/
505
#define LL_RTC_TAMPER_SAMPLFREQDIV_8192    RTC_TAFCR_TAMPFREQ_1                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 8192 */
505
/**
506
#define LL_RTC_TAMPER_SAMPLFREQDIV_4096    (RTC_TAFCR_TAMPFREQ_1 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 4096 */
506
  * @}
507
#define LL_RTC_TAMPER_SAMPLFREQDIV_2048    RTC_TAFCR_TAMPFREQ_2                           /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 2048 */
507
  */
508
#define LL_RTC_TAMPER_SAMPLFREQDIV_1024    (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 1024 */
508
 
509
#define LL_RTC_TAMPER_SAMPLFREQDIV_512     (RTC_TAFCR_TAMPFREQ_2 | RTC_TAFCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 512 */
509
/** @defgroup RTC_LL_EC_BKP  BACKUP
510
#define LL_RTC_TAMPER_SAMPLFREQDIV_256     RTC_TAFCR_TAMPFREQ                             /*!< Each of the tamper inputs are sampled with a frequency =  RTCCLK / 256 */
510
  * @{
511
/**
511
  */
512
  * @}
512
#define LL_RTC_BKP_DR0                     0x00000000U
513
  */
513
#define LL_RTC_BKP_DR1                     0x00000001U
514
#endif /* RTC_TAFCR_TAMPFREQ */
514
#define LL_RTC_BKP_DR2                     0x00000002U
515
 
515
#define LL_RTC_BKP_DR3                     0x00000003U
516
/** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL  TAMPER ACTIVE LEVEL
516
#define LL_RTC_BKP_DR4                     0x00000004U
517
  * @{
517
#if RTC_BKP_NUMBER > 5U
518
  */
518
#define LL_RTC_BKP_DR5                     0x00000005U
519
#if defined(RTC_TAMPER1_SUPPORT)
519
#define LL_RTC_BKP_DR6                     0x00000006U
520
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1    RTC_TAFCR_TAMP1TRG /*!< RTC_TAMP1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
520
#define LL_RTC_BKP_DR7                     0x00000007U
521
#endif /* RTC_TAMPER1_SUPPORT */
521
#define LL_RTC_BKP_DR8                     0x00000008U
522
#if defined(RTC_TAMPER2_SUPPORT)
522
#define LL_RTC_BKP_DR9                     0x00000009U
523
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2    RTC_TAFCR_TAMP2TRG /*!< RTC_TAMP2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
523
#define LL_RTC_BKP_DR10                    0x0000000AU
524
#endif /* RTC_TAMPER2_SUPPORT */
524
#define LL_RTC_BKP_DR11                    0x0000000BU
525
#if defined(RTC_TAMPER3_SUPPORT)
525
#define LL_RTC_BKP_DR12                    0x0000000CU
526
#define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3    RTC_TAFCR_TAMP3TRG /*!< RTC_TAMP3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event*/
526
#define LL_RTC_BKP_DR13                    0x0000000DU
527
#endif /* RTC_TAMPER3_SUPPORT */
527
#define LL_RTC_BKP_DR14                    0x0000000EU
528
/**
528
#define LL_RTC_BKP_DR15                    0x0000000FU
529
  * @}
529
#if RTC_BKP_NUMBER > 16U
530
  */
530
#define LL_RTC_BKP_DR16                    0x00000010U
531
 
531
#define LL_RTC_BKP_DR17                    0x00000011U
532
/** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV  WAKEUP CLOCK DIV
532
#define LL_RTC_BKP_DR18                    0x00000012U
533
  * @{
533
#define LL_RTC_BKP_DR19                    0x00000013U
534
  */
534
#if RTC_BKP_NUMBER > 20U
535
#define LL_RTC_WAKEUPCLOCK_DIV_16          0x00000000U                           /*!< RTC/16 clock is selected */
535
#define LL_RTC_BKP_DR20                    0x00000014U
536
#define LL_RTC_WAKEUPCLOCK_DIV_8           (RTC_CR_WUCKSEL_0)                    /*!< RTC/8 clock is selected */
536
#define LL_RTC_BKP_DR21                    0x00000015U
537
#define LL_RTC_WAKEUPCLOCK_DIV_4           (RTC_CR_WUCKSEL_1)                    /*!< RTC/4 clock is selected */
537
#define LL_RTC_BKP_DR22                    0x00000016U
538
#define LL_RTC_WAKEUPCLOCK_DIV_2           (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
538
#define LL_RTC_BKP_DR23                    0x00000017U
539
#define LL_RTC_WAKEUPCLOCK_CKSPRE          (RTC_CR_WUCKSEL_2)                    /*!< ck_spre (usually 1 Hz) clock is selected */
539
#define LL_RTC_BKP_DR24                    0x00000018U
540
#define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT      (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/
540
#define LL_RTC_BKP_DR25                    0x00000019U
541
/**
541
#define LL_RTC_BKP_DR26                    0x0000001AU
542
  * @}
542
#define LL_RTC_BKP_DR27                    0x0000001BU
543
  */
543
#define LL_RTC_BKP_DR28                    0x0000001CU
544
 
544
#define LL_RTC_BKP_DR29                    0x0000001DU
545
#if defined(RTC_BACKUP_SUPPORT)
545
#define LL_RTC_BKP_DR30                    0x0000001EU
546
/** @defgroup RTC_LL_EC_BKP  BACKUP
546
#define LL_RTC_BKP_DR31                    0x0000001FU
547
  * @{
547
#endif /* RTC_BKP_NUMBER > 20U */
548
  */
548
#endif /* RTC_BKP_NUMBER > 16U */
549
#define LL_RTC_BKP_DR0                     0x00000000U
549
#endif /* RTC_BKP_NUMBER >  5U */
550
#define LL_RTC_BKP_DR1                     0x00000001U
550
/**
551
#define LL_RTC_BKP_DR2                     0x00000002U
551
  * @}
552
#define LL_RTC_BKP_DR3                     0x00000003U
552
  */
553
#define LL_RTC_BKP_DR4                     0x00000004U
553
 
554
#if RTC_BKP_NUMBER > 5
554
/** @defgroup RTC_LL_EC_CALIB_OUTPUT  Calibration output
555
#define LL_RTC_BKP_DR5                     0x00000005U
555
  * @{
556
#define LL_RTC_BKP_DR6                     0x00000006U
556
  */
557
#define LL_RTC_BKP_DR7                     0x00000007U
557
#define LL_RTC_CALIB_OUTPUT_NONE           0x00000000U                 /*!< Calibration output disabled */
558
#define LL_RTC_BKP_DR8                     0x00000008U
558
#if defined(RTC_CR_COSEL)
559
#define LL_RTC_BKP_DR9                     0x00000009U
559
#define LL_RTC_CALIB_OUTPUT_1HZ            (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
560
#define LL_RTC_BKP_DR10                    0x0000000AU
560
#endif /* RTC_CR_COSEL */
561
#define LL_RTC_BKP_DR11                    0x0000000BU
561
#define LL_RTC_CALIB_OUTPUT_512HZ          (RTC_CR_COE)                /*!< Calibration output is 512 Hz */
562
#define LL_RTC_BKP_DR12                    0x0000000CU
562
/**
563
#define LL_RTC_BKP_DR13                    0x0000000DU
563
  * @}
564
#define LL_RTC_BKP_DR14                    0x0000000EU
564
  */
565
#define LL_RTC_BKP_DR15                    0x0000000FU
565
 
566
#endif /* RTC_BKP_NUMBER > 5 */
566
/** @defgroup RTC_LL_EC_CALIB_SIGN Coarse digital calibration sign
567
 
567
  * @{
568
#if RTC_BKP_NUMBER > 16
568
  */
569
#define LL_RTC_BKP_DR16                    0x00000010U
569
#define LL_RTC_CALIB_SIGN_POSITIVE         0x00000000U           /*!< Positive calibration: calendar update frequency is increased */
570
#define LL_RTC_BKP_DR17                    0x00000011U
570
#define LL_RTC_CALIB_SIGN_NEGATIVE         RTC_CALIBR_DCS        /*!< Negative calibration: calendar update frequency is decreased */
571
#define LL_RTC_BKP_DR18                    0x00000012U
571
/**
572
#define LL_RTC_BKP_DR19                    0x00000013U
572
  * @}
573
#endif /* RTC_BKP_NUMBER > 16 */
573
  */
574
 
574
 
575
#if RTC_BKP_NUMBER > 20
575
/** @defgroup RTC_LL_EC_CALIB_INSERTPULSE  Calibration pulse insertion
576
#define LL_RTC_BKP_DR20                    0x00000014U
576
  * @{
577
#define LL_RTC_BKP_DR21                    0x00000015U
577
  */
578
#define LL_RTC_BKP_DR22                    0x00000016U
578
#define LL_RTC_CALIB_INSERTPULSE_NONE      0x00000000U           /*!< No RTCCLK pulses are added */
579
#define LL_RTC_BKP_DR23                    0x00000017U
579
#define LL_RTC_CALIB_INSERTPULSE_SET       RTC_CALR_CALP         /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
580
#define LL_RTC_BKP_DR24                    0x00000018U
580
/**
581
#define LL_RTC_BKP_DR25                    0x00000019U
581
  * @}
582
#define LL_RTC_BKP_DR26                    0x0000001AU
582
  */
583
#define LL_RTC_BKP_DR27                    0x0000001BU
583
 
584
#define LL_RTC_BKP_DR28                    0x0000001CU
584
/** @defgroup RTC_LL_EC_CALIB_PERIOD  Calibration period
585
#define LL_RTC_BKP_DR29                    0x0000001DU
585
  * @{
586
#define LL_RTC_BKP_DR30                    0x0000001EU
586
  */
587
#define LL_RTC_BKP_DR31                    0x0000001FU
587
#define LL_RTC_CALIB_PERIOD_32SEC          0x00000000U           /*!< Use a 32-second calibration cycle period */
588
#endif /* RTC_BKP_NUMBER > 20 */
588
#define LL_RTC_CALIB_PERIOD_16SEC          RTC_CALR_CALW16       /*!< Use a 16-second calibration cycle period */
589
/**
589
#define LL_RTC_CALIB_PERIOD_8SEC           RTC_CALR_CALW8        /*!< Use a 8-second calibration cycle period */
590
  * @}
590
/**
591
  */
591
  * @}
592
#endif /* RTC_BACKUP_SUPPORT */
592
  */
593
 
593
 
594
/** @defgroup RTC_LL_EC_CALIB_OUTPUT  Calibration output
594
/**
595
  * @{
595
  * @}
596
  */
596
  */
597
#define LL_RTC_CALIB_OUTPUT_NONE           0x00000000U                 /*!< Calibration output disabled */
597
 
598
#if defined(RTC_CR_COSEL)
598
/* Exported macro ------------------------------------------------------------*/
599
#define LL_RTC_CALIB_OUTPUT_1HZ            (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
599
/** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
600
#endif
600
  * @{
601
#define LL_RTC_CALIB_OUTPUT_512HZ          (RTC_CR_COE)                /*!< Calibration output is 512 Hz */
601
  */
602
/**
602
 
603
  * @}
603
/** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
604
  */
604
  * @{
605
 
605
  */
606
/** @defgroup RTC_LL_EC_CALIB_SIGN Coarse digital calibration sign
606
 
607
  * @{
607
/**
608
  */
608
  * @brief  Write a value in RTC register
609
#define LL_RTC_CALIB_SIGN_POSITIVE         0x00000000U           /*!< Positive calibration: calendar update frequency is increased */
609
  * @param  __INSTANCE__ RTC Instance
610
#define LL_RTC_CALIB_SIGN_NEGATIVE         RTC_CALIBR_DCS        /*!< Negative calibration: calendar update frequency is decreased */
610
  * @param  __REG__ Register to be written
611
/**
611
  * @param  __VALUE__ Value to be written in the register
612
  * @}
612
  * @retval None
613
  */
613
  */
614
 
614
#define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
615
/** @defgroup RTC_LL_EC_CALIB_INSERTPULSE  Calibration pulse insertion
615
 
616
  * @{
616
/**
617
  */
617
  * @brief  Read a value in RTC register
618
#define LL_RTC_CALIB_INSERTPULSE_NONE      0x00000000U           /*!< No RTCCLK pulses are added */
618
  * @param  __INSTANCE__ RTC Instance
619
#define LL_RTC_CALIB_INSERTPULSE_SET       RTC_CALR_CALP         /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
619
  * @param  __REG__ Register to be read
620
/**
620
  * @retval Register value
621
  * @}
621
  */
622
  */
622
#define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
623
 
623
/**
624
/** @defgroup RTC_LL_EC_CALIB_PERIOD  Calibration period
624
  * @}
625
  * @{
625
  */
626
  */
626
 
627
#define LL_RTC_CALIB_PERIOD_32SEC          0x00000000U           /*!< Use a 32-second calibration cycle period */
627
/** @defgroup RTC_LL_EM_Convert Convert helper Macros
628
#define LL_RTC_CALIB_PERIOD_16SEC          RTC_CALR_CALW16       /*!< Use a 16-second calibration cycle period */
628
  * @{
629
#define LL_RTC_CALIB_PERIOD_8SEC           RTC_CALR_CALW8        /*!< Use a 8-second calibration cycle period */
629
  */
630
/**
630
 
631
  * @}
631
/**
632
  */
632
  * @brief  Helper macro to convert a value from 2 digit decimal format to BCD format
633
 
633
  * @param  __VALUE__ Byte to be converted
634
/**
634
  * @retval Converted byte
635
  * @}
635
  */
636
  */
636
#define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
637
 
637
 
638
/* Exported macro ------------------------------------------------------------*/
638
/**
639
/** @defgroup RTC_LL_Exported_Macros RTC Exported Macros
639
  * @brief  Helper macro to convert a value from BCD format to 2 digit decimal format
640
  * @{
640
  * @param  __VALUE__ BCD value to be converted
641
  */
641
  * @retval Converted byte
642
 
642
  */
643
/** @defgroup RTC_LL_EM_WRITE_READ Common Write and read registers Macros
643
#define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) (uint8_t)(((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U + ((__VALUE__) & (uint8_t)0x0FU))
644
  * @{
644
 
645
  */
645
/**
646
 
646
  * @}
647
/**
647
  */
648
  * @brief  Write a value in RTC register
648
 
649
  * @param  __INSTANCE__ RTC Instance
649
/** @defgroup RTC_LL_EM_Date Date helper Macros
650
  * @param  __REG__ Register to be written
650
  * @{
651
  * @param  __VALUE__ Value to be written in the register
651
  */
652
  * @retval None
652
 
653
  */
653
/**
654
#define LL_RTC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, __VALUE__)
654
  * @brief  Helper macro to retrieve weekday.
655
 
655
  * @param  __RTC_DATE__ Date returned by @ref  LL_RTC_DATE_Get function.
656
/**
656
  * @retval Returned value can be one of the following values:
657
  * @brief  Read a value in RTC register
657
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
658
  * @param  __INSTANCE__ RTC Instance
658
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
659
  * @param  __REG__ Register to be read
659
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
660
  * @retval Register value
660
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
661
  */
661
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
662
#define LL_RTC_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
662
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
663
/**
663
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
664
  * @}
664
  */
665
  */
665
#define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
666
 
666
 
667
/** @defgroup RTC_LL_EM_Convert Convert helper Macros
667
/**
668
  * @{
668
  * @brief  Helper macro to retrieve Year in BCD format
669
  */
669
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
670
 
670
  * @retval Year in BCD format (0x00 . . . 0x99)
671
/**
671
  */
672
  * @brief  Helper macro to convert a value from 2 digit decimal format to BCD format
672
#define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
673
  * @param  __VALUE__ Byte to be converted
673
 
674
  * @retval Converted byte
674
/**
675
  */
675
  * @brief  Helper macro to retrieve Month in BCD format
676
#define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
676
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
677
 
677
  * @retval Returned value can be one of the following values:
678
/**
678
  *         @arg @ref LL_RTC_MONTH_JANUARY
679
  * @brief  Helper macro to convert a value from BCD format to 2 digit decimal format
679
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
680
  * @param  __VALUE__ BCD value to be converted
680
  *         @arg @ref LL_RTC_MONTH_MARCH
681
  * @retval Converted byte
681
  *         @arg @ref LL_RTC_MONTH_APRIL
682
  */
682
  *         @arg @ref LL_RTC_MONTH_MAY
683
#define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) ((uint8_t)((((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U) + ((__VALUE__) & (uint8_t)0x0FU)))
683
  *         @arg @ref LL_RTC_MONTH_JUNE
684
 
684
  *         @arg @ref LL_RTC_MONTH_JULY
685
/**
685
  *         @arg @ref LL_RTC_MONTH_AUGUST
686
  * @}
686
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
687
  */
687
  *         @arg @ref LL_RTC_MONTH_OCTOBER
688
 
688
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
689
/** @defgroup RTC_LL_EM_Date Date helper Macros
689
  *         @arg @ref LL_RTC_MONTH_DECEMBER
690
  * @{
690
  */
691
  */
691
#define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
692
 
692
 
693
/**
693
/**
694
  * @brief  Helper macro to retrieve weekday.
694
  * @brief  Helper macro to retrieve Day in BCD format
695
  * @param  __RTC_DATE__ Date returned by @ref  LL_RTC_DATE_Get function.
695
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
696
  * @retval Returned value can be one of the following values:
696
  * @retval Day in BCD format (0x01 . . . 0x31)
697
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
697
  */
698
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
698
#define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
699
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
699
 
700
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
700
/**
701
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
701
  * @}
702
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
702
  */
703
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
703
 
704
  */
704
/** @defgroup RTC_LL_EM_Time Time helper Macros
705
#define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
705
  * @{
706
 
706
  */
707
/**
707
 
708
  * @brief  Helper macro to retrieve Year in BCD format
708
/**
709
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
709
  * @brief  Helper macro to retrieve hour in BCD format
710
  * @retval Year in BCD format (0x00 . . . 0x99)
710
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
711
  */
711
  * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
712
#define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
712
  */
713
 
713
#define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
714
/**
714
 
715
  * @brief  Helper macro to retrieve Month in BCD format
715
/**
716
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
716
  * @brief  Helper macro to retrieve minute in BCD format
717
  * @retval Returned value can be one of the following values:
717
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
718
  *         @arg @ref LL_RTC_MONTH_JANUARY
718
  * @retval Minutes in BCD format (0x00. . .0x59)
719
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
719
  */
720
  *         @arg @ref LL_RTC_MONTH_MARCH
720
#define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
721
  *         @arg @ref LL_RTC_MONTH_APRIL
721
 
722
  *         @arg @ref LL_RTC_MONTH_MAY
722
/**
723
  *         @arg @ref LL_RTC_MONTH_JUNE
723
  * @brief  Helper macro to retrieve second in BCD format
724
  *         @arg @ref LL_RTC_MONTH_JULY
724
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
725
  *         @arg @ref LL_RTC_MONTH_AUGUST
725
  * @retval Seconds in  format (0x00. . .0x59)
726
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
726
  */
727
  *         @arg @ref LL_RTC_MONTH_OCTOBER
727
#define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
728
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
728
 
729
  *         @arg @ref LL_RTC_MONTH_DECEMBER
729
/**
730
  */
730
  * @}
731
#define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
731
  */
732
 
732
 
733
/**
733
/**
734
  * @brief  Helper macro to retrieve Day in BCD format
734
  * @}
735
  * @param  __RTC_DATE__ Value returned by @ref  LL_RTC_DATE_Get
735
  */
736
  * @retval Day in BCD format (0x01 . . . 0x31)
736
 
737
  */
737
/* Exported functions --------------------------------------------------------*/
738
#define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
738
/** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
739
 
739
  * @{
740
/**
740
  */
741
  * @}
741
 
742
  */
742
/** @defgroup RTC_LL_EF_Configuration Configuration
743
 
743
  * @{
744
/** @defgroup RTC_LL_EM_Time Time helper Macros
744
  */
745
  * @{
745
 
746
  */
746
/**
747
 
747
  * @brief  Set Hours format (24 hour/day or AM/PM hour format)
748
/**
748
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
749
  * @brief  Helper macro to retrieve hour in BCD format
749
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
750
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
750
  * @rmtoll CR           FMT           LL_RTC_SetHourFormat
751
  * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
751
  * @param  RTCx RTC Instance
752
  */
752
  * @param  HourFormat This parameter can be one of the following values:
753
#define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
753
  *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
754
 
754
  *         @arg @ref LL_RTC_HOURFORMAT_AMPM
755
/**
755
  * @retval None
756
  * @brief  Helper macro to retrieve minute in BCD format
756
  */
757
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
757
__STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
758
  * @retval Minutes in BCD format (0x00. . .0x59)
758
{
759
  */
759
  MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
760
#define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
760
}
761
 
761
 
762
/**
762
/**
763
  * @brief  Helper macro to retrieve second in BCD format
763
  * @brief  Get Hours format (24 hour/day or AM/PM hour format)
764
  * @param  __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
764
  * @rmtoll CR           FMT           LL_RTC_GetHourFormat
765
  * @retval Seconds in  format (0x00. . .0x59)
765
  * @param  RTCx RTC Instance
766
  */
766
  * @retval Returned value can be one of the following values:
767
#define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
767
  *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
768
 
768
  *         @arg @ref LL_RTC_HOURFORMAT_AMPM
769
/**
769
  */
770
  * @}
770
__STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
771
  */
771
{
772
 
772
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
773
/**
773
}
774
  * @}
774
 
775
  */
775
/**
776
 
776
  * @brief  Select the flag to be routed to RTC_ALARM output
777
/* Exported functions --------------------------------------------------------*/
777
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
778
/** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
778
  * @rmtoll CR           OSEL          LL_RTC_SetAlarmOutEvent
779
  * @{
779
  * @param  RTCx RTC Instance
780
  */
780
  * @param  AlarmOutput This parameter can be one of the following values:
781
 
781
  *         @arg @ref LL_RTC_ALARMOUT_DISABLE
782
/** @defgroup RTC_LL_EF_Configuration Configuration
782
  *         @arg @ref LL_RTC_ALARMOUT_ALMA
783
  * @{
783
  *         @arg @ref LL_RTC_ALARMOUT_ALMB
784
  */
784
  *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
785
 
785
  * @retval None
786
/**
786
  */
787
  * @brief  Set Hours format (24 hour/day or AM/PM hour format)
787
__STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
788
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
788
{
789
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
789
  MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
790
  * @rmtoll CR           FMT           LL_RTC_SetHourFormat
790
}
791
  * @param  RTCx RTC Instance
791
 
792
  * @param  HourFormat This parameter can be one of the following values:
792
/**
793
  *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
793
  * @brief  Get the flag to be routed to RTC_ALARM output
794
  *         @arg @ref LL_RTC_HOURFORMAT_AMPM
794
  * @rmtoll CR           OSEL          LL_RTC_GetAlarmOutEvent
795
  * @retval None
795
  * @param  RTCx RTC Instance
796
  */
796
  * @retval Returned value can be one of the following values:
797
__STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
797
  *         @arg @ref LL_RTC_ALARMOUT_DISABLE
798
{
798
  *         @arg @ref LL_RTC_ALARMOUT_ALMA
799
  MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
799
  *         @arg @ref LL_RTC_ALARMOUT_ALMB
800
}
800
  *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
801
 
801
  */
802
/**
802
__STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
803
  * @brief  Get Hours format (24 hour/day or AM/PM hour format)
803
{
804
  * @rmtoll CR           FMT           LL_RTC_GetHourFormat
804
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
805
  * @param  RTCx RTC Instance
805
}
806
  * @retval Returned value can be one of the following values:
806
 
807
  *         @arg @ref LL_RTC_HOURFORMAT_24HOUR
807
/**
808
  *         @arg @ref LL_RTC_HOURFORMAT_AMPM
808
  * @brief  Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
809
  */
809
  * @note   Used only when RTC_ALARM is mapped on PC13
810
__STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
810
  * @rmtoll TAFCR        ALARMOUTTYPE  LL_RTC_SetAlarmOutputType
811
{
811
  * @param  RTCx RTC Instance
812
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
812
  * @param  Output This parameter can be one of the following values:
813
}
813
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
814
 
814
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
815
/**
815
  * @retval None
816
  * @brief  Select the flag to be routed to RTC_ALARM output
816
  */
817
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
817
__STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
818
  * @rmtoll CR           OSEL          LL_RTC_SetAlarmOutEvent
818
{
819
  * @param  RTCx RTC Instance
819
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE, Output);
820
  * @param  AlarmOutput This parameter can be one of the following values:
820
}
821
  *         @arg @ref LL_RTC_ALARMOUT_DISABLE
821
 
822
  *         @arg @ref LL_RTC_ALARMOUT_ALMA
822
/**
823
  *         @arg @ref LL_RTC_ALARMOUT_ALMB
823
  * @brief  Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
824
  *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
824
  * @note   used only when RTC_ALARM is mapped on PC13
825
  * @retval None
825
  * @rmtoll TAFCR        ALARMOUTTYPE  LL_RTC_GetAlarmOutputType
826
  */
826
  * @param  RTCx RTC Instance
827
__STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
827
  * @retval Returned value can be one of the following values:
828
{
828
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
829
  MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
829
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
830
}
830
  */
831
 
831
__STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
832
/**
832
{
833
  * @brief  Get the flag to be routed to RTC_ALARM output
833
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE));
834
  * @rmtoll CR           OSEL          LL_RTC_GetAlarmOutEvent
834
}
835
  * @param  RTCx RTC Instance
835
 
836
  * @retval Returned value can be one of the following values:
836
/**
837
  *         @arg @ref LL_RTC_ALARMOUT_DISABLE
837
  * @brief  Enable initialization mode
838
  *         @arg @ref LL_RTC_ALARMOUT_ALMA
838
  * @note   Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
839
  *         @arg @ref LL_RTC_ALARMOUT_ALMB
839
  *         and prescaler register (RTC_PRER).
840
  *         @arg @ref LL_RTC_ALARMOUT_WAKEUP
840
  *         Counters are stopped and start counting from the new value when INIT is reset.
841
  */
841
  * @rmtoll ISR          INIT          LL_RTC_EnableInitMode
842
__STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
842
  * @param  RTCx RTC Instance
843
{
843
  * @retval None
844
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
844
  */
845
}
845
__STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
846
 
846
{
847
/**
847
  /* Set the Initialization mode */
848
  * @brief  Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
848
  WRITE_REG(RTCx->ISR, RTC_INIT_MASK);
849
  * @note   Used only when RTC_ALARM is mapped on PC13
849
}
850
  * @rmtoll TAFCR        ALARMOUTTYPE  LL_RTC_SetAlarmOutputType
850
 
851
  * @param  RTCx RTC Instance
851
/**
852
  * @param  Output This parameter can be one of the following values:
852
  * @brief  Disable initialization mode (Free running mode)
853
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
853
  * @rmtoll ISR          INIT          LL_RTC_DisableInitMode
854
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
854
  * @param  RTCx RTC Instance
855
  * @retval None
855
  * @retval None
856
  */
856
  */
857
__STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
857
__STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
858
{
858
{
859
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE, Output);
859
  /* Exit Initialization mode */
860
}
860
  WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
861
 
861
}
862
/**
862
 
863
  * @brief  Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
863
/**
864
  * @note   used only when RTC_ALARM is mapped on PC13
864
  * @brief  Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
865
  * @rmtoll TAFCR        ALARMOUTTYPE  LL_RTC_GetAlarmOutputType
865
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
866
  * @param  RTCx RTC Instance
866
  * @rmtoll CR           POL           LL_RTC_SetOutputPolarity
867
  * @retval Returned value can be one of the following values:
867
  * @param  RTCx RTC Instance
868
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
868
  * @param  Polarity This parameter can be one of the following values:
869
  *         @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
869
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
870
  */
870
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
871
__STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
871
  * @retval None
872
{
872
  */
873
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_ALARMOUTTYPE));
873
__STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
874
}
874
{
875
 
875
  MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
876
/**
876
}
877
  * @brief  Enable initialization mode
877
 
878
  * @note   Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
878
/**
879
  *         and prescaler register (RTC_PRER).
879
  * @brief  Get Output polarity
880
  *         Counters are stopped and start counting from the new value when INIT is reset.
880
  * @rmtoll CR           POL           LL_RTC_GetOutputPolarity
881
  * @rmtoll ISR          INIT          LL_RTC_EnableInitMode
881
  * @param  RTCx RTC Instance
882
  * @param  RTCx RTC Instance
882
  * @retval Returned value can be one of the following values:
883
  * @retval None
883
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
884
  */
884
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
885
__STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
885
  */
886
{
886
__STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
887
  /* Set the Initialization mode */
887
{
888
  WRITE_REG(RTCx->ISR, LL_RTC_INIT_MASK);
888
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
889
}
889
}
890
 
890
 
891
/**
891
#if defined(RTC_CR_BYPSHAD)
892
  * @brief  Disable initialization mode (Free running mode)
892
/**
893
  * @rmtoll ISR          INIT          LL_RTC_DisableInitMode
893
  * @brief  Enable Bypass the shadow registers
894
  * @param  RTCx RTC Instance
894
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
895
  * @retval None
895
  * @rmtoll CR           BYPSHAD       LL_RTC_EnableShadowRegBypass
896
  */
896
  * @param  RTCx RTC Instance
897
__STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
897
  * @retval None
898
{
898
  */
899
  /* Exit Initialization mode */
899
__STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
900
  WRITE_REG(RTCx->ISR, (uint32_t)~RTC_ISR_INIT);
900
{
901
}
901
  SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
902
 
902
}
903
/**
903
 
904
  * @brief  Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
904
/**
905
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
905
  * @brief  Disable Bypass the shadow registers
906
  * @rmtoll CR           POL           LL_RTC_SetOutputPolarity
906
  * @rmtoll CR           BYPSHAD       LL_RTC_DisableShadowRegBypass
907
  * @param  RTCx RTC Instance
907
  * @param  RTCx RTC Instance
908
  * @param  Polarity This parameter can be one of the following values:
908
  * @retval None
909
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
909
  */
910
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
910
__STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
911
  * @retval None
911
{
912
  */
912
  CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
913
__STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
913
}
914
{
914
 
915
  MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
915
/**
916
}
916
  * @brief  Check if Shadow registers bypass is enabled or not.
917
 
917
  * @rmtoll CR           BYPSHAD       LL_RTC_IsShadowRegBypassEnabled
918
/**
918
  * @param  RTCx RTC Instance
919
  * @brief  Get Output polarity
919
  * @retval State of bit (1 or 0).
920
  * @rmtoll CR           POL           LL_RTC_GetOutputPolarity
920
  */
921
  * @param  RTCx RTC Instance
921
__STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
922
  * @retval Returned value can be one of the following values:
922
{
923
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
923
  return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1UL : 0UL);
924
  *         @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
924
}
925
  */
925
#endif /* RTC_CR_BYPSHAD */
926
__STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
926
 
927
{
927
/**
928
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
928
  * @brief  Enable RTC_REFIN reference clock detection (50 or 60 Hz)
929
}
929
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
930
 
930
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
931
#if defined(RTC_CR_BYPSHAD)
931
  * @rmtoll CR           REFCKON       LL_RTC_EnableRefClock
932
/**
932
  * @param  RTCx RTC Instance
933
  * @brief  Enable Bypass the shadow registers
933
  * @retval None
934
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
934
  */
935
  * @rmtoll CR           BYPSHAD       LL_RTC_EnableShadowRegBypass
935
__STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
936
  * @param  RTCx RTC Instance
936
{
937
  * @retval None
937
  SET_BIT(RTCx->CR, RTC_CR_REFCKON);
938
  */
938
}
939
__STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
939
 
940
{
940
/**
941
  SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
941
  * @brief  Disable RTC_REFIN reference clock detection (50 or 60 Hz)
942
}
942
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
943
 
943
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
944
/**
944
  * @rmtoll CR           REFCKON       LL_RTC_DisableRefClock
945
  * @brief  Disable Bypass the shadow registers
945
  * @param  RTCx RTC Instance
946
  * @rmtoll CR           BYPSHAD       LL_RTC_DisableShadowRegBypass
946
  * @retval None
947
  * @param  RTCx RTC Instance
947
  */
948
  * @retval None
948
__STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
949
  */
949
{
950
__STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
950
  CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
951
{
951
}
952
  CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
952
 
953
}
953
/**
954
 
954
  * @brief  Set Asynchronous prescaler factor
955
/**
955
  * @rmtoll PRER         PREDIV_A      LL_RTC_SetAsynchPrescaler
956
  * @brief  Check if Shadow registers bypass is enabled or not.
956
  * @param  RTCx RTC Instance
957
  * @rmtoll CR           BYPSHAD       LL_RTC_IsShadowRegBypassEnabled
957
  * @param  AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
958
  * @param  RTCx RTC Instance
958
  * @retval None
959
  * @retval State of bit (1 or 0).
959
  */
960
  */
960
__STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
961
__STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
961
{
962
{
962
  MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
963
  return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1UL : 0UL);
963
}
964
}
964
 
965
 
965
/**
966
#endif /* RTC_CR_BYPSHAD */
966
  * @brief  Set Synchronous prescaler factor
967
/**
967
  * @rmtoll PRER         PREDIV_S      LL_RTC_SetSynchPrescaler
968
  * @brief  Enable RTC_REFIN reference clock detection (50 or 60 Hz)
968
  * @param  RTCx RTC Instance
969
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
969
  * @param  SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
970
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
970
  * @retval None
971
  * @rmtoll CR           REFCKON       LL_RTC_EnableRefClock
971
  */
972
  * @param  RTCx RTC Instance
972
__STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
973
  * @retval None
973
{
974
  */
974
  MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
975
__STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
975
}
976
{
976
 
977
  SET_BIT(RTCx->CR, RTC_CR_REFCKON);
977
/**
978
}
978
  * @brief  Get Asynchronous prescaler factor
979
 
979
  * @rmtoll PRER         PREDIV_A      LL_RTC_GetAsynchPrescaler
980
/**
980
  * @param  RTCx RTC Instance
981
  * @brief  Disable RTC_REFIN reference clock detection (50 or 60 Hz)
981
  * @retval Value between Min_Data = 0 and Max_Data = 0x7F
982
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
982
  */
983
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
983
__STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
984
  * @rmtoll CR           REFCKON       LL_RTC_DisableRefClock
984
{
985
  * @param  RTCx RTC Instance
985
  return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
986
  * @retval None
986
}
987
  */
987
 
988
__STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
988
/**
989
{
989
  * @brief  Get Synchronous prescaler factor
990
  CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
990
  * @rmtoll PRER         PREDIV_S      LL_RTC_GetSynchPrescaler
991
}
991
  * @param  RTCx RTC Instance
992
 
992
  * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
993
/**
993
  */
994
  * @brief  Set Asynchronous prescaler factor
994
__STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
995
  * @rmtoll PRER         PREDIV_A      LL_RTC_SetAsynchPrescaler
995
{
996
  * @param  RTCx RTC Instance
996
  return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
997
  * @param  AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
997
}
998
  * @retval None
998
 
999
  */
999
/**
1000
__STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
1000
  * @brief  Enable the write protection for RTC registers.
1001
{
1001
  * @rmtoll WPR          KEY           LL_RTC_EnableWriteProtection
1002
  MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
1002
  * @param  RTCx RTC Instance
1003
}
1003
  * @retval None
1004
 
1004
  */
1005
/**
1005
__STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
1006
  * @brief  Set Synchronous prescaler factor
1006
{
1007
  * @rmtoll PRER         PREDIV_S      LL_RTC_SetSynchPrescaler
1007
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
1008
  * @param  RTCx RTC Instance
1008
}
1009
  * @param  SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
1009
 
1010
  * @retval None
1010
/**
1011
  */
1011
  * @brief  Disable the write protection for RTC registers.
1012
__STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
1012
  * @rmtoll WPR          KEY           LL_RTC_DisableWriteProtection
1013
{
1013
  * @param  RTCx RTC Instance
1014
  MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
1014
  * @retval None
1015
}
1015
  */
1016
 
1016
__STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1017
/**
1017
{
1018
  * @brief  Get Asynchronous prescaler factor
1018
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1019
  * @rmtoll PRER         PREDIV_A      LL_RTC_GetAsynchPrescaler
1019
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1020
  * @param  RTCx RTC Instance
1020
}
1021
  * @retval Value between Min_Data = 0 and Max_Data = 0x7F
1021
 
1022
  */
1022
/**
1023
__STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
1023
  * @}
1024
{
1024
  */
1025
  return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
1025
 
1026
}
1026
/** @defgroup RTC_LL_EF_Time Time
1027
 
1027
  * @{
1028
/**
1028
  */
1029
  * @brief  Get Synchronous prescaler factor
1029
 
1030
  * @rmtoll PRER         PREDIV_S      LL_RTC_GetSynchPrescaler
1030
/**
1031
  * @param  RTCx RTC Instance
1031
  * @brief  Set time format (AM/24-hour or PM notation)
1032
  * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
1032
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1033
  */
1033
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1034
__STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
1034
  * @rmtoll TR           PM            LL_RTC_TIME_SetFormat
1035
{
1035
  * @param  RTCx RTC Instance
1036
  return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
1036
  * @param  TimeFormat This parameter can be one of the following values:
1037
}
1037
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1038
 
1038
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1039
/**
1039
  * @retval None
1040
  * @brief  Enable the write protection for RTC registers.
1040
  */
1041
  * @rmtoll WPR          KEY           LL_RTC_EnableWriteProtection
1041
__STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1042
  * @param  RTCx RTC Instance
1042
{
1043
  * @retval None
1043
  MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1044
  */
1044
}
1045
__STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
1045
 
1046
{
1046
/**
1047
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
1047
  * @brief  Get time format (AM or PM notation)
1048
}
1048
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1049
 
1049
  *       before reading this bit
1050
/**
1050
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1051
  * @brief  Disable the write protection for RTC registers.
1051
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1052
  * @rmtoll WPR          KEY           LL_RTC_DisableWriteProtection
1052
  * @rmtoll TR           PM            LL_RTC_TIME_GetFormat
1053
  * @param  RTCx RTC Instance
1053
  * @param  RTCx RTC Instance
1054
  * @retval None
1054
  * @retval Returned value can be one of the following values:
1055
  */
1055
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1056
__STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
1056
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1057
{
1057
  */
1058
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
1058
__STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
1059
  WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
1059
{
1060
}
1060
  return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1061
 
1061
}
1062
/**
1062
 
1063
  * @}
1063
/**
1064
  */
1064
  * @brief  Set Hours in BCD format
1065
 
1065
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1066
/** @defgroup RTC_LL_EF_Time Time
1066
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1067
  * @{
1067
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1068
  */
1068
  * @rmtoll TR           HT            LL_RTC_TIME_SetHour\n
1069
 
1069
  *         TR           HU            LL_RTC_TIME_SetHour
1070
/**
1070
  * @param  RTCx RTC Instance
1071
  * @brief  Set time format (AM/24-hour or PM notation)
1071
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1072
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1072
  * @retval None
1073
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1073
  */
1074
  * @rmtoll TR           PM            LL_RTC_TIME_SetFormat
1074
__STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1075
  * @param  RTCx RTC Instance
1075
{
1076
  * @param  TimeFormat This parameter can be one of the following values:
1076
  MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1077
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1077
             (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1078
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1078
}
1079
  * @retval None
1079
 
1080
  */
1080
/**
1081
__STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1081
  * @brief  Get Hours in BCD format
1082
{
1082
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1083
  MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
1083
  *       before reading this bit
1084
}
1084
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1085
 
1085
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1086
/**
1086
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1087
  * @brief  Get time format (AM or PM notation)
1087
  *       Binary format
1088
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1088
  * @rmtoll TR           HT            LL_RTC_TIME_GetHour\n
1089
  *       before reading this bit
1089
  *         TR           HU            LL_RTC_TIME_GetHour
1090
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1090
  * @param  RTCx RTC Instance
1091
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1091
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1092
  * @rmtoll TR           PM            LL_RTC_TIME_GetFormat
1092
  */
1093
  * @param  RTCx RTC Instance
1093
__STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
1094
  * @retval Returned value can be one of the following values:
1094
{
1095
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1095
  return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
1096
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1096
}
1097
  */
1097
 
1098
__STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
1098
/**
1099
{
1099
  * @brief  Set Minutes in BCD format
1100
  return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
1100
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1101
}
1101
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1102
 
1102
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1103
/**
1103
  * @rmtoll TR           MNT           LL_RTC_TIME_SetMinute\n
1104
  * @brief  Set Hours in BCD format
1104
  *         TR           MNU           LL_RTC_TIME_SetMinute
1105
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1105
  * @param  RTCx RTC Instance
1106
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1106
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1107
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
1107
  * @retval None
1108
  * @rmtoll TR           HT            LL_RTC_TIME_SetHour\n
1108
  */
1109
  *         TR           HU            LL_RTC_TIME_SetHour
1109
__STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1110
  * @param  RTCx RTC Instance
1110
{
1111
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1111
  MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1112
  * @retval None
1112
             (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1113
  */
1113
}
1114
__STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1114
 
1115
{
1115
/**
1116
  MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
1116
  * @brief  Get Minutes in BCD format
1117
             (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
1117
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1118
}
1118
  *       before reading this bit
1119
 
1119
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1120
/**
1120
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1121
  * @brief  Get Hours in BCD format
1121
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1122
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1122
  *       to Binary format
1123
  *       before reading this bit
1123
  * @rmtoll TR           MNT           LL_RTC_TIME_GetMinute\n
1124
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1124
  *         TR           MNU           LL_RTC_TIME_GetMinute
1125
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1125
  * @param  RTCx RTC Instance
1126
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
1126
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1127
  *       Binary format
1127
  */
1128
  * @rmtoll TR           HT            LL_RTC_TIME_GetHour\n
1128
__STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
1129
  *         TR           HU            LL_RTC_TIME_GetHour
1129
{
1130
  * @param  RTCx RTC Instance
1130
  return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
1131
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1131
}
1132
  */
1132
 
1133
__STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
1133
/**
1134
{
1134
  * @brief  Set Seconds in BCD format
1135
  return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
1135
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1136
}
1136
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1137
 
1137
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1138
/**
1138
  * @rmtoll TR           ST            LL_RTC_TIME_SetSecond\n
1139
  * @brief  Set Minutes in BCD format
1139
  *         TR           SU            LL_RTC_TIME_SetSecond
1140
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1140
  * @param  RTCx RTC Instance
1141
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1141
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1142
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1142
  * @retval None
1143
  * @rmtoll TR           MNT           LL_RTC_TIME_SetMinute\n
1143
  */
1144
  *         TR           MNU           LL_RTC_TIME_SetMinute
1144
__STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1145
  * @param  RTCx RTC Instance
1145
{
1146
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1146
  MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1147
  * @retval None
1147
             (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1148
  */
1148
}
1149
__STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1149
 
1150
{
1150
/**
1151
  MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
1151
  * @brief  Get Seconds in BCD format
1152
             (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
1152
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1153
}
1153
  *       before reading this bit
1154
 
1154
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1155
/**
1155
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1156
  * @brief  Get Minutes in BCD format
1156
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1157
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1157
  *       to Binary format
1158
  *       before reading this bit
1158
  * @rmtoll TR           ST            LL_RTC_TIME_GetSecond\n
1159
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1159
  *         TR           SU            LL_RTC_TIME_GetSecond
1160
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1160
  * @param  RTCx RTC Instance
1161
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
1161
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1162
  *       to Binary format
1162
  */
1163
  * @rmtoll TR           MNT           LL_RTC_TIME_GetMinute\n
1163
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
1164
  *         TR           MNU           LL_RTC_TIME_GetMinute
1164
{
1165
  * @param  RTCx RTC Instance
1165
  return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
1166
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1166
}
1167
  */
1167
 
1168
__STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
1168
/**
1169
{
1169
  * @brief  Set time (hour, minute and second) in BCD format
1170
  return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
1170
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1171
}
1171
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1172
 
1172
  * @note TimeFormat and Hours should follow the same format
1173
/**
1173
  * @rmtoll TR           PM            LL_RTC_TIME_Config\n
1174
  * @brief  Set Seconds in BCD format
1174
  *         TR           HT            LL_RTC_TIME_Config\n
1175
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1175
  *         TR           HU            LL_RTC_TIME_Config\n
1176
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1176
  *         TR           MNT           LL_RTC_TIME_Config\n
1177
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1177
  *         TR           MNU           LL_RTC_TIME_Config\n
1178
  * @rmtoll TR           ST            LL_RTC_TIME_SetSecond\n
1178
  *         TR           ST            LL_RTC_TIME_Config\n
1179
  *         TR           SU            LL_RTC_TIME_SetSecond
1179
  *         TR           SU            LL_RTC_TIME_Config
1180
  * @param  RTCx RTC Instance
1180
  * @param  RTCx RTC Instance
1181
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1181
  * @param  Format12_24 This parameter can be one of the following values:
1182
  * @retval None
1182
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1183
  */
1183
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1184
__STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1184
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1185
{
1185
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1186
  MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
1186
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1187
             (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
1187
  * @retval None
1188
}
1188
  */
1189
 
1189
__STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1190
/**
1190
{
1191
  * @brief  Get Seconds in BCD format
1191
  uint32_t temp;
1192
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1192
 
1193
  *       before reading this bit
1193
  temp = Format12_24                                                                            | \
1194
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1194
         (((Hours   & 0xF0U) << (RTC_TR_HT_Pos  - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))    | \
1195
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1195
         (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1196
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
1196
         (((Seconds & 0xF0U) << (RTC_TR_ST_Pos  - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1197
  *       to Binary format
1197
  MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp);
1198
  * @rmtoll TR           ST            LL_RTC_TIME_GetSecond\n
1198
}
1199
  *         TR           SU            LL_RTC_TIME_GetSecond
1199
 
1200
  * @param  RTCx RTC Instance
1200
/**
1201
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1201
  * @brief  Get time (hour, minute and second) in BCD format
1202
  */
1202
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1203
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
1203
  *       before reading this bit
1204
{
1204
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1205
  return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
1205
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1206
}
1206
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1207
 
1207
  *       are available to get independently each parameter.
1208
/**
1208
  * @rmtoll TR           HT            LL_RTC_TIME_Get\n
1209
  * @brief  Set time (hour, minute and second) in BCD format
1209
  *         TR           HU            LL_RTC_TIME_Get\n
1210
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1210
  *         TR           MNT           LL_RTC_TIME_Get\n
1211
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
1211
  *         TR           MNU           LL_RTC_TIME_Get\n
1212
  * @note TimeFormat and Hours should follow the same format
1212
  *         TR           ST            LL_RTC_TIME_Get\n
1213
  * @rmtoll TR           PM            LL_RTC_TIME_Config\n
1213
  *         TR           SU            LL_RTC_TIME_Get
1214
  *         TR           HT            LL_RTC_TIME_Config\n
1214
  * @param  RTCx RTC Instance
1215
  *         TR           HU            LL_RTC_TIME_Config\n
1215
  * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1216
  *         TR           MNT           LL_RTC_TIME_Config\n
1216
  */
1217
  *         TR           MNU           LL_RTC_TIME_Config\n
1217
__STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
1218
  *         TR           ST            LL_RTC_TIME_Config\n
1218
{
1219
  *         TR           SU            LL_RTC_TIME_Config
1219
  return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU)));
1220
  * @param  RTCx RTC Instance
1220
}
1221
  * @param  Format12_24 This parameter can be one of the following values:
1221
 
1222
  *         @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
1222
/**
1223
  *         @arg @ref LL_RTC_TIME_FORMAT_PM
1223
  * @brief  Memorize whether the daylight saving time change has been performed
1224
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1224
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1225
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1225
  * @rmtoll CR           BKP           LL_RTC_TIME_EnableDayLightStore
1226
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1226
  * @param  RTCx RTC Instance
1227
  * @retval None
1227
  * @retval None
1228
  */
1228
  */
1229
__STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1229
__STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1230
{
1230
{
1231
  uint32_t temp;
1231
  SET_BIT(RTCx->CR, RTC_CR_BKP);
1232
 
1232
}
1233
  temp = Format12_24                                                                                    | \
1233
 
1234
         (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos))     | \
1234
/**
1235
         (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
1235
  * @brief  Disable memorization whether the daylight saving time change has been performed.
1236
         (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
1236
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1237
  MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp);
1237
  * @rmtoll CR           BKP           LL_RTC_TIME_DisableDayLightStore
1238
}
1238
  * @param  RTCx RTC Instance
1239
 
1239
  * @retval None
1240
/**
1240
  */
1241
  * @brief  Get time (hour, minute and second) in BCD format
1241
__STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1242
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1242
{
1243
  *       before reading this bit
1243
  CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1244
  * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
1244
}
1245
  *       shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
1245
 
1246
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1246
/**
1247
  *       are available to get independently each parameter.
1247
  * @brief  Check if RTC Day Light Saving stored operation has been enabled or not
1248
  * @rmtoll TR           HT            LL_RTC_TIME_Get\n
1248
  * @rmtoll CR           BKP           LL_RTC_TIME_IsDayLightStoreEnabled
1249
  *         TR           HU            LL_RTC_TIME_Get\n
1249
  * @param  RTCx RTC Instance
1250
  *         TR           MNT           LL_RTC_TIME_Get\n
1250
  * @retval State of bit (1 or 0).
1251
  *         TR           MNU           LL_RTC_TIME_Get\n
1251
  */
1252
  *         TR           ST            LL_RTC_TIME_Get\n
1252
__STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
1253
  *         TR           SU            LL_RTC_TIME_Get
1253
{
1254
  * @param  RTCx RTC Instance
1254
  return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1UL : 0UL);
1255
  * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
1255
}
1256
  */
1256
 
1257
__STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
1257
/**
1258
{
1258
  * @brief  Subtract 1 hour (winter time change)
1259
  uint32_t temp;
1259
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1260
 
1260
  * @rmtoll CR           SUB1H         LL_RTC_TIME_DecHour
1261
  temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU));
1261
  * @param  RTCx RTC Instance
1262
  return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) |  \
1262
  * @retval None
1263
                    (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \
1263
  */
1264
                    ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)));
1264
__STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1265
}
1265
{
1266
 
1266
  SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1267
/**
1267
}
1268
  * @brief  Memorize whether the daylight saving time change has been performed
1268
 
1269
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1269
/**
1270
  * @rmtoll CR           BKP           LL_RTC_TIME_EnableDayLightStore
1270
  * @brief  Add 1 hour (summer time change)
1271
  * @param  RTCx RTC Instance
1271
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1272
  * @retval None
1272
  * @rmtoll CR           ADD1H         LL_RTC_TIME_IncHour
1273
  */
1273
  * @param  RTCx RTC Instance
1274
__STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
1274
  * @retval None
1275
{
1275
  */
1276
  SET_BIT(RTCx->CR, RTC_CR_BKP);
1276
__STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1277
}
1277
{
1278
 
1278
  SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1279
/**
1279
}
1280
  * @brief  Disable memorization whether the daylight saving time change has been performed.
1280
 
1281
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1281
#if defined(RTC_SUBSECOND_SUPPORT)
1282
  * @rmtoll CR           BKP           LL_RTC_TIME_DisableDayLightStore
1282
/**
1283
  * @param  RTCx RTC Instance
1283
  * @brief  Get subseconds value in the synchronous prescaler counter.
1284
  * @retval None
1284
  * @note  You can use both SubSeconds value and SecondFraction (PREDIV_S through
1285
  */
1285
  *        LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1286
__STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
1286
  *        SubSeconds value in second fraction ratio with time unit following
1287
{
1287
  *        generic formula:
1288
  CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
1288
  *          ==> Seconds fraction ratio * time_unit =
1289
}
1289
  *                 [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1290
 
1290
  *        This conversion can be performed only if no shift operation is pending
1291
/**
1291
  *        (ie. SHFP=0) when PREDIV_S >= SS.
1292
  * @brief  Check if RTC Day Light Saving stored operation has been enabled or not
1292
  * @rmtoll SSR          SS            LL_RTC_TIME_GetSubSecond
1293
  * @rmtoll CR           BKP           LL_RTC_TIME_IsDayLightStoreEnabled
1293
  * @param  RTCx RTC Instance
1294
  * @param  RTCx RTC Instance
1294
  * @retval Subseconds value (number between 0 and 65535)
1295
  * @retval State of bit (1 or 0).
1295
  */
1296
  */
1296
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
1297
__STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
1297
{
1298
{
1298
  return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1299
  return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1UL : 0UL);
1299
}
1300
}
1300
 
1301
 
1301
/**
1302
/**
1302
  * @brief  Synchronize to a remote clock with a high degree of precision.
1303
  * @brief  Subtract 1 hour (winter time change)
1303
  * @note   This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1304
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1304
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1305
  * @rmtoll CR           SUB1H         LL_RTC_TIME_DecHour
1305
  * @note   When REFCKON is set, firmware must not write to Shift control register.
1306
  * @param  RTCx RTC Instance
1306
  * @rmtoll SHIFTR       ADD1S         LL_RTC_TIME_Synchronize\n
1307
  * @retval None
1307
  *         SHIFTR       SUBFS         LL_RTC_TIME_Synchronize
1308
  */
1308
  * @param  RTCx RTC Instance
1309
__STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
1309
  * @param  ShiftSecond This parameter can be one of the following values:
1310
{
1310
  *         @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1311
  SET_BIT(RTCx->CR, RTC_CR_SUB1H);
1311
  *         @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1312
}
1312
  * @param  Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1313
 
1313
  * @retval None
1314
/**
1314
  */
1315
  * @brief  Add 1 hour (summer time change)
1315
__STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1316
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1316
{
1317
  * @rmtoll CR           ADD1H         LL_RTC_TIME_IncHour
1317
  WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1318
  * @param  RTCx RTC Instance
1318
}
1319
  * @retval None
1319
#endif /* RTC_SUBSECOND_SUPPORT */
1320
  */
1320
 
1321
__STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
1321
/**
1322
{
1322
  * @}
1323
  SET_BIT(RTCx->CR, RTC_CR_ADD1H);
1323
  */
1324
}
1324
 
1325
 
1325
/** @defgroup RTC_LL_EF_Date Date
1326
#if defined(RTC_SUBSECOND_SUPPORT)
1326
  * @{
1327
/**
1327
  */
1328
  * @brief  Get Sub second value in the synchronous prescaler counter.
1328
 
1329
  * @note  You can use both SubSeconds value and SecondFraction (PREDIV_S through
1329
/**
1330
  *        LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
1330
  * @brief  Set Year in BCD format
1331
  *        SubSeconds value in second fraction ratio with time unit following
1331
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1332
  *        generic formula:
1332
  * @rmtoll DR           YT            LL_RTC_DATE_SetYear\n
1333
  *          ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
1333
  *         DR           YU            LL_RTC_DATE_SetYear
1334
  *        This conversion can be performed only if no shift operation is pending
1334
  * @param  RTCx RTC Instance
1335
  *        (ie. SHFP=0) when PREDIV_S >= SS.
1335
  * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1336
  * @rmtoll SSR          SS            LL_RTC_TIME_GetSubSecond
1336
  * @retval None
1337
  * @param  RTCx RTC Instance
1337
  */
1338
  * @retval Sub second value (number between 0 and 65535)
1338
__STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1339
  */
1339
{
1340
__STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
1340
  MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1341
{
1341
             (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1342
  return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
1342
}
1343
}
1343
 
1344
#endif /* RTC_SUBSECOND_SUPPORT */
1344
/**
1345
 
1345
  * @brief  Get Year in BCD format
1346
#if defined(RTC_SHIFTR_ADD1S)
1346
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1347
/**
1347
  *       before reading this bit
1348
  * @brief  Synchronize to a remote clock with a high degree of precision.
1348
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1349
  * @note   This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
1349
  * @rmtoll DR           YT            LL_RTC_DATE_GetYear\n
1350
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1350
  *         DR           YU            LL_RTC_DATE_GetYear
1351
  * @note   When REFCKON is set, firmware must not write to Shift control register.
1351
  * @param  RTCx RTC Instance
1352
  * @rmtoll SHIFTR       ADD1S         LL_RTC_TIME_Synchronize\n
1352
  * @retval Value between Min_Data=0x00 and Max_Data=0x99
1353
  *         SHIFTR       SUBFS         LL_RTC_TIME_Synchronize
1353
  */
1354
  * @param  RTCx RTC Instance
1354
__STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
1355
  * @param  ShiftSecond This parameter can be one of the following values:
1355
{
1356
  *         @arg @ref LL_RTC_SHIFT_SECOND_DELAY
1356
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
1357
  *         @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
1357
}
1358
  * @param  Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
1358
 
1359
  * @retval None
1359
/**
1360
  */
1360
  * @brief  Set Week day
1361
__STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
1361
  * @rmtoll DR           WDU           LL_RTC_DATE_SetWeekDay
1362
{
1362
  * @param  RTCx RTC Instance
1363
  WRITE_REG(RTCx->SHIFTR, ShiftSecond | Fraction);
1363
  * @param  WeekDay This parameter can be one of the following values:
1364
}
1364
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1365
#endif /* RTC_SHIFTR_ADD1S */
1365
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1366
 
1366
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1367
/**
1367
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1368
  * @}
1368
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1369
  */
1369
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1370
 
1370
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1371
/** @defgroup RTC_LL_EF_Date Date
1371
  * @retval None
1372
  * @{
1372
  */
1373
  */
1373
__STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1374
 
1374
{
1375
/**
1375
  MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1376
  * @brief  Set Year in BCD format
1376
}
1377
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
1377
 
1378
  * @rmtoll DR           YT            LL_RTC_DATE_SetYear\n
1378
/**
1379
  *         DR           YU            LL_RTC_DATE_SetYear
1379
  * @brief  Get Week day
1380
  * @param  RTCx RTC Instance
1380
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1381
  * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1381
  *       before reading this bit
1382
  * @retval None
1382
  * @rmtoll DR           WDU           LL_RTC_DATE_GetWeekDay
1383
  */
1383
  * @param  RTCx RTC Instance
1384
__STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
1384
  * @retval Returned value can be one of the following values:
1385
{
1385
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1386
  MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
1386
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1387
             (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
1387
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1388
}
1388
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1389
 
1389
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1390
/**
1390
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1391
  * @brief  Get Year in BCD format
1391
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1392
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1392
  */
1393
  *       before reading this bit
1393
__STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
1394
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
1394
{
1395
  * @rmtoll DR           YT            LL_RTC_DATE_GetYear\n
1395
  return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1396
  *         DR           YU            LL_RTC_DATE_GetYear
1396
}
1397
  * @param  RTCx RTC Instance
1397
 
1398
  * @retval Value between Min_Data=0x00 and Max_Data=0x99
1398
/**
1399
  */
1399
  * @brief  Set Month in BCD format
1400
__STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
1400
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1401
{
1401
  * @rmtoll DR           MT            LL_RTC_DATE_SetMonth\n
1402
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
1402
  *         DR           MU            LL_RTC_DATE_SetMonth
1403
}
1403
  * @param  RTCx RTC Instance
1404
 
1404
  * @param  Month This parameter can be one of the following values:
1405
/**
1405
  *         @arg @ref LL_RTC_MONTH_JANUARY
1406
  * @brief  Set Week day
1406
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1407
  * @rmtoll DR           WDU           LL_RTC_DATE_SetWeekDay
1407
  *         @arg @ref LL_RTC_MONTH_MARCH
1408
  * @param  RTCx RTC Instance
1408
  *         @arg @ref LL_RTC_MONTH_APRIL
1409
  * @param  WeekDay This parameter can be one of the following values:
1409
  *         @arg @ref LL_RTC_MONTH_MAY
1410
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1410
  *         @arg @ref LL_RTC_MONTH_JUNE
1411
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1411
  *         @arg @ref LL_RTC_MONTH_JULY
1412
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1412
  *         @arg @ref LL_RTC_MONTH_AUGUST
1413
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1413
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1414
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1414
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1415
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1415
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1416
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1416
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1417
  * @retval None
1417
  * @retval None
1418
  */
1418
  */
1419
__STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1419
__STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1420
{
1420
{
1421
  MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
1421
  MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1422
}
1422
             (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1423
 
1423
}
1424
/**
1424
 
1425
  * @brief  Get Week day
1425
/**
1426
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1426
  * @brief  Get Month in BCD format
1427
  *       before reading this bit
1427
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1428
  * @rmtoll DR           WDU           LL_RTC_DATE_GetWeekDay
1428
  *       before reading this bit
1429
  * @param  RTCx RTC Instance
1429
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1430
  * @retval Returned value can be one of the following values:
1430
  * @rmtoll DR           MT            LL_RTC_DATE_GetMonth\n
1431
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1431
  *         DR           MU            LL_RTC_DATE_GetMonth
1432
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1432
  * @param  RTCx RTC Instance
1433
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1433
  * @retval Returned value can be one of the following values:
1434
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1434
  *         @arg @ref LL_RTC_MONTH_JANUARY
1435
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1435
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1436
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1436
  *         @arg @ref LL_RTC_MONTH_MARCH
1437
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1437
  *         @arg @ref LL_RTC_MONTH_APRIL
1438
  */
1438
  *         @arg @ref LL_RTC_MONTH_MAY
1439
__STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
1439
  *         @arg @ref LL_RTC_MONTH_JUNE
1440
{
1440
  *         @arg @ref LL_RTC_MONTH_JULY
1441
  return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
1441
  *         @arg @ref LL_RTC_MONTH_AUGUST
1442
}
1442
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1443
 
1443
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1444
/**
1444
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1445
  * @brief  Set Month in BCD format
1445
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1446
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
1446
  */
1447
  * @rmtoll DR           MT            LL_RTC_DATE_SetMonth\n
1447
__STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
1448
  *         DR           MU            LL_RTC_DATE_SetMonth
1448
{
1449
  * @param  RTCx RTC Instance
1449
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
1450
  * @param  Month This parameter can be one of the following values:
1450
}
1451
  *         @arg @ref LL_RTC_MONTH_JANUARY
1451
 
1452
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1452
/**
1453
  *         @arg @ref LL_RTC_MONTH_MARCH
1453
  * @brief  Set Day in BCD format
1454
  *         @arg @ref LL_RTC_MONTH_APRIL
1454
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1455
  *         @arg @ref LL_RTC_MONTH_MAY
1455
  * @rmtoll DR           DT            LL_RTC_DATE_SetDay\n
1456
  *         @arg @ref LL_RTC_MONTH_JUNE
1456
  *         DR           DU            LL_RTC_DATE_SetDay
1457
  *         @arg @ref LL_RTC_MONTH_JULY
1457
  * @param  RTCx RTC Instance
1458
  *         @arg @ref LL_RTC_MONTH_AUGUST
1458
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1459
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1459
  * @retval None
1460
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1460
  */
1461
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1461
__STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1462
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1462
{
1463
  * @retval None
1463
  MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1464
  */
1464
             (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1465
__STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
1465
}
1466
{
1466
 
1467
  MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
1467
/**
1468
             (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
1468
  * @brief  Get Day in BCD format
1469
}
1469
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1470
 
1470
  *       before reading this bit
1471
/**
1471
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1472
  * @brief  Get Month in BCD format
1472
  * @rmtoll DR           DT            LL_RTC_DATE_GetDay\n
1473
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1473
  *         DR           DU            LL_RTC_DATE_GetDay
1474
  *       before reading this bit
1474
  * @param  RTCx RTC Instance
1475
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
1475
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
1476
  * @rmtoll DR           MT            LL_RTC_DATE_GetMonth\n
1476
  */
1477
  *         DR           MU            LL_RTC_DATE_GetMonth
1477
__STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
1478
  * @param  RTCx RTC Instance
1478
{
1479
  * @retval Returned value can be one of the following values:
1479
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
1480
  *         @arg @ref LL_RTC_MONTH_JANUARY
1480
}
1481
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1481
 
1482
  *         @arg @ref LL_RTC_MONTH_MARCH
1482
/**
1483
  *         @arg @ref LL_RTC_MONTH_APRIL
1483
  * @brief  Set date (WeekDay, Day, Month and Year) in BCD format
1484
  *         @arg @ref LL_RTC_MONTH_MAY
1484
  * @rmtoll DR           WDU           LL_RTC_DATE_Config\n
1485
  *         @arg @ref LL_RTC_MONTH_JUNE
1485
  *         DR           MT            LL_RTC_DATE_Config\n
1486
  *         @arg @ref LL_RTC_MONTH_JULY
1486
  *         DR           MU            LL_RTC_DATE_Config\n
1487
  *         @arg @ref LL_RTC_MONTH_AUGUST
1487
  *         DR           DT            LL_RTC_DATE_Config\n
1488
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1488
  *         DR           DU            LL_RTC_DATE_Config\n
1489
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1489
  *         DR           YT            LL_RTC_DATE_Config\n
1490
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1490
  *         DR           YU            LL_RTC_DATE_Config
1491
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1491
  * @param  RTCx RTC Instance
1492
  */
1492
  * @param  WeekDay This parameter can be one of the following values:
1493
__STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
1493
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1494
{
1494
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1495
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
1495
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1496
}
1496
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1497
 
1497
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1498
/**
1498
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1499
  * @brief  Set Day in BCD format
1499
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1500
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1500
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1501
  * @rmtoll DR           DT            LL_RTC_DATE_SetDay\n
1501
  * @param  Month This parameter can be one of the following values:
1502
  *         DR           DU            LL_RTC_DATE_SetDay
1502
  *         @arg @ref LL_RTC_MONTH_JANUARY
1503
  * @param  RTCx RTC Instance
1503
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1504
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1504
  *         @arg @ref LL_RTC_MONTH_MARCH
1505
  * @retval None
1505
  *         @arg @ref LL_RTC_MONTH_APRIL
1506
  */
1506
  *         @arg @ref LL_RTC_MONTH_MAY
1507
__STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1507
  *         @arg @ref LL_RTC_MONTH_JUNE
1508
{
1508
  *         @arg @ref LL_RTC_MONTH_JULY
1509
  MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
1509
  *         @arg @ref LL_RTC_MONTH_AUGUST
1510
             (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
1510
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1511
}
1511
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1512
 
1512
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1513
/**
1513
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1514
  * @brief  Get Day in BCD format
1514
  * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1515
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1515
  * @retval None
1516
  *       before reading this bit
1516
  */
1517
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1517
__STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
1518
  * @rmtoll DR           DT            LL_RTC_DATE_GetDay\n
1518
{
1519
  *         DR           DU            LL_RTC_DATE_GetDay
1519
  uint32_t temp;
1520
  * @param  RTCx RTC Instance
1520
 
1521
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
1521
  temp = (  WeekDay                                                    << RTC_DR_WDU_Pos) | \
1522
  */
1522
         (((Year  & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year  & 0x0FU) << RTC_DR_YU_Pos)) | \
1523
__STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
1523
         (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
1524
{
1524
         (((Day   & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day   & 0x0FU) << RTC_DR_DU_Pos));
1525
  return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
1525
 
1526
}
1526
  MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp);
1527
 
1527
}
1528
/**
1528
 
1529
  * @brief  Set date (WeekDay, Day, Month and Year) in BCD format
1529
/**
1530
  * @rmtoll DR           WDU           LL_RTC_DATE_Config\n
1530
  * @brief  Get date (WeekDay, Day, Month and Year) in BCD format
1531
  *         DR           MT            LL_RTC_DATE_Config\n
1531
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1532
  *         DR           MU            LL_RTC_DATE_Config\n
1532
  *       before reading this bit
1533
  *         DR           DT            LL_RTC_DATE_Config\n
1533
  * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1534
  *         DR           DU            LL_RTC_DATE_Config\n
1534
  * and __LL_RTC_GET_DAY are available to get independently each parameter.
1535
  *         DR           YT            LL_RTC_DATE_Config\n
1535
  * @rmtoll DR           WDU           LL_RTC_DATE_Get\n
1536
  *         DR           YU            LL_RTC_DATE_Config
1536
  *         DR           MT            LL_RTC_DATE_Get\n
1537
  * @param  RTCx RTC Instance
1537
  *         DR           MU            LL_RTC_DATE_Get\n
1538
  * @param  WeekDay This parameter can be one of the following values:
1538
  *         DR           DT            LL_RTC_DATE_Get\n
1539
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1539
  *         DR           DU            LL_RTC_DATE_Get\n
1540
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1540
  *         DR           YT            LL_RTC_DATE_Get\n
1541
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1541
  *         DR           YU            LL_RTC_DATE_Get
1542
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1542
  * @param  RTCx RTC Instance
1543
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1543
  * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1544
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1544
  */
1545
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1545
__STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
1546
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1546
{
1547
  * @param  Month This parameter can be one of the following values:
1547
  uint32_t temp;
1548
  *         @arg @ref LL_RTC_MONTH_JANUARY
1548
 
1549
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
1549
  temp = READ_BIT(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU));
1550
  *         @arg @ref LL_RTC_MONTH_MARCH
1550
 
1551
  *         @arg @ref LL_RTC_MONTH_APRIL
1551
  return (uint32_t)((((temp &              RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
1552
  *         @arg @ref LL_RTC_MONTH_MAY
1552
                    (((temp & (RTC_DR_DT | RTC_DR_DU)) >> RTC_DR_DU_Pos)  << RTC_OFFSET_DAY)     | \
1553
  *         @arg @ref LL_RTC_MONTH_JUNE
1553
                    (((temp & (RTC_DR_MT | RTC_DR_MU)) >> RTC_DR_MU_Pos)  << RTC_OFFSET_MONTH)   | \
1554
  *         @arg @ref LL_RTC_MONTH_JULY
1554
                     ((temp & (RTC_DR_YT | RTC_DR_YU)) >> RTC_DR_YU_Pos));
1555
  *         @arg @ref LL_RTC_MONTH_AUGUST
1555
}
1556
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
1556
 
1557
  *         @arg @ref LL_RTC_MONTH_OCTOBER
1557
/**
1558
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
1558
  * @}
1559
  *         @arg @ref LL_RTC_MONTH_DECEMBER
1559
  */
1560
  * @param  Year Value between Min_Data=0x00 and Max_Data=0x99
1560
 
1561
  * @retval None
1561
/** @defgroup RTC_LL_EF_ALARMA ALARMA
1562
  */
1562
  * @{
1563
__STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month, uint32_t Year)
1563
  */
1564
{
1564
 
1565
  uint32_t temp;
1565
/**
1566
 
1566
  * @brief  Enable Alarm A
1567
  temp = (WeekDay << RTC_DR_WDU_Pos)                                                        | \
1567
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1568
         (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos))   | \
1568
  * @rmtoll CR           ALRAE         LL_RTC_ALMA_Enable
1569
         (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
1569
  * @param  RTCx RTC Instance
1570
         (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
1570
  * @retval None
1571
 
1571
  */
1572
  MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp);
1572
__STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
1573
}
1573
{
1574
 
1574
  SET_BIT(RTCx->CR, RTC_CR_ALRAE);
1575
/**
1575
}
1576
  * @brief  Get date (WeekDay, Day, Month and Year) in BCD format
1576
 
1577
  * @note if shadow mode is disabled (BYPSHAD=0), need to check if RSF flag is set
1577
/**
1578
  *       before reading this bit
1578
  * @brief  Disable Alarm A
1579
  * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
1579
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1580
  * and __LL_RTC_GET_DAY are available to get independently each parameter.
1580
  * @rmtoll CR           ALRAE         LL_RTC_ALMA_Disable
1581
  * @rmtoll DR           WDU           LL_RTC_DATE_Get\n
1581
  * @param  RTCx RTC Instance
1582
  *         DR           MT            LL_RTC_DATE_Get\n
1582
  * @retval None
1583
  *         DR           MU            LL_RTC_DATE_Get\n
1583
  */
1584
  *         DR           DT            LL_RTC_DATE_Get\n
1584
__STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
1585
  *         DR           DU            LL_RTC_DATE_Get\n
1585
{
1586
  *         DR           YT            LL_RTC_DATE_Get\n
1586
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
1587
  *         DR           YU            LL_RTC_DATE_Get
1587
}
1588
  * @param  RTCx RTC Instance
1588
 
1589
  * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
1589
/**
1590
  */
1590
  * @brief  Specify the Alarm A masks.
1591
__STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
1591
  * @rmtoll ALRMAR       MSK4          LL_RTC_ALMA_SetMask\n
1592
{
1592
  *         ALRMAR       MSK3          LL_RTC_ALMA_SetMask\n
1593
  uint32_t temp;
1593
  *         ALRMAR       MSK2          LL_RTC_ALMA_SetMask\n
1594
 
1594
  *         ALRMAR       MSK1          LL_RTC_ALMA_SetMask
1595
  temp = READ_BIT(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU));
1595
  * @param  RTCx RTC Instance
1596
  return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
1596
  * @param  Mask This parameter can be a combination of the following values:
1597
                    (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \
1597
  *         @arg @ref LL_RTC_ALMA_MASK_NONE
1598
                    (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \
1598
  *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1599
                    ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)));
1599
  *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1600
}
1600
  *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
1601
 
1601
  *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
1602
/**
1602
  *         @arg @ref LL_RTC_ALMA_MASK_ALL
1603
  * @}
1603
  * @retval None
1604
  */
1604
  */
1605
 
1605
__STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1606
/** @defgroup RTC_LL_EF_ALARMA ALARMA
1606
{
1607
  * @{
1607
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
1608
  */
1608
}
1609
 
1609
 
1610
/**
1610
/**
1611
  * @brief  Enable Alarm A
1611
  * @brief  Get the Alarm A masks.
1612
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1612
  * @rmtoll ALRMAR       MSK4          LL_RTC_ALMA_GetMask\n
1613
  * @rmtoll CR           ALRAE         LL_RTC_ALMA_Enable
1613
  *         ALRMAR       MSK3          LL_RTC_ALMA_GetMask\n
1614
  * @param  RTCx RTC Instance
1614
  *         ALRMAR       MSK2          LL_RTC_ALMA_GetMask\n
1615
  * @retval None
1615
  *         ALRMAR       MSK1          LL_RTC_ALMA_GetMask
1616
  */
1616
  * @param  RTCx RTC Instance
1617
__STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
1617
  * @retval Returned value can be can be a combination of the following values:
1618
{
1618
  *         @arg @ref LL_RTC_ALMA_MASK_NONE
1619
  SET_BIT(RTCx->CR, RTC_CR_ALRAE);
1619
  *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1620
}
1620
  *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1621
 
1621
  *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
1622
/**
1622
  *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
1623
  * @brief  Disable Alarm A
1623
  *         @arg @ref LL_RTC_ALMA_MASK_ALL
1624
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1624
  */
1625
  * @rmtoll CR           ALRAE         LL_RTC_ALMA_Disable
1625
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
1626
  * @param  RTCx RTC Instance
1626
{
1627
  * @retval None
1627
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
1628
  */
1628
}
1629
__STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
1629
 
1630
{
1630
/**
1631
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
1631
  * @brief  Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
1632
}
1632
  * @rmtoll ALRMAR       WDSEL         LL_RTC_ALMA_EnableWeekday
1633
 
1633
  * @param  RTCx RTC Instance
1634
/**
1634
  * @retval None
1635
  * @brief  Specify the Alarm A masks.
1635
  */
1636
  * @rmtoll ALRMAR       MSK4          LL_RTC_ALMA_SetMask\n
1636
__STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
1637
  *         ALRMAR       MSK3          LL_RTC_ALMA_SetMask\n
1637
{
1638
  *         ALRMAR       MSK2          LL_RTC_ALMA_SetMask\n
1638
  SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1639
  *         ALRMAR       MSK1          LL_RTC_ALMA_SetMask
1639
}
1640
  * @param  RTCx RTC Instance
1640
 
1641
  * @param  Mask This parameter can be a combination of the following values:
1641
/**
1642
  *         @arg @ref LL_RTC_ALMA_MASK_NONE
1642
  * @brief  Disable AlarmA Week day selection (DU[3:0] represents the date )
1643
  *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1643
  * @rmtoll ALRMAR       WDSEL         LL_RTC_ALMA_DisableWeekday
1644
  *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1644
  * @param  RTCx RTC Instance
1645
  *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
1645
  * @retval None
1646
  *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
1646
  */
1647
  *         @arg @ref LL_RTC_ALMA_MASK_ALL
1647
__STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
1648
  * @retval None
1648
{
1649
  */
1649
  CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1650
__STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1650
}
1651
{
1651
 
1652
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
1652
/**
1653
}
1653
  * @brief  Set ALARM A Day in BCD format
1654
 
1654
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1655
/**
1655
  * @rmtoll ALRMAR       DT            LL_RTC_ALMA_SetDay\n
1656
  * @brief  Get the Alarm A masks.
1656
  *         ALRMAR       DU            LL_RTC_ALMA_SetDay
1657
  * @rmtoll ALRMAR       MSK4          LL_RTC_ALMA_GetMask\n
1657
  * @param  RTCx RTC Instance
1658
  *         ALRMAR       MSK3          LL_RTC_ALMA_GetMask\n
1658
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1659
  *         ALRMAR       MSK2          LL_RTC_ALMA_GetMask\n
1659
  * @retval None
1660
  *         ALRMAR       MSK1          LL_RTC_ALMA_GetMask
1660
  */
1661
  * @param  RTCx RTC Instance
1661
__STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1662
  * @retval Returned value can be can be a combination of the following values:
1662
{
1663
  *         @arg @ref LL_RTC_ALMA_MASK_NONE
1663
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
1664
  *         @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
1664
             (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
1665
  *         @arg @ref LL_RTC_ALMA_MASK_HOURS
1665
}
1666
  *         @arg @ref LL_RTC_ALMA_MASK_MINUTES
1666
 
1667
  *         @arg @ref LL_RTC_ALMA_MASK_SECONDS
1667
/**
1668
  *         @arg @ref LL_RTC_ALMA_MASK_ALL
1668
  * @brief  Get ALARM A Day in BCD format
1669
  */
1669
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1670
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
1670
  * @rmtoll ALRMAR       DT            LL_RTC_ALMA_GetDay\n
1671
{
1671
  *         ALRMAR       DU            LL_RTC_ALMA_GetDay
1672
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
1672
  * @param  RTCx RTC Instance
1673
}
1673
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
1674
 
1674
  */
1675
/**
1675
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
1676
  * @brief  Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
1676
{
1677
  * @rmtoll ALRMAR       WDSEL         LL_RTC_ALMA_EnableWeekday
1677
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
1678
  * @param  RTCx RTC Instance
1678
}
1679
  * @retval None
1679
 
1680
  */
1680
/**
1681
__STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
1681
  * @brief  Set ALARM A Weekday
1682
{
1682
  * @rmtoll ALRMAR       DU            LL_RTC_ALMA_SetWeekDay
1683
  SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1683
  * @param  RTCx RTC Instance
1684
}
1684
  * @param  WeekDay This parameter can be one of the following values:
1685
 
1685
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1686
/**
1686
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1687
  * @brief  Disable AlarmA Week day selection (DU[3:0] represents the date )
1687
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1688
  * @rmtoll ALRMAR       WDSEL         LL_RTC_ALMA_DisableWeekday
1688
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1689
  * @param  RTCx RTC Instance
1689
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1690
  * @retval None
1690
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1691
  */
1691
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1692
__STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
1692
  * @retval None
1693
{
1693
  */
1694
  CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
1694
__STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1695
}
1695
{
1696
 
1696
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
1697
/**
1697
}
1698
  * @brief  Set ALARM A Day in BCD format
1698
 
1699
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
1699
/**
1700
  * @rmtoll ALRMAR       DT            LL_RTC_ALMA_SetDay\n
1700
  * @brief  Get ALARM A Weekday
1701
  *         ALRMAR       DU            LL_RTC_ALMA_SetDay
1701
  * @rmtoll ALRMAR       DU            LL_RTC_ALMA_GetWeekDay
1702
  * @param  RTCx RTC Instance
1702
  * @param  RTCx RTC Instance
1703
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
1703
  * @retval Returned value can be one of the following values:
1704
  * @retval None
1704
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1705
  */
1705
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1706
__STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
1706
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1707
{
1707
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1708
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
1708
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1709
             (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
1709
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1710
}
1710
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1711
 
1711
  */
1712
/**
1712
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
1713
  * @brief  Get ALARM A Day in BCD format
1713
{
1714
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
1714
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
1715
  * @rmtoll ALRMAR       DT            LL_RTC_ALMA_GetDay\n
1715
}
1716
  *         ALRMAR       DU            LL_RTC_ALMA_GetDay
1716
 
1717
  * @param  RTCx RTC Instance
1717
/**
1718
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
1718
  * @brief  Set Alarm A time format (AM/24-hour or PM notation)
1719
  */
1719
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_SetTimeFormat
1720
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
1720
  * @param  RTCx RTC Instance
1721
{
1721
  * @param  TimeFormat This parameter can be one of the following values:
1722
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
1722
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1723
}
1723
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1724
 
1724
  * @retval None
1725
/**
1725
  */
1726
  * @brief  Set ALARM A Weekday
1726
__STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1727
  * @rmtoll ALRMAR       DU            LL_RTC_ALMA_SetWeekDay
1727
{
1728
  * @param  RTCx RTC Instance
1728
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
1729
  * @param  WeekDay This parameter can be one of the following values:
1729
}
1730
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1730
 
1731
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1731
/**
1732
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1732
  * @brief  Get Alarm A time format (AM or PM notation)
1733
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1733
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_GetTimeFormat
1734
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1734
  * @param  RTCx RTC Instance
1735
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1735
  * @retval Returned value can be one of the following values:
1736
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1736
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1737
  * @retval None
1737
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1738
  */
1738
  */
1739
__STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
1739
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
1740
{
1740
{
1741
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
1741
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
1742
}
1742
}
1743
 
1743
 
1744
/**
1744
/**
1745
  * @brief  Get ALARM A Weekday
1745
  * @brief  Set ALARM A Hours in BCD format
1746
  * @rmtoll ALRMAR       DU            LL_RTC_ALMA_GetWeekDay
1746
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
1747
  * @param  RTCx RTC Instance
1747
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_SetHour\n
1748
  * @retval Returned value can be one of the following values:
1748
  *         ALRMAR       HU            LL_RTC_ALMA_SetHour
1749
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
1749
  * @param  RTCx RTC Instance
1750
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
1750
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1751
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
1751
  * @retval None
1752
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
1752
  */
1753
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
1753
__STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1754
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
1754
{
1755
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
1755
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
1756
  */
1756
             (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
1757
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
1757
}
1758
{
1758
 
1759
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
1759
/**
1760
}
1760
  * @brief  Get ALARM A Hours in BCD format
1761
 
1761
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
1762
/**
1762
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_GetHour\n
1763
  * @brief  Set Alarm A time format (AM/24-hour or PM notation)
1763
  *         ALRMAR       HU            LL_RTC_ALMA_GetHour
1764
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_SetTimeFormat
1764
  * @param  RTCx RTC Instance
1765
  * @param  RTCx RTC Instance
1765
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1766
  * @param  TimeFormat This parameter can be one of the following values:
1766
  */
1767
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1767
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
1768
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1768
{
1769
  * @retval None
1769
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
1770
  */
1770
}
1771
__STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
1771
 
1772
{
1772
/**
1773
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
1773
  * @brief  Set ALARM A Minutes in BCD format
1774
}
1774
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1775
 
1775
  * @rmtoll ALRMAR       MNT           LL_RTC_ALMA_SetMinute\n
1776
/**
1776
  *         ALRMAR       MNU           LL_RTC_ALMA_SetMinute
1777
  * @brief  Get Alarm A time format (AM or PM notation)
1777
  * @param  RTCx RTC Instance
1778
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_GetTimeFormat
1778
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1779
  * @param  RTCx RTC Instance
1779
  * @retval None
1780
  * @retval Returned value can be one of the following values:
1780
  */
1781
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1781
__STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1782
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1782
{
1783
  */
1783
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
1784
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
1784
             (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
1785
{
1785
}
1786
  return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
1786
 
1787
}
1787
/**
1788
 
1788
  * @brief  Get ALARM A Minutes in BCD format
1789
/**
1789
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
1790
  * @brief  Set ALARM A Hours in BCD format
1790
  * @rmtoll ALRMAR       MNT           LL_RTC_ALMA_GetMinute\n
1791
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
1791
  *         ALRMAR       MNU           LL_RTC_ALMA_GetMinute
1792
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_SetHour\n
1792
  * @param  RTCx RTC Instance
1793
  *         ALRMAR       HU            LL_RTC_ALMA_SetHour
1793
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1794
  * @param  RTCx RTC Instance
1794
  */
1795
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1795
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
1796
  * @retval None
1796
{
1797
  */
1797
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
1798
__STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
1798
}
1799
{
1799
 
1800
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
1800
/**
1801
             (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
1801
  * @brief  Set ALARM A Seconds in BCD format
1802
}
1802
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1803
 
1803
  * @rmtoll ALRMAR       ST            LL_RTC_ALMA_SetSecond\n
1804
/**
1804
  *         ALRMAR       SU            LL_RTC_ALMA_SetSecond
1805
  * @brief  Get ALARM A Hours in BCD format
1805
  * @param  RTCx RTC Instance
1806
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
1806
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1807
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_GetHour\n
1807
  * @retval None
1808
  *         ALRMAR       HU            LL_RTC_ALMA_GetHour
1808
  */
1809
  * @param  RTCx RTC Instance
1809
__STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1810
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1810
{
1811
  */
1811
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
1812
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
1812
             (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
1813
{
1813
}
1814
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
1814
 
1815
}
1815
/**
1816
 
1816
  * @brief  Get ALARM A Seconds in BCD format
1817
/**
1817
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
1818
  * @brief  Set ALARM A Minutes in BCD format
1818
  * @rmtoll ALRMAR       ST            LL_RTC_ALMA_GetSecond\n
1819
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
1819
  *         ALRMAR       SU            LL_RTC_ALMA_GetSecond
1820
  * @rmtoll ALRMAR       MNT           LL_RTC_ALMA_SetMinute\n
1820
  * @param  RTCx RTC Instance
1821
  *         ALRMAR       MNU           LL_RTC_ALMA_SetMinute
1821
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1822
  * @param  RTCx RTC Instance
1822
  */
1823
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1823
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
1824
  * @retval None
1824
{
1825
  */
1825
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
1826
__STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
1826
}
1827
{
1827
 
1828
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
1828
/**
1829
             (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
1829
  * @brief  Set Alarm A Time (hour, minute and second) in BCD format
1830
}
1830
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_ConfigTime\n
1831
 
1831
  *         ALRMAR       HT            LL_RTC_ALMA_ConfigTime\n
1832
/**
1832
  *         ALRMAR       HU            LL_RTC_ALMA_ConfigTime\n
1833
  * @brief  Get ALARM A Minutes in BCD format
1833
  *         ALRMAR       MNT           LL_RTC_ALMA_ConfigTime\n
1834
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
1834
  *         ALRMAR       MNU           LL_RTC_ALMA_ConfigTime\n
1835
  * @rmtoll ALRMAR       MNT           LL_RTC_ALMA_GetMinute\n
1835
  *         ALRMAR       ST            LL_RTC_ALMA_ConfigTime\n
1836
  *         ALRMAR       MNU           LL_RTC_ALMA_GetMinute
1836
  *         ALRMAR       SU            LL_RTC_ALMA_ConfigTime
1837
  * @param  RTCx RTC Instance
1837
  * @param  RTCx RTC Instance
1838
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1838
  * @param  Format12_24 This parameter can be one of the following values:
1839
  */
1839
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1840
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
1840
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1841
{
1841
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1842
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
1842
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1843
}
1843
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1844
 
1844
  * @retval None
1845
/**
1845
  */
1846
  * @brief  Set ALARM A Seconds in BCD format
1846
__STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1847
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
1847
{
1848
  * @rmtoll ALRMAR       ST            LL_RTC_ALMA_SetSecond\n
1848
  uint32_t temp;
1849
  *         ALRMAR       SU            LL_RTC_ALMA_SetSecond
1849
 
1850
  * @param  RTCx RTC Instance
1850
  temp = Format12_24                                                                                    | \
1851
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1851
         (((Hours   & 0xF0U) << (RTC_ALRMAR_HT_Pos  - 4U)) | ((Hours   & 0x0FU) << RTC_ALRMAR_HU_Pos))  | \
1852
  * @retval None
1852
         (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
1853
  */
1853
         (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos  - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
1854
__STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
1854
 
1855
{
1855
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
1856
  MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
1856
}
1857
             (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
1857
 
1858
}
1858
/**
1859
 
1859
  * @brief  Get Alarm B Time (hour, minute and second) in BCD format
1860
/**
1860
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1861
  * @brief  Get ALARM A Seconds in BCD format
1861
  * are available to get independently each parameter.
1862
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
1862
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_GetTime\n
1863
  * @rmtoll ALRMAR       ST            LL_RTC_ALMA_GetSecond\n
1863
  *         ALRMAR       HU            LL_RTC_ALMA_GetTime\n
1864
  *         ALRMAR       SU            LL_RTC_ALMA_GetSecond
1864
  *         ALRMAR       MNT           LL_RTC_ALMA_GetTime\n
1865
  * @param  RTCx RTC Instance
1865
  *         ALRMAR       MNU           LL_RTC_ALMA_GetTime\n
1866
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
1866
  *         ALRMAR       ST            LL_RTC_ALMA_GetTime\n
1867
  */
1867
  *         ALRMAR       SU            LL_RTC_ALMA_GetTime
1868
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
1868
  * @param  RTCx RTC Instance
1869
{
1869
  * @retval Combination of hours, minutes and seconds.
1870
  return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
1870
  */
1871
}
1871
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
1872
 
1872
{
1873
/**
1873
  return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
1874
  * @brief  Set Alarm A Time (hour, minute and second) in BCD format
1874
}
1875
  * @rmtoll ALRMAR       PM            LL_RTC_ALMA_ConfigTime\n
1875
 
1876
  *         ALRMAR       HT            LL_RTC_ALMA_ConfigTime\n
1876
#if defined(RTC_SUBSECOND_SUPPORT)
1877
  *         ALRMAR       HU            LL_RTC_ALMA_ConfigTime\n
1877
/**
1878
  *         ALRMAR       MNT           LL_RTC_ALMA_ConfigTime\n
1878
  * @brief  Mask the most-significant bits of the subseconds field starting from
1879
  *         ALRMAR       MNU           LL_RTC_ALMA_ConfigTime\n
1879
  *         the bit specified in parameter Mask
1880
  *         ALRMAR       ST            LL_RTC_ALMA_ConfigTime\n
1880
  * @note This register can be written only when ALRAE is reset in RTC_CR register,
1881
  *         ALRMAR       SU            LL_RTC_ALMA_ConfigTime
1881
  *       or in initialization mode.
1882
  * @param  RTCx RTC Instance
1882
  * @rmtoll ALRMASSR     MASKSS        LL_RTC_ALMA_SetSubSecondMask
1883
  * @param  Format12_24 This parameter can be one of the following values:
1883
  * @param  RTCx RTC Instance
1884
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
1884
  * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
1885
  *         @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
1885
  * @retval None
1886
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
1886
  */
1887
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
1887
__STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
1888
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
1888
{
1889
  * @retval None
1889
  MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
1890
  */
1890
}
1891
__STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
1891
 
1892
{
1892
/**
1893
  uint32_t temp;
1893
  * @brief  Get Alarm A subseconds mask
1894
 
1894
  * @rmtoll ALRMASSR     MASKSS        LL_RTC_ALMA_GetSubSecondMask
1895
  temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos))    | \
1895
  * @param  RTCx RTC Instance
1896
         (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
1896
  * @retval Value between Min_Data=0x00 and Max_Data=0xF
1897
         (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
1897
  */
1898
 
1898
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
1899
  MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST | RTC_ALRMAR_SU, temp);
1899
{
1900
}
1900
  return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
1901
 
1901
}
1902
/**
1902
 
1903
  * @brief  Get Alarm B Time (hour, minute and second) in BCD format
1903
/**
1904
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
1904
  * @brief  Set Alarm A subseconds value
1905
  * are available to get independently each parameter.
1905
  * @rmtoll ALRMASSR     SS            LL_RTC_ALMA_SetSubSecond
1906
  * @rmtoll ALRMAR       HT            LL_RTC_ALMA_GetTime\n
1906
  * @param  RTCx RTC Instance
1907
  *         ALRMAR       HU            LL_RTC_ALMA_GetTime\n
1907
  * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
1908
  *         ALRMAR       MNT           LL_RTC_ALMA_GetTime\n
1908
  * @retval None
1909
  *         ALRMAR       MNU           LL_RTC_ALMA_GetTime\n
1909
  */
1910
  *         ALRMAR       ST            LL_RTC_ALMA_GetTime\n
1910
__STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
1911
  *         ALRMAR       SU            LL_RTC_ALMA_GetTime
1911
{
1912
  * @param  RTCx RTC Instance
1912
  MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
1913
  * @retval Combination of hours, minutes and seconds.
1913
}
1914
  */
1914
 
1915
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
1915
/**
1916
{
1916
  * @brief  Get Alarm A subseconds value
1917
  return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
1917
  * @rmtoll ALRMASSR     SS            LL_RTC_ALMA_GetSubSecond
1918
}
1918
  * @param  RTCx RTC Instance
1919
 
1919
  * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
1920
#if defined(RTC_SUBSECOND_SUPPORT)
1920
  */
1921
/**
1921
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
1922
  * @brief  Set Alarm A Mask the most-significant bits starting at this bit
1922
{
1923
  * @note This register can be written only when ALRAE is reset in RTC_CR register,
1923
  return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
1924
  *       or in initialization mode.
1924
}
1925
  * @rmtoll ALRMASSR     MASKSS        LL_RTC_ALMA_SetSubSecondMask
1925
#endif /* RTC_SUBSECOND_SUPPORT */
1926
  * @param  RTCx RTC Instance
1926
 
1927
  * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
1927
/**
1928
  * @retval None
1928
  * @}
1929
  */
1929
  */
1930
__STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
1930
 
1931
{
1931
/** @defgroup RTC_LL_EF_ALARMB ALARMB
1932
  MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
1932
  * @{
1933
}
1933
  */
1934
 
1934
 
1935
/**
1935
/**
1936
  * @brief  Get Alarm A Mask the most-significant bits starting at this bit
1936
  * @brief  Enable Alarm B
1937
  * @rmtoll ALRMASSR     MASKSS        LL_RTC_ALMA_GetSubSecondMask
1937
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1938
  * @param  RTCx RTC Instance
1938
  * @rmtoll CR           ALRBE         LL_RTC_ALMB_Enable
1939
  * @retval Value between Min_Data=0x00 and Max_Data=0xF
1939
  * @param  RTCx RTC Instance
1940
  */
1940
  * @retval None
1941
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
1941
  */
1942
{
1942
__STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
1943
  return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
1943
{
1944
}
1944
  SET_BIT(RTCx->CR, RTC_CR_ALRBE);
1945
 
1945
}
1946
/**
1946
 
1947
  * @brief  Set Alarm A Sub seconds value
1947
/**
1948
  * @rmtoll ALRMASSR     SS            LL_RTC_ALMA_SetSubSecond
1948
  * @brief  Disable Alarm B
1949
  * @param  RTCx RTC Instance
1949
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1950
  * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
1950
  * @rmtoll CR           ALRBE         LL_RTC_ALMB_Disable
1951
  * @retval None
1951
  * @param  RTCx RTC Instance
1952
  */
1952
  * @retval None
1953
__STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
1953
  */
1954
{
1954
__STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
1955
  MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
1955
{
1956
}
1956
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
1957
 
1957
}
1958
/**
1958
 
1959
  * @brief  Get Alarm A Sub seconds value
1959
/**
1960
  * @rmtoll ALRMASSR     SS            LL_RTC_ALMA_GetSubSecond
1960
  * @brief  Specify the Alarm B masks.
1961
  * @param  RTCx RTC Instance
1961
  * @rmtoll ALRMBR       MSK4          LL_RTC_ALMB_SetMask\n
1962
  * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
1962
  *         ALRMBR       MSK3          LL_RTC_ALMB_SetMask\n
1963
  */
1963
  *         ALRMBR       MSK2          LL_RTC_ALMB_SetMask\n
1964
__STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
1964
  *         ALRMBR       MSK1          LL_RTC_ALMB_SetMask
1965
{
1965
  * @param  RTCx RTC Instance
1966
  return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
1966
  * @param  Mask This parameter can be a combination of the following values:
1967
}
1967
  *         @arg @ref LL_RTC_ALMB_MASK_NONE
1968
#endif /* RTC_SUBSECOND_SUPPORT */
1968
  *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
1969
 
1969
  *         @arg @ref LL_RTC_ALMB_MASK_HOURS
1970
/**
1970
  *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
1971
  * @}
1971
  *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
1972
  */
1972
  *         @arg @ref LL_RTC_ALMB_MASK_ALL
1973
 
1973
  * @retval None
1974
/** @defgroup RTC_LL_EF_ALARMB ALARMB
1974
  */
1975
  * @{
1975
__STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
1976
  */
1976
{
1977
 
1977
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
1978
/**
1978
}
1979
  * @brief  Enable Alarm B
1979
 
1980
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1980
/**
1981
  * @rmtoll CR           ALRBE         LL_RTC_ALMB_Enable
1981
  * @brief  Get the Alarm B masks.
1982
  * @param  RTCx RTC Instance
1982
  * @rmtoll ALRMBR       MSK4          LL_RTC_ALMB_GetMask\n
1983
  * @retval None
1983
  *         ALRMBR       MSK3          LL_RTC_ALMB_GetMask\n
1984
  */
1984
  *         ALRMBR       MSK2          LL_RTC_ALMB_GetMask\n
1985
__STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
1985
  *         ALRMBR       MSK1          LL_RTC_ALMB_GetMask
1986
{
1986
  * @param  RTCx RTC Instance
1987
  SET_BIT(RTCx->CR, RTC_CR_ALRBE);
1987
  * @retval Returned value can be can be a combination of the following values:
1988
}
1988
  *         @arg @ref LL_RTC_ALMB_MASK_NONE
1989
 
1989
  *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
1990
/**
1990
  *         @arg @ref LL_RTC_ALMB_MASK_HOURS
1991
  * @brief  Disable Alarm B
1991
  *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
1992
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
1992
  *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
1993
  * @rmtoll CR           ALRBE         LL_RTC_ALMB_Disable
1993
  *         @arg @ref LL_RTC_ALMB_MASK_ALL
1994
  * @param  RTCx RTC Instance
1994
  */
1995
  * @retval None
1995
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
1996
  */
1996
{
1997
__STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
1997
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
1998
{
1998
}
1999
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
1999
 
2000
}
2000
/**
2001
 
2001
  * @brief  Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2002
/**
2002
  * @rmtoll ALRMBR       WDSEL         LL_RTC_ALMB_EnableWeekday
2003
  * @brief  Specify the Alarm B masks.
2003
  * @param  RTCx RTC Instance
2004
  * @rmtoll ALRMBR       MSK4          LL_RTC_ALMB_SetMask\n
2004
  * @retval None
2005
  *         ALRMBR       MSK3          LL_RTC_ALMB_SetMask\n
2005
  */
2006
  *         ALRMBR       MSK2          LL_RTC_ALMB_SetMask\n
2006
__STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2007
  *         ALRMBR       MSK1          LL_RTC_ALMB_SetMask
2007
{
2008
  * @param  RTCx RTC Instance
2008
  SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2009
  * @param  Mask This parameter can be a combination of the following values:
2009
}
2010
  *         @arg @ref LL_RTC_ALMB_MASK_NONE
2010
 
2011
  *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2011
/**
2012
  *         @arg @ref LL_RTC_ALMB_MASK_HOURS
2012
  * @brief  Disable AlarmB Week day selection (DU[3:0] represents the date )
2013
  *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
2013
  * @rmtoll ALRMBR       WDSEL         LL_RTC_ALMB_DisableWeekday
2014
  *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
2014
  * @param  RTCx RTC Instance
2015
  *         @arg @ref LL_RTC_ALMB_MASK_ALL
2015
  * @retval None
2016
  * @retval None
2016
  */
2017
  */
2017
__STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2018
__STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
2018
{
2019
{
2019
  CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2020
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
2020
}
2021
}
2021
 
2022
 
2022
/**
2023
/**
2023
  * @brief  Set ALARM B Day in BCD format
2024
  * @brief  Get the Alarm B masks.
2024
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2025
  * @rmtoll ALRMBR       MSK4          LL_RTC_ALMB_GetMask\n
2025
  * @rmtoll ALRMBR       DT            LL_RTC_ALMB_SetDay\n
2026
  *         ALRMBR       MSK3          LL_RTC_ALMB_GetMask\n
2026
  *         ALRMBR       DU            LL_RTC_ALMB_SetDay
2027
  *         ALRMBR       MSK2          LL_RTC_ALMB_GetMask\n
2027
  * @param  RTCx RTC Instance
2028
  *         ALRMBR       MSK1          LL_RTC_ALMB_GetMask
2028
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
2029
  * @param  RTCx RTC Instance
2029
  * @retval None
2030
  * @retval Returned value can be can be a combination of the following values:
2030
  */
2031
  *         @arg @ref LL_RTC_ALMB_MASK_NONE
2031
__STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2032
  *         @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
2032
{
2033
  *         @arg @ref LL_RTC_ALMB_MASK_HOURS
2033
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2034
  *         @arg @ref LL_RTC_ALMB_MASK_MINUTES
2034
             (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2035
  *         @arg @ref LL_RTC_ALMB_MASK_SECONDS
2035
}
2036
  *         @arg @ref LL_RTC_ALMB_MASK_ALL
2036
 
2037
  */
2037
/**
2038
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
2038
  * @brief  Get ALARM B Day in BCD format
2039
{
2039
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2040
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
2040
  * @rmtoll ALRMBR       DT            LL_RTC_ALMB_GetDay\n
2041
}
2041
  *         ALRMBR       DU            LL_RTC_ALMB_GetDay
2042
 
2042
  * @param  RTCx RTC Instance
2043
/**
2043
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
2044
  * @brief  Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
2044
  */
2045
  * @rmtoll ALRMBR       WDSEL         LL_RTC_ALMB_EnableWeekday
2045
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
2046
  * @param  RTCx RTC Instance
2046
{
2047
  * @retval None
2047
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
2048
  */
2048
}
2049
__STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
2049
 
2050
{
2050
/**
2051
  SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2051
  * @brief  Set ALARM B Weekday
2052
}
2052
  * @rmtoll ALRMBR       DU            LL_RTC_ALMB_SetWeekDay
2053
 
2053
  * @param  RTCx RTC Instance
2054
/**
2054
  * @param  WeekDay This parameter can be one of the following values:
2055
  * @brief  Disable AlarmB Week day selection (DU[3:0] represents the date )
2055
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2056
  * @rmtoll ALRMBR       WDSEL         LL_RTC_ALMB_DisableWeekday
2056
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2057
  * @param  RTCx RTC Instance
2057
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2058
  * @retval None
2058
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2059
  */
2059
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2060
__STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
2060
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2061
{
2061
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2062
  CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
2062
  * @retval None
2063
}
2063
  */
2064
 
2064
__STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2065
/**
2065
{
2066
  * @brief  Set ALARM B Day in BCD format
2066
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2067
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
2067
}
2068
  * @rmtoll ALRMBR       DT            LL_RTC_ALMB_SetDay\n
2068
 
2069
  *         ALRMBR       DU            LL_RTC_ALMB_SetDay
2069
/**
2070
  * @param  RTCx RTC Instance
2070
  * @brief  Get ALARM B Weekday
2071
  * @param  Day Value between Min_Data=0x01 and Max_Data=0x31
2071
  * @rmtoll ALRMBR       DU            LL_RTC_ALMB_GetWeekDay
2072
  * @retval None
2072
  * @param  RTCx RTC Instance
2073
  */
2073
  * @retval Returned value can be one of the following values:
2074
__STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
2074
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2075
{
2075
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2076
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
2076
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2077
             (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
2077
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2078
}
2078
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2079
 
2079
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2080
/**
2080
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2081
  * @brief  Get ALARM B Day in BCD format
2081
  */
2082
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2082
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
2083
  * @rmtoll ALRMBR       DT            LL_RTC_ALMB_GetDay\n
2083
{
2084
  *         ALRMBR       DU            LL_RTC_ALMB_GetDay
2084
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2085
  * @param  RTCx RTC Instance
2085
}
2086
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
2086
 
2087
  */
2087
/**
2088
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
2088
  * @brief  Set ALARM B time format (AM/24-hour or PM notation)
2089
{
2089
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_SetTimeFormat
2090
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
2090
  * @param  RTCx RTC Instance
2091
}
2091
  * @param  TimeFormat This parameter can be one of the following values:
2092
 
2092
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2093
/**
2093
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2094
  * @brief  Set ALARM B Weekday
2094
  * @retval None
2095
  * @rmtoll ALRMBR       DU            LL_RTC_ALMB_SetWeekDay
2095
  */
2096
  * @param  RTCx RTC Instance
2096
__STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2097
  * @param  WeekDay This parameter can be one of the following values:
2097
{
2098
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2098
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2099
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2099
}
2100
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2100
 
2101
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2101
/**
2102
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2102
  * @brief  Get ALARM B time format (AM or PM notation)
2103
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2103
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_GetTimeFormat
2104
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2104
  * @param  RTCx RTC Instance
2105
  * @retval None
2105
  * @retval Returned value can be one of the following values:
2106
  */
2106
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2107
__STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
2107
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2108
{
2108
  */
2109
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
2109
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
2110
}
2110
{
2111
 
2111
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2112
/**
2112
}
2113
  * @brief  Get ALARM B Weekday
2113
 
2114
  * @rmtoll ALRMBR       DU            LL_RTC_ALMB_GetWeekDay
2114
/**
2115
  * @param  RTCx RTC Instance
2115
  * @brief  Set ALARM B Hours in BCD format
2116
  * @retval Returned value can be one of the following values:
2116
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2117
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2117
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_SetHour\n
2118
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2118
  *         ALRMBR       HU            LL_RTC_ALMB_SetHour
2119
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2119
  * @param  RTCx RTC Instance
2120
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2120
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2121
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2121
  * @retval None
2122
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2122
  */
2123
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2123
__STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2124
  */
2124
{
2125
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
2125
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2126
{
2126
             (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2127
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
2127
}
2128
}
2128
 
2129
 
2129
/**
2130
/**
2130
  * @brief  Get ALARM B Hours in BCD format
2131
  * @brief  Set ALARM B time format (AM/24-hour or PM notation)
2131
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2132
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_SetTimeFormat
2132
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_GetHour\n
2133
  * @param  RTCx RTC Instance
2133
  *         ALRMBR       HU            LL_RTC_ALMB_GetHour
2134
  * @param  TimeFormat This parameter can be one of the following values:
2134
  * @param  RTCx RTC Instance
2135
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2135
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2136
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2136
  */
2137
  * @retval None
2137
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
2138
  */
2138
{
2139
__STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
2139
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
2140
{
2140
}
2141
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
2141
 
2142
}
2142
/**
2143
 
2143
  * @brief  Set ALARM B Minutes in BCD format
2144
/**
2144
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2145
  * @brief  Get ALARM B time format (AM or PM notation)
2145
  * @rmtoll ALRMBR       MNT           LL_RTC_ALMB_SetMinute\n
2146
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_GetTimeFormat
2146
  *         ALRMBR       MNU           LL_RTC_ALMB_SetMinute
2147
  * @param  RTCx RTC Instance
2147
  * @param  RTCx RTC Instance
2148
  * @retval Returned value can be one of the following values:
2148
  * @param  Minutes between Min_Data=0x00 and Max_Data=0x59
2149
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2149
  * @retval None
2150
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2150
  */
2151
  */
2151
__STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2152
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
2152
{
2153
{
2153
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2154
  return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
2154
             (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2155
}
2155
}
2156
 
2156
 
2157
/**
2157
/**
2158
  * @brief  Set ALARM B Hours in BCD format
2158
  * @brief  Get ALARM B Minutes in BCD format
2159
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
2159
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2160
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_SetHour\n
2160
  * @rmtoll ALRMBR       MNT           LL_RTC_ALMB_GetMinute\n
2161
  *         ALRMBR       HU            LL_RTC_ALMB_SetHour
2161
  *         ALRMBR       MNU           LL_RTC_ALMB_GetMinute
2162
  * @param  RTCx RTC Instance
2162
  * @param  RTCx RTC Instance
2163
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2163
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2164
  * @retval None
2164
  */
2165
  */
2165
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
2166
__STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
2166
{
2167
{
2167
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
2168
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
2168
}
2169
             (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
2169
 
2170
}
2170
/**
2171
 
2171
  * @brief  Set ALARM B Seconds in BCD format
2172
/**
2172
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2173
  * @brief  Get ALARM B Hours in BCD format
2173
  * @rmtoll ALRMBR       ST            LL_RTC_ALMB_SetSecond\n
2174
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2174
  *         ALRMBR       SU            LL_RTC_ALMB_SetSecond
2175
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_GetHour\n
2175
  * @param  RTCx RTC Instance
2176
  *         ALRMBR       HU            LL_RTC_ALMB_GetHour
2176
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2177
  * @param  RTCx RTC Instance
2177
  * @retval None
2178
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2178
  */
2179
  */
2179
__STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2180
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
2180
{
2181
{
2181
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2182
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
2182
             (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2183
}
2183
}
2184
 
2184
 
2185
/**
2185
/**
2186
  * @brief  Set ALARM B Minutes in BCD format
2186
  * @brief  Get ALARM B Seconds in BCD format
2187
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
2187
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2188
  * @rmtoll ALRMBR       MNT           LL_RTC_ALMB_SetMinute\n
2188
  * @rmtoll ALRMBR       ST            LL_RTC_ALMB_GetSecond\n
2189
  *         ALRMBR       MNU           LL_RTC_ALMB_SetMinute
2189
  *         ALRMBR       SU            LL_RTC_ALMB_GetSecond
2190
  * @param  RTCx RTC Instance
2190
  * @param  RTCx RTC Instance
2191
  * @param  Minutes between Min_Data=0x00 and Max_Data=0x59
2191
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2192
  * @retval None
2192
  */
2193
  */
2193
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
2194
__STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
2194
{
2195
{
2195
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
2196
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
2196
}
2197
             (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
2197
 
2198
}
2198
/**
2199
 
2199
  * @brief  Set Alarm B Time (hour, minute and second) in BCD format
2200
/**
2200
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_ConfigTime\n
2201
  * @brief  Get ALARM B Minutes in BCD format
2201
  *         ALRMBR       HT            LL_RTC_ALMB_ConfigTime\n
2202
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2202
  *         ALRMBR       HU            LL_RTC_ALMB_ConfigTime\n
2203
  * @rmtoll ALRMBR       MNT           LL_RTC_ALMB_GetMinute\n
2203
  *         ALRMBR       MNT           LL_RTC_ALMB_ConfigTime\n
2204
  *         ALRMBR       MNU           LL_RTC_ALMB_GetMinute
2204
  *         ALRMBR       MNU           LL_RTC_ALMB_ConfigTime\n
2205
  * @param  RTCx RTC Instance
2205
  *         ALRMBR       ST            LL_RTC_ALMB_ConfigTime\n
2206
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2206
  *         ALRMBR       SU            LL_RTC_ALMB_ConfigTime
2207
  */
2207
  * @param  RTCx RTC Instance
2208
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
2208
  * @param  Format12_24 This parameter can be one of the following values:
2209
{
2209
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2210
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
2210
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2211
}
2211
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2212
 
2212
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
2213
/**
2213
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2214
  * @brief  Set ALARM B Seconds in BCD format
2214
  * @retval None
2215
  * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
2215
  */
2216
  * @rmtoll ALRMBR       ST            LL_RTC_ALMB_SetSecond\n
2216
__STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2217
  *         ALRMBR       SU            LL_RTC_ALMB_SetSecond
2217
{
2218
  * @param  RTCx RTC Instance
2218
  uint32_t temp;
2219
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2219
 
2220
  * @retval None
2220
  temp = Format12_24                                                                                    | \
2221
  */
2221
         (((Hours   & 0xF0U) << (RTC_ALRMBR_HT_Pos  - 4U)) | ((Hours   & 0x0FU) << RTC_ALRMBR_HU_Pos))  | \
2222
__STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
2222
         (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2223
{
2223
         (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos  - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2224
  MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
2224
 
2225
             (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
2225
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
2226
}
2226
}
2227
 
2227
 
2228
/**
2228
/**
2229
  * @brief  Get ALARM B Seconds in BCD format
2229
  * @brief  Get Alarm B Time (hour, minute and second) in BCD format
2230
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2230
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2231
  * @rmtoll ALRMBR       ST            LL_RTC_ALMB_GetSecond\n
2231
  * are available to get independently each parameter.
2232
  *         ALRMBR       SU            LL_RTC_ALMB_GetSecond
2232
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_GetTime\n
2233
  * @param  RTCx RTC Instance
2233
  *         ALRMBR       HU            LL_RTC_ALMB_GetTime\n
2234
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2234
  *         ALRMBR       MNT           LL_RTC_ALMB_GetTime\n
2235
  */
2235
  *         ALRMBR       MNU           LL_RTC_ALMB_GetTime\n
2236
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
2236
  *         ALRMBR       ST            LL_RTC_ALMB_GetTime\n
2237
{
2237
  *         ALRMBR       SU            LL_RTC_ALMB_GetTime
2238
  return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
2238
  * @param  RTCx RTC Instance
2239
}
2239
  * @retval Combination of hours, minutes and seconds.
2240
 
2240
  */
2241
/**
2241
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
2242
  * @brief  Set Alarm B Time (hour, minute and second) in BCD format
2242
{
2243
  * @rmtoll ALRMBR       PM            LL_RTC_ALMB_ConfigTime\n
2243
  return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2244
  *         ALRMBR       HT            LL_RTC_ALMB_ConfigTime\n
2244
}
2245
  *         ALRMBR       HU            LL_RTC_ALMB_ConfigTime\n
2245
 
2246
  *         ALRMBR       MNT           LL_RTC_ALMB_ConfigTime\n
2246
#if defined(RTC_SUBSECOND_SUPPORT)
2247
  *         ALRMBR       MNU           LL_RTC_ALMB_ConfigTime\n
2247
/**
2248
  *         ALRMBR       ST            LL_RTC_ALMB_ConfigTime\n
2248
  * @brief  Mask the most-significant bits of the subseconds field starting from
2249
  *         ALRMBR       SU            LL_RTC_ALMB_ConfigTime
2249
  *         the bit specified in parameter Mask
2250
  * @param  RTCx RTC Instance
2250
  * @note This register can be written only when ALRBE is reset in RTC_CR register,
2251
  * @param  Format12_24 This parameter can be one of the following values:
2251
  *       or in initialization mode.
2252
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
2252
  * @rmtoll ALRMBSSR     MASKSS        LL_RTC_ALMB_SetSubSecondMask
2253
  *         @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
2253
  * @param  RTCx RTC Instance
2254
  * @param  Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2254
  * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
2255
  * @param  Minutes Value between Min_Data=0x00 and Max_Data=0x59
2255
  * @retval None
2256
  * @param  Seconds Value between Min_Data=0x00 and Max_Data=0x59
2256
  */
2257
  * @retval None
2257
__STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2258
  */
2258
{
2259
__STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes, uint32_t Seconds)
2259
  MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2260
{
2260
}
2261
  uint32_t temp;
2261
 
2262
 
2262
/**
2263
  temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos))    | \
2263
  * @brief  Get Alarm B subseconds mask
2264
         (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
2264
  * @rmtoll ALRMBSSR     MASKSS        LL_RTC_ALMB_GetSubSecondMask
2265
         (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
2265
  * @param  RTCx RTC Instance
2266
 
2266
  * @retval Value between Min_Data=0x00 and Max_Data=0xF
2267
  MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST | RTC_ALRMBR_SU, temp);
2267
  */
2268
}
2268
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
2269
 
2269
{
2270
/**
2270
  return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS)  >> RTC_ALRMBSSR_MASKSS_Pos);
2271
  * @brief  Get Alarm B Time (hour, minute and second) in BCD format
2271
}
2272
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2272
 
2273
  * are available to get independently each parameter.
2273
/**
2274
  * @rmtoll ALRMBR       HT            LL_RTC_ALMB_GetTime\n
2274
  * @brief  Set Alarm B subseconds value
2275
  *         ALRMBR       HU            LL_RTC_ALMB_GetTime\n
2275
  * @rmtoll ALRMBSSR     SS            LL_RTC_ALMB_SetSubSecond
2276
  *         ALRMBR       MNT           LL_RTC_ALMB_GetTime\n
2276
  * @param  RTCx RTC Instance
2277
  *         ALRMBR       MNU           LL_RTC_ALMB_GetTime\n
2277
  * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2278
  *         ALRMBR       ST            LL_RTC_ALMB_GetTime\n
2278
  * @retval None
2279
  *         ALRMBR       SU            LL_RTC_ALMB_GetTime
2279
  */
2280
  * @param  RTCx RTC Instance
2280
__STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2281
  * @retval Combination of hours, minutes and seconds.
2281
{
2282
  */
2282
  MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2283
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
2283
}
2284
{
2284
 
2285
  return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
2285
/**
2286
}
2286
  * @brief  Get Alarm B subseconds value
2287
 
2287
  * @rmtoll ALRMBSSR     SS            LL_RTC_ALMB_GetSubSecond
2288
#if defined(RTC_SUBSECOND_SUPPORT)
2288
  * @param  RTCx RTC Instance
2289
/**
2289
  * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2290
  * @brief  Set Alarm B Mask the most-significant bits starting at this bit
2290
  */
2291
  * @note This register can be written only when ALRBE is reset in RTC_CR register,
2291
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
2292
  *       or in initialization mode.
2292
{
2293
  * @rmtoll ALRMBSSR     MASKSS        LL_RTC_ALMB_SetSubSecondMask
2293
  return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2294
  * @param  RTCx RTC Instance
2294
}
2295
  * @param  Mask Value between Min_Data=0x00 and Max_Data=0xF
2295
#endif /* RTC_SUBSECOND_SUPPORT */
2296
  * @retval None
2296
 
2297
  */
2297
/**
2298
__STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
2298
  * @}
2299
{
2299
  */
2300
  MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
2300
 
2301
}
2301
/** @defgroup RTC_LL_EF_Timestamp Timestamp
2302
 
2302
  * @{
2303
/**
2303
  */
2304
  * @brief  Get Alarm B Mask the most-significant bits starting at this bit
2304
 
2305
  * @rmtoll ALRMBSSR     MASKSS        LL_RTC_ALMB_GetSubSecondMask
2305
/**
2306
  * @param  RTCx RTC Instance
2306
  * @brief  Enable Timestamp
2307
  * @retval Value between Min_Data=0x00 and Max_Data=0xF
2307
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2308
  */
2308
  * @rmtoll CR           TSE           LL_RTC_TS_Enable
2309
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
2309
  * @param  RTCx RTC Instance
2310
{
2310
  * @retval None
2311
  return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS)  >> RTC_ALRMBSSR_MASKSS_Pos);
2311
  */
2312
}
2312
__STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2313
 
2313
{
2314
/**
2314
  SET_BIT(RTCx->CR, RTC_CR_TSE);
2315
  * @brief  Set Alarm B Sub seconds value
2315
}
2316
  * @rmtoll ALRMBSSR     SS            LL_RTC_ALMB_SetSubSecond
2316
 
2317
  * @param  RTCx RTC Instance
2317
/**
2318
  * @param  Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
2318
  * @brief  Disable Timestamp
2319
  * @retval None
2319
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2320
  */
2320
  * @rmtoll CR           TSE           LL_RTC_TS_Disable
2321
__STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
2321
  * @param  RTCx RTC Instance
2322
{
2322
  * @retval None
2323
  MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
2323
  */
2324
}
2324
__STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2325
 
2325
{
2326
/**
2326
  CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2327
  * @brief  Get Alarm B Sub seconds value
2327
}
2328
  * @rmtoll ALRMBSSR     SS            LL_RTC_ALMB_GetSubSecond
2328
 
2329
  * @param  RTCx RTC Instance
2329
/**
2330
  * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
2330
  * @brief  Set Time-stamp event active edge
2331
  */
2331
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2332
__STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
2332
  * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2333
{
2333
  * @rmtoll CR           TSEDGE        LL_RTC_TS_SetActiveEdge
2334
  return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
2334
  * @param  RTCx RTC Instance
2335
}
2335
  * @param  Edge This parameter can be one of the following values:
2336
#endif /* RTC_SUBSECOND_SUPPORT */
2336
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2337
 
2337
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2338
/**
2338
  * @retval None
2339
  * @}
2339
  */
2340
  */
2340
__STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2341
 
2341
{
2342
/** @defgroup RTC_LL_EF_Timestamp Timestamp
2342
  MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2343
  * @{
2343
}
2344
  */
2344
 
2345
 
2345
/**
2346
/**
2346
  * @brief  Get Time-stamp event active edge
2347
  * @brief  Enable Timestamp
2347
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2348
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2348
  * @rmtoll CR           TSEDGE        LL_RTC_TS_GetActiveEdge
2349
  * @rmtoll CR           TSE           LL_RTC_TS_Enable
2349
  * @param  RTCx RTC Instance
2350
  * @param  RTCx RTC Instance
2350
  * @retval Returned value can be one of the following values:
2351
  * @retval None
2351
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2352
  */
2352
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2353
__STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
2353
  */
2354
{
2354
__STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
2355
  SET_BIT(RTCx->CR, RTC_CR_TSE);
2355
{
2356
}
2356
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2357
 
2357
}
2358
/**
2358
 
2359
  * @brief  Disable Timestamp
2359
/**
2360
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2360
  * @brief  Get Timestamp AM/PM notation (AM or 24-hour format)
2361
  * @rmtoll CR           TSE           LL_RTC_TS_Disable
2361
  * @rmtoll TSTR         PM            LL_RTC_TS_GetTimeFormat
2362
  * @param  RTCx RTC Instance
2362
  * @param  RTCx RTC Instance
2363
  * @retval None
2363
  * @retval Returned value can be one of the following values:
2364
  */
2364
  *         @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2365
__STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
2365
  *         @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2366
{
2366
  */
2367
  CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
2367
__STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
2368
}
2368
{
2369
 
2369
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2370
/**
2370
}
2371
  * @brief  Set Time-stamp event active edge
2371
 
2372
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2372
/**
2373
  * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
2373
  * @brief  Get Timestamp Hours in BCD format
2374
  * @rmtoll CR           TSEDGE        LL_RTC_TS_SetActiveEdge
2374
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2375
  * @param  RTCx RTC Instance
2375
  * @rmtoll TSTR         HT            LL_RTC_TS_GetHour\n
2376
  * @param  Edge This parameter can be one of the following values:
2376
  *         TSTR         HU            LL_RTC_TS_GetHour
2377
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2377
  * @param  RTCx RTC Instance
2378
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2378
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2379
  * @retval None
2379
  */
2380
  */
2380
__STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
2381
__STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
2381
{
2382
{
2382
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2383
  MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
2383
}
2384
}
2384
 
2385
 
2385
/**
2386
/**
2386
  * @brief  Get Timestamp Minutes in BCD format
2387
  * @brief  Get Time-stamp event active edge
2387
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2388
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2388
  * @rmtoll TSTR         MNT           LL_RTC_TS_GetMinute\n
2389
  * @rmtoll CR           TSEDGE        LL_RTC_TS_GetActiveEdge
2389
  *         TSTR         MNU           LL_RTC_TS_GetMinute
2390
  * @param  RTCx RTC Instance
2390
  * @param  RTCx RTC Instance
2391
  * @retval Returned value can be one of the following values:
2391
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2392
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
2392
  */
2393
  *         @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
2393
__STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
2394
  */
2394
{
2395
__STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
2395
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2396
{
2396
}
2397
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
2397
 
2398
}
2398
/**
2399
 
2399
  * @brief  Get Timestamp Seconds in BCD format
2400
/**
2400
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2401
  * @brief  Get Timestamp AM/PM notation (AM or 24-hour format)
2401
  * @rmtoll TSTR         ST            LL_RTC_TS_GetSecond\n
2402
  * @rmtoll TSTR         PM            LL_RTC_TS_GetTimeFormat
2402
  *         TSTR         SU            LL_RTC_TS_GetSecond
2403
  * @param  RTCx RTC Instance
2403
  * @param  RTCx RTC Instance
2404
  * @retval Returned value can be one of the following values:
2404
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2405
  *         @arg @ref LL_RTC_TS_TIME_FORMAT_AM
2405
  */
2406
  *         @arg @ref LL_RTC_TS_TIME_FORMAT_PM
2406
__STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
2407
  */
2407
{
2408
__STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
2408
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2409
{
2409
}
2410
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
2410
 
2411
}
2411
/**
2412
 
2412
  * @brief  Get Timestamp time (hour, minute and second) in BCD format
2413
/**
2413
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2414
  * @brief  Get Timestamp Hours in BCD format
2414
  * are available to get independently each parameter.
2415
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
2415
  * @rmtoll TSTR         HT            LL_RTC_TS_GetTime\n
2416
  * @rmtoll TSTR         HT            LL_RTC_TS_GetHour\n
2416
  *         TSTR         HU            LL_RTC_TS_GetTime\n
2417
  *         TSTR         HU            LL_RTC_TS_GetHour
2417
  *         TSTR         MNT           LL_RTC_TS_GetTime\n
2418
  * @param  RTCx RTC Instance
2418
  *         TSTR         MNU           LL_RTC_TS_GetTime\n
2419
  * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
2419
  *         TSTR         ST            LL_RTC_TS_GetTime\n
2420
  */
2420
  *         TSTR         SU            LL_RTC_TS_GetTime
2421
__STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
2421
  * @param  RTCx RTC Instance
2422
{
2422
  * @retval Combination of hours, minutes and seconds.
2423
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
2423
  */
2424
}
2424
__STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
2425
 
2425
{
2426
/**
2426
  return (uint32_t)(READ_BIT(RTCx->TSTR,
2427
  * @brief  Get Timestamp Minutes in BCD format
2427
                             RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2428
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
2428
}
2429
  * @rmtoll TSTR         MNT           LL_RTC_TS_GetMinute\n
2429
 
2430
  *         TSTR         MNU           LL_RTC_TS_GetMinute
2430
/**
2431
  * @param  RTCx RTC Instance
2431
  * @brief  Get Timestamp Week day
2432
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2432
  * @rmtoll TSDR         WDU           LL_RTC_TS_GetWeekDay
2433
  */
2433
  * @param  RTCx RTC Instance
2434
__STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
2434
  * @retval Returned value can be one of the following values:
2435
{
2435
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2436
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
2436
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2437
}
2437
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2438
 
2438
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2439
/**
2439
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2440
  * @brief  Get Timestamp Seconds in BCD format
2440
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2441
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
2441
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2442
  * @rmtoll TSTR         ST            LL_RTC_TS_GetSecond\n
2442
  */
2443
  *         TSTR         SU            LL_RTC_TS_GetSecond
2443
__STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
2444
  * @param  RTCx RTC Instance
2444
{
2445
  * @retval Value between Min_Data=0x00 and Max_Data=0x59
2445
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
2446
  */
2446
}
2447
__STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
2447
 
2448
{
2448
/**
2449
  return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
2449
  * @brief  Get Timestamp Month in BCD format
2450
}
2450
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2451
 
2451
  * @rmtoll TSDR         MT            LL_RTC_TS_GetMonth\n
2452
/**
2452
  *         TSDR         MU            LL_RTC_TS_GetMonth
2453
  * @brief  Get Timestamp time (hour, minute and second) in BCD format
2453
  * @param  RTCx RTC Instance
2454
  * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
2454
  * @retval Returned value can be one of the following values:
2455
  * are available to get independently each parameter.
2455
  *         @arg @ref LL_RTC_MONTH_JANUARY
2456
  * @rmtoll TSTR         HT            LL_RTC_TS_GetTime\n
2456
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
2457
  *         TSTR         HU            LL_RTC_TS_GetTime\n
2457
  *         @arg @ref LL_RTC_MONTH_MARCH
2458
  *         TSTR         MNT           LL_RTC_TS_GetTime\n
2458
  *         @arg @ref LL_RTC_MONTH_APRIL
2459
  *         TSTR         MNU           LL_RTC_TS_GetTime\n
2459
  *         @arg @ref LL_RTC_MONTH_MAY
2460
  *         TSTR         ST            LL_RTC_TS_GetTime\n
2460
  *         @arg @ref LL_RTC_MONTH_JUNE
2461
  *         TSTR         SU            LL_RTC_TS_GetTime
2461
  *         @arg @ref LL_RTC_MONTH_JULY
2462
  * @param  RTCx RTC Instance
2462
  *         @arg @ref LL_RTC_MONTH_AUGUST
2463
  * @retval Combination of hours, minutes and seconds.
2463
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
2464
  */
2464
  *         @arg @ref LL_RTC_MONTH_OCTOBER
2465
__STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
2465
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
2466
{
2466
  *         @arg @ref LL_RTC_MONTH_DECEMBER
2467
  return (uint32_t)(READ_BIT(RTCx->TSTR,
2467
  */
2468
                             RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
2468
__STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
2469
}
2469
{
2470
 
2470
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
2471
/**
2471
}
2472
  * @brief  Get Timestamp Week day
2472
 
2473
  * @rmtoll TSDR         WDU           LL_RTC_TS_GetWeekDay
2473
/**
2474
  * @param  RTCx RTC Instance
2474
  * @brief  Get Timestamp Day in BCD format
2475
  * @retval Returned value can be one of the following values:
2475
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2476
  *         @arg @ref LL_RTC_WEEKDAY_MONDAY
2476
  * @rmtoll TSDR         DT            LL_RTC_TS_GetDay\n
2477
  *         @arg @ref LL_RTC_WEEKDAY_TUESDAY
2477
  *         TSDR         DU            LL_RTC_TS_GetDay
2478
  *         @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
2478
  * @param  RTCx RTC Instance
2479
  *         @arg @ref LL_RTC_WEEKDAY_THURSDAY
2479
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
2480
  *         @arg @ref LL_RTC_WEEKDAY_FRIDAY
2480
  */
2481
  *         @arg @ref LL_RTC_WEEKDAY_SATURDAY
2481
__STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
2482
  *         @arg @ref LL_RTC_WEEKDAY_SUNDAY
2482
{
2483
  */
2483
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
2484
__STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
2484
}
2485
{
2485
 
2486
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
2486
/**
2487
}
2487
  * @brief  Get Timestamp date (WeekDay, Day and Month) in BCD format
2488
 
2488
  * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2489
/**
2489
  * and __LL_RTC_GET_DAY are available to get independently each parameter.
2490
  * @brief  Get Timestamp Month in BCD format
2490
  * @rmtoll TSDR         WDU           LL_RTC_TS_GetDate\n
2491
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
2491
  *         TSDR         MT            LL_RTC_TS_GetDate\n
2492
  * @rmtoll TSDR         MT            LL_RTC_TS_GetMonth\n
2492
  *         TSDR         MU            LL_RTC_TS_GetDate\n
2493
  *         TSDR         MU            LL_RTC_TS_GetMonth
2493
  *         TSDR         DT            LL_RTC_TS_GetDate\n
2494
  * @param  RTCx RTC Instance
2494
  *         TSDR         DU            LL_RTC_TS_GetDate
2495
  * @retval Returned value can be one of the following values:
2495
  * @param  RTCx RTC Instance
2496
  *         @arg @ref LL_RTC_MONTH_JANUARY
2496
  * @retval Combination of Weekday, Day and Month
2497
  *         @arg @ref LL_RTC_MONTH_FEBRUARY
2497
  */
2498
  *         @arg @ref LL_RTC_MONTH_MARCH
2498
__STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
2499
  *         @arg @ref LL_RTC_MONTH_APRIL
2499
{
2500
  *         @arg @ref LL_RTC_MONTH_MAY
2500
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
2501
  *         @arg @ref LL_RTC_MONTH_JUNE
2501
}
2502
  *         @arg @ref LL_RTC_MONTH_JULY
2502
 
2503
  *         @arg @ref LL_RTC_MONTH_AUGUST
2503
#if defined(RTC_SUBSECOND_SUPPORT)
2504
  *         @arg @ref LL_RTC_MONTH_SEPTEMBER
2504
/**
2505
  *         @arg @ref LL_RTC_MONTH_OCTOBER
2505
  * @brief  Get time-stamp subseconds value
2506
  *         @arg @ref LL_RTC_MONTH_NOVEMBER
2506
  * @rmtoll TSSSR        SS            LL_RTC_TS_GetSubSecond
2507
  *         @arg @ref LL_RTC_MONTH_DECEMBER
2507
  * @param  RTCx RTC Instance
2508
  */
2508
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2509
__STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
2509
  */
2510
{
2510
__STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
2511
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
2511
{
2512
}
2512
  return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
2513
 
2513
}
2514
/**
2514
#endif /* RTC_SUBSECOND_SUPPORT */
2515
  * @brief  Get Timestamp Day in BCD format
2515
 
2516
  * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
2516
#if defined(RTC_TAFCR_TAMPTS)
2517
  * @rmtoll TSDR         DT            LL_RTC_TS_GetDay\n
2517
/**
2518
  *         TSDR         DU            LL_RTC_TS_GetDay
2518
  * @brief  Activate timestamp on tamper detection event
2519
  * @param  RTCx RTC Instance
2519
  * @rmtoll TAFCR       TAMPTS        LL_RTC_TS_EnableOnTamper
2520
  * @retval Value between Min_Data=0x01 and Max_Data=0x31
2520
  * @param  RTCx RTC Instance
2521
  */
2521
  * @retval None
2522
__STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
2522
  */
2523
{
2523
__STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2524
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
2524
{
2525
}
2525
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2526
 
2526
}
2527
/**
2527
 
2528
  * @brief  Get Timestamp date (WeekDay, Day and Month) in BCD format
2528
/**
2529
  * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
2529
  * @brief  Disable timestamp on tamper detection event
2530
  * and __LL_RTC_GET_DAY are available to get independently each parameter.
2530
  * @rmtoll TAFCR       TAMPTS        LL_RTC_TS_DisableOnTamper
2531
  * @rmtoll TSDR         WDU           LL_RTC_TS_GetDate\n
2531
  * @param  RTCx RTC Instance
2532
  *         TSDR         MT            LL_RTC_TS_GetDate\n
2532
  * @retval None
2533
  *         TSDR         MU            LL_RTC_TS_GetDate\n
2533
  */
2534
  *         TSDR         DT            LL_RTC_TS_GetDate\n
2534
__STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2535
  *         TSDR         DU            LL_RTC_TS_GetDate
2535
{
2536
  * @param  RTCx RTC Instance
2536
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2537
  * @retval Combination of Weekday, Day and Month
2537
}
2538
  */
2538
#endif /* RTC_TAFCR_TAMPTS */
2539
__STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
2539
 
2540
{
2540
/**
2541
  return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
2541
  * @}
2542
}
2542
  */
2543
 
2543
 
2544
#if defined(RTC_SUBSECOND_SUPPORT)
2544
/** @defgroup RTC_LL_EF_Tamper Tamper
2545
/**
2545
  * @{
2546
  * @brief  Get time-stamp sub second value
2546
  */
2547
  * @rmtoll TSSSR        SS            LL_RTC_TS_GetSubSecond
2547
 
2548
  * @param  RTCx RTC Instance
2548
/**
2549
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2549
  * @brief  Enable RTC_TAMPx input detection
2550
  */
2550
  * @rmtoll TAFCR       TAMP1E        LL_RTC_TAMPER_Enable\n
2551
__STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
2551
  *         TAFCR       TAMP2E        LL_RTC_TAMPER_Enable\n
2552
{
2552
  *         TAFCR       TAMP3E        LL_RTC_TAMPER_Enable
2553
  return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
2553
  * @param  RTCx RTC Instance
2554
}
2554
  * @param  Tamper This parameter can be a combination of the following values:
2555
#endif /* RTC_SUBSECOND_SUPPORT */
2555
  *         @arg @ref LL_RTC_TAMPER_1
2556
 
2556
  *         @arg @ref LL_RTC_TAMPER_2 (*)
2557
#if defined(RTC_TAFCR_TAMPTS)
2557
  *         @arg @ref LL_RTC_TAMPER_3 (*)
2558
/**
2558
  *
2559
  * @brief  Activate timestamp on tamper detection event
2559
  *         (*) value not applicable to all devices.
2560
  * @rmtoll TAFCR       TAMPTS        LL_RTC_TS_EnableOnTamper
2560
  * @retval None
2561
  * @param  RTCx RTC Instance
2561
  */
2562
  * @retval None
2562
__STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
2563
  */
2563
{
2564
__STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
2564
  SET_BIT(RTCx->TAFCR, Tamper);
2565
{
2565
}
2566
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2566
 
2567
}
2567
/**
2568
 
2568
  * @brief  Clear RTC_TAMPx input detection
2569
/**
2569
  * @rmtoll TAFCR       TAMP1E        LL_RTC_TAMPER_Disable\n
2570
  * @brief  Disable timestamp on tamper detection event
2570
  *         TAFCR       TAMP2E        LL_RTC_TAMPER_Disable\n
2571
  * @rmtoll TAFCR       TAMPTS        LL_RTC_TS_DisableOnTamper
2571
  *         TAFCR       TAMP3E        LL_RTC_TAMPER_Disable
2572
  * @param  RTCx RTC Instance
2572
  * @param  RTCx RTC Instance
2573
  * @retval None
2573
  * @param  Tamper This parameter can be a combination of the following values:
2574
  */
2574
  *         @arg @ref LL_RTC_TAMPER_1
2575
__STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
2575
  *         @arg @ref LL_RTC_TAMPER_2 (*)
2576
{
2576
  *         @arg @ref LL_RTC_TAMPER_3 (*)
2577
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPTS);
2577
  *
2578
}
2578
  *         (*) value not applicable to all devices.
2579
#endif /* RTC_TAFCR_TAMPTS */
2579
  * @retval None
2580
 
2580
  */
2581
/**
2581
__STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
2582
  * @}
2582
{
2583
  */
2583
  CLEAR_BIT(RTCx->TAFCR, Tamper);
2584
 
2584
}
2585
/** @defgroup RTC_LL_EF_Tamper Tamper
2585
 
2586
  * @{
2586
#if defined(RTC_TAFCR_TAMPFLT)
2587
  */
2587
/**
2588
 
2588
  * @brief  Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
2589
/**
2589
  * @rmtoll TAFCR       TAMPPUDIS     LL_RTC_TAMPER_DisablePullUp
2590
  * @brief  Enable RTC_TAMPx input detection
2590
  * @param  RTCx RTC Instance
2591
  * @rmtoll TAFCR       TAMP1E        LL_RTC_TAMPER_Enable\n
2591
  * @retval None
2592
  *         TAFCR       TAMP2E        LL_RTC_TAMPER_Enable\n
2592
  */
2593
  *         TAFCR       TAMP3E        LL_RTC_TAMPER_Enable
2593
__STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
2594
  * @param  RTCx RTC Instance
2594
{
2595
  * @param  Tamper This parameter can be a combination of the following values:
2595
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2596
  *         @arg @ref LL_RTC_TAMPER_1
2596
}
2597
  *         @arg @ref LL_RTC_TAMPER_2 (*)
2597
 
2598
  *         @arg @ref LL_RTC_TAMPER_3 (*)
2598
/**
2599
  *
2599
  * @brief  Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
2600
  *         (*) value not defined in all devices.
2600
  * @rmtoll TAFCR       TAMPPUDIS     LL_RTC_TAMPER_EnablePullUp
2601
  * @retval None
2601
  * @param  RTCx RTC Instance
2602
  */
2602
  * @retval None
2603
__STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
2603
  */
2604
{
2604
__STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
2605
  SET_BIT(RTCx->TAFCR, Tamper);
2605
{
2606
}
2606
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2607
 
2607
}
2608
/**
2608
 
2609
  * @brief  Clear RTC_TAMPx input detection
2609
/**
2610
  * @rmtoll TAFCR       TAMP1E        LL_RTC_TAMPER_Disable\n
2610
  * @brief  Set RTC_TAMPx precharge duration
2611
  *         TAFCR       TAMP2E        LL_RTC_TAMPER_Disable\n
2611
  * @rmtoll TAFCR       TAMPPRCH      LL_RTC_TAMPER_SetPrecharge
2612
  *         TAFCR       TAMP3E        LL_RTC_TAMPER_Disable
2612
  * @param  RTCx RTC Instance
2613
  * @param  RTCx RTC Instance
2613
  * @param  Duration This parameter can be one of the following values:
2614
  * @param  Tamper This parameter can be a combination of the following values:
2614
  *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2615
  *         @arg @ref LL_RTC_TAMPER_1
2615
  *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2616
  *         @arg @ref LL_RTC_TAMPER_2 (*)
2616
  *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2617
  *         @arg @ref LL_RTC_TAMPER_3 (*)
2617
  *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2618
  *
2618
  * @retval None
2619
  *         (*) value not defined in all devices.
2619
  */
2620
  * @retval None
2620
__STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
2621
  */
2621
{
2622
__STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
2622
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH, Duration);
2623
{
2623
}
2624
  CLEAR_BIT(RTCx->TAFCR, Tamper);
2624
 
2625
}
2625
/**
2626
 
2626
  * @brief  Get RTC_TAMPx precharge duration
2627
#if defined(RTC_TAFCR_TAMPPUDIS)
2627
  * @rmtoll TAFCR       TAMPPRCH      LL_RTC_TAMPER_GetPrecharge
2628
/**
2628
  * @param  RTCx RTC Instance
2629
  * @brief  Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
2629
  * @retval Returned value can be one of the following values:
2630
  * @rmtoll TAFCR       TAMPPUDIS     LL_RTC_TAMPER_DisablePullUp
2630
  *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2631
  * @param  RTCx RTC Instance
2631
  *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2632
  * @retval None
2632
  *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2633
  */
2633
  *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2634
__STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
2634
  */
2635
{
2635
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
2636
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2636
{
2637
}
2637
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH));
2638
 
2638
}
2639
/**
2639
 
2640
  * @brief  Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
2640
/**
2641
  * @rmtoll TAFCR       TAMPPUDIS     LL_RTC_TAMPER_EnablePullUp
2641
  * @brief  Set RTC_TAMPx filter count
2642
  * @param  RTCx RTC Instance
2642
  * @rmtoll TAFCR       TAMPFLT       LL_RTC_TAMPER_SetFilterCount
2643
  * @retval None
2643
  * @param  RTCx RTC Instance
2644
  */
2644
  * @param  FilterCount This parameter can be one of the following values:
2645
__STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
2645
  *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2646
{
2646
  *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2647
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPUDIS);
2647
  *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2648
}
2648
  *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2649
#endif /* RTC_TAFCR_TAMPPUDIS */
2649
  * @retval None
2650
 
2650
  */
2651
#if defined(RTC_TAFCR_TAMPPRCH)
2651
__STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
2652
/**
2652
{
2653
  * @brief  Set RTC_TAMPx precharge duration
2653
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFLT, FilterCount);
2654
  * @rmtoll TAFCR       TAMPPRCH      LL_RTC_TAMPER_SetPrecharge
2654
}
2655
  * @param  RTCx RTC Instance
2655
 
2656
  * @param  Duration This parameter can be one of the following values:
2656
/**
2657
  *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2657
  * @brief  Get RTC_TAMPx filter count
2658
  *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2658
  * @rmtoll TAFCR       TAMPFLT       LL_RTC_TAMPER_GetFilterCount
2659
  *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2659
  * @param  RTCx RTC Instance
2660
  *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2660
  * @retval Returned value can be one of the following values:
2661
  * @retval None
2661
  *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2662
  */
2662
  *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2663
__STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
2663
  *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2664
{
2664
  *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2665
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH, Duration);
2665
  */
2666
}
2666
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
2667
 
2667
{
2668
/**
2668
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFLT));
2669
  * @brief  Get RTC_TAMPx precharge duration
2669
}
2670
  * @rmtoll TAFCR       TAMPPRCH      LL_RTC_TAMPER_GetPrecharge
2670
 
2671
  * @param  RTCx RTC Instance
2671
/**
2672
  * @retval Returned value can be one of the following values:
2672
  * @brief  Set Tamper sampling frequency
2673
  *         @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
2673
  * @rmtoll TAFCR       TAMPFREQ      LL_RTC_TAMPER_SetSamplingFreq
2674
  *         @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
2674
  * @param  RTCx RTC Instance
2675
  *         @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
2675
  * @param  SamplingFreq This parameter can be one of the following values:
2676
  *         @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
2676
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2677
  */
2677
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2678
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
2678
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2679
{
2679
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2680
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPPRCH));
2680
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2681
}
2681
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2682
#endif /* RTC_TAFCR_TAMPPRCH */
2682
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2683
 
2683
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2684
#if defined(RTC_TAFCR_TAMPFLT)
2684
  * @retval None
2685
/**
2685
  */
2686
  * @brief  Set RTC_TAMPx filter count
2686
__STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
2687
  * @rmtoll TAFCR       TAMPFLT       LL_RTC_TAMPER_SetFilterCount
2687
{
2688
  * @param  RTCx RTC Instance
2688
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ, SamplingFreq);
2689
  * @param  FilterCount This parameter can be one of the following values:
2689
}
2690
  *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2690
 
2691
  *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2691
/**
2692
  *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2692
  * @brief  Get Tamper sampling frequency
2693
  *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2693
  * @rmtoll TAFCR       TAMPFREQ      LL_RTC_TAMPER_GetSamplingFreq
2694
  * @retval None
2694
  * @param  RTCx RTC Instance
2695
  */
2695
  * @retval Returned value can be one of the following values:
2696
__STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
2696
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2697
{
2697
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2698
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFLT, FilterCount);
2698
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2699
}
2699
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2700
 
2700
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2701
/**
2701
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2702
  * @brief  Get RTC_TAMPx filter count
2702
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2703
  * @rmtoll TAFCR       TAMPFLT       LL_RTC_TAMPER_GetFilterCount
2703
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2704
  * @param  RTCx RTC Instance
2704
  */
2705
  * @retval Returned value can be one of the following values:
2705
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
2706
  *         @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
2706
{
2707
  *         @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
2707
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ));
2708
  *         @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
2708
}
2709
  *         @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
2709
#endif /* RTC_TAFCR_TAMPFLT */
2710
  */
2710
 
2711
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
2711
/**
2712
{
2712
  * @brief  Enable Active level for Tamper input
2713
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFLT));
2713
  * @rmtoll TAFCR       TAMP1TRG      LL_RTC_TAMPER_EnableActiveLevel\n
2714
}
2714
  *         TAFCR       TAMP2TRG      LL_RTC_TAMPER_EnableActiveLevel\n
2715
#endif /* RTC_TAFCR_TAMPFLT */
2715
  *         TAFCR       TAMP3TRG      LL_RTC_TAMPER_EnableActiveLevel
2716
 
2716
  * @param  RTCx RTC Instance
2717
#if defined(RTC_TAFCR_TAMPFREQ)
2717
  * @param  Tamper This parameter can be a combination of the following values:
2718
/**
2718
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2719
  * @brief  Set Tamper sampling frequency
2719
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2720
  * @rmtoll TAFCR       TAMPFREQ      LL_RTC_TAMPER_SetSamplingFreq
2720
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2721
  * @param  RTCx RTC Instance
2721
  *
2722
  * @param  SamplingFreq This parameter can be one of the following values:
2722
  *         (*) value not applicable to all devices.
2723
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2723
  * @retval None
2724
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2724
  */
2725
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2725
__STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2726
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2726
{
2727
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2727
  SET_BIT(RTCx->TAFCR, Tamper);
2728
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2728
}
2729
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2729
 
2730
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2730
/**
2731
  * @retval None
2731
  * @brief  Disable Active level for Tamper input
2732
  */
2732
  * @rmtoll TAFCR       TAMP1TRG      LL_RTC_TAMPER_DisableActiveLevel\n
2733
__STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
2733
  *         TAFCR       TAMP2TRG      LL_RTC_TAMPER_DisableActiveLevel\n
2734
{
2734
  *         TAFCR       TAMP3TRG      LL_RTC_TAMPER_DisableActiveLevel
2735
  MODIFY_REG(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ, SamplingFreq);
2735
  * @param  RTCx RTC Instance
2736
}
2736
  * @param  Tamper This parameter can be a combination of the following values:
2737
 
2737
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2738
/**
2738
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2739
  * @brief  Get Tamper sampling frequency
2739
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2740
  * @rmtoll TAFCR       TAMPFREQ      LL_RTC_TAMPER_GetSamplingFreq
2740
  *
2741
  * @param  RTCx RTC Instance
2741
  *         (*) value not applicable to all devices.
2742
  * @retval Returned value can be one of the following values:
2742
  * @retval None
2743
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
2743
  */
2744
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
2744
__STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2745
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
2745
{
2746
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
2746
  CLEAR_BIT(RTCx->TAFCR, Tamper);
2747
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
2747
}
2748
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
2748
 
2749
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
2749
/**
2750
  *         @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
2750
  * @}
2751
  */
2751
  */
2752
__STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
2752
 
2753
{
2753
/** @defgroup RTC_LL_EF_Wakeup Wakeup
2754
  return (uint32_t)(READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPFREQ));
2754
  * @{
2755
}
2755
  */
2756
#endif /* RTC_TAFCR_TAMPFREQ */
2756
 
2757
 
2757
/**
2758
/**
2758
  * @brief  Enable Wakeup timer
2759
  * @brief  Enable Active level for Tamper input
2759
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2760
  * @rmtoll TAFCR       TAMP1TRG      LL_RTC_TAMPER_EnableActiveLevel\n
2760
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_Enable
2761
  *         TAFCR       TAMP2TRG      LL_RTC_TAMPER_EnableActiveLevel\n
2761
  * @param  RTCx RTC Instance
2762
  *         TAFCR       TAMP3TRG      LL_RTC_TAMPER_EnableActiveLevel
2762
  * @retval None
2763
  * @param  RTCx RTC Instance
2763
  */
2764
  * @param  Tamper This parameter can be a combination of the following values:
2764
__STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
2765
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2765
{
2766
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2766
  SET_BIT(RTCx->CR, RTC_CR_WUTE);
2767
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2767
}
2768
  *
2768
 
2769
  *         (*) value not defined in all devices.
2769
/**
2770
  * @retval None
2770
  * @brief  Disable Wakeup timer
2771
  */
2771
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2772
__STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2772
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_Disable
2773
{
2773
  * @param  RTCx RTC Instance
2774
  SET_BIT(RTCx->TAFCR, Tamper);
2774
  * @retval None
2775
}
2775
  */
2776
 
2776
__STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
2777
/**
2777
{
2778
  * @brief  Disable Active level for Tamper input
2778
  CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
2779
  * @rmtoll TAFCR       TAMP1TRG      LL_RTC_TAMPER_DisableActiveLevel\n
2779
}
2780
  *         TAFCR       TAMP2TRG      LL_RTC_TAMPER_DisableActiveLevel\n
2780
 
2781
  *         TAFCR       TAMP3TRG      LL_RTC_TAMPER_DisableActiveLevel
2781
/**
2782
  * @param  RTCx RTC Instance
2782
  * @brief  Check if Wakeup timer is enabled or not
2783
  * @param  Tamper This parameter can be a combination of the following values:
2783
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_IsEnabled
2784
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
2784
  * @param  RTCx RTC Instance
2785
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 (*)
2785
  * @retval State of bit (1 or 0).
2786
  *         @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 (*)
2786
  */
2787
  *
2787
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
2788
  *         (*) value not defined in all devices.
2788
{
2789
  * @retval None
2789
  return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1UL : 0UL);
2790
  */
2790
}
2791
__STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
2791
 
2792
{
2792
/**
2793
  CLEAR_BIT(RTCx->TAFCR, Tamper);
2793
  * @brief  Select Wakeup clock
2794
}
2794
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2795
 
2795
  * @note   Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
2796
/**
2796
  * @rmtoll CR           WUCKSEL       LL_RTC_WAKEUP_SetClock
2797
  * @}
2797
  * @param  RTCx RTC Instance
2798
  */
2798
  * @param  WakeupClock This parameter can be one of the following values:
2799
 
2799
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2800
#if defined(RTC_WAKEUP_SUPPORT)
2800
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2801
/** @defgroup RTC_LL_EF_Wakeup Wakeup
2801
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2802
  * @{
2802
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2803
  */
2803
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2804
 
2804
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2805
/**
2805
  * @retval None
2806
  * @brief  Enable Wakeup timer
2806
  */
2807
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2807
__STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
2808
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_Enable
2808
{
2809
  * @param  RTCx RTC Instance
2809
  MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
2810
  * @retval None
2810
}
2811
  */
2811
 
2812
__STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
2812
/**
2813
{
2813
  * @brief  Get Wakeup clock
2814
  SET_BIT(RTCx->CR, RTC_CR_WUTE);
2814
  * @rmtoll CR           WUCKSEL       LL_RTC_WAKEUP_GetClock
2815
}
2815
  * @param  RTCx RTC Instance
2816
 
2816
  * @retval Returned value can be one of the following values:
2817
/**
2817
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2818
  * @brief  Disable Wakeup timer
2818
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2819
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2819
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2820
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_Disable
2820
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2821
  * @param  RTCx RTC Instance
2821
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2822
  * @retval None
2822
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2823
  */
2823
  */
2824
__STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
2824
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
2825
{
2825
{
2826
  CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
2826
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
2827
}
2827
}
2828
 
2828
 
2829
/**
2829
/**
2830
  * @brief  Check if Wakeup timer is enabled or not
2830
  * @brief  Set Wakeup auto-reload value
2831
  * @rmtoll CR           WUTE          LL_RTC_WAKEUP_IsEnabled
2831
  * @note   Bit can be written only when WUTWF is set to 1 in RTC_ISR
2832
  * @param  RTCx RTC Instance
2832
  * @rmtoll WUTR         WUT           LL_RTC_WAKEUP_SetAutoReload
2833
  * @retval State of bit (1 or 0).
2833
  * @param  RTCx RTC Instance
2834
  */
2834
  * @param  Value Value between Min_Data=0x00 and Max_Data=0xFFFF
2835
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
2835
  * @retval None
2836
{
2836
  */
2837
  return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1UL : 0UL);
2837
__STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
2838
}
2838
{
2839
 
2839
  MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
2840
/**
2840
}
2841
  * @brief  Select Wakeup clock
2841
 
2842
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2842
/**
2843
  * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ISR WUTWF bit = 1
2843
  * @brief  Get Wakeup auto-reload value
2844
  * @rmtoll CR           WUCKSEL       LL_RTC_WAKEUP_SetClock
2844
  * @rmtoll WUTR         WUT           LL_RTC_WAKEUP_GetAutoReload
2845
  * @param  RTCx RTC Instance
2845
  * @param  RTCx RTC Instance
2846
  * @param  WakeupClock This parameter can be one of the following values:
2846
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2847
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2847
  */
2848
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2848
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
2849
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2849
{
2850
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2850
  return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
2851
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2851
}
2852
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2852
 
2853
  * @retval None
2853
/**
2854
  */
2854
  * @}
2855
__STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
2855
  */
2856
{
2856
 
2857
  MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
2857
/** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
2858
}
2858
  * @{
2859
 
2859
  */
2860
/**
2860
 
2861
  * @brief  Get Wakeup clock
2861
/**
2862
  * @rmtoll CR           WUCKSEL       LL_RTC_WAKEUP_GetClock
2862
  * @brief  Writes a data in a specified RTC Backup data register.
2863
  * @param  RTCx RTC Instance
2863
  * @rmtoll BKPxR        BKP           LL_RTC_BAK_SetRegister
2864
  * @retval Returned value can be one of the following values:
2864
  * @param  RTCx RTC Instance
2865
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
2865
  * @param  BackupRegister This parameter can be one of the following values:
2866
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
2866
  *         @arg @ref LL_RTC_BKP_DR0
2867
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
2867
  *         @arg @ref LL_RTC_BKP_DR1
2868
  *         @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
2868
  *         @arg @ref LL_RTC_BKP_DR2
2869
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
2869
  *         @arg @ref LL_RTC_BKP_DR3
2870
  *         @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
2870
  *         @arg @ref LL_RTC_BKP_DR4
2871
  */
2871
  *         @arg @ref LL_RTC_BKP_DR5 (*)
2872
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
2872
  *         @arg @ref LL_RTC_BKP_DR6 (*)
2873
{
2873
  *         @arg @ref LL_RTC_BKP_DR7 (*)
2874
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
2874
  *         @arg @ref LL_RTC_BKP_DR8 (*)
2875
}
2875
  *         @arg @ref LL_RTC_BKP_DR9 (*)
2876
 
2876
  *         @arg @ref LL_RTC_BKP_DR10 (*)
2877
/**
2877
  *         @arg @ref LL_RTC_BKP_DR11 (*)
2878
  * @brief  Set Wakeup auto-reload value
2878
  *         @arg @ref LL_RTC_BKP_DR12 (*)
2879
  * @note Bit can be written only when WUTWF is set to 1 in RTC_ISR
2879
  *         @arg @ref LL_RTC_BKP_DR13 (*)
2880
  * @rmtoll WUTR         WUT           LL_RTC_WAKEUP_SetAutoReload
2880
  *         @arg @ref LL_RTC_BKP_DR14 (*)
2881
  * @param  RTCx RTC Instance
2881
  *         @arg @ref LL_RTC_BKP_DR15 (*)
2882
  * @param  Value Value between Min_Data=0x00 and Max_Data=0xFFFF
2882
  *         @arg @ref LL_RTC_BKP_DR16 (*)
2883
  * @retval None
2883
  *         @arg @ref LL_RTC_BKP_DR17 (*)
2884
  */
2884
  *         @arg @ref LL_RTC_BKP_DR18 (*)
2885
__STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
2885
  *         @arg @ref LL_RTC_BKP_DR19 (*)
2886
{
2886
  *         @arg @ref LL_RTC_BKP_DR20 (*)
2887
  MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
2887
  *         @arg @ref LL_RTC_BKP_DR21 (*)
2888
}
2888
  *         @arg @ref LL_RTC_BKP_DR22 (*)
2889
 
2889
  *         @arg @ref LL_RTC_BKP_DR23 (*)
2890
/**
2890
  *         @arg @ref LL_RTC_BKP_DR24 (*)
2891
  * @brief  Get Wakeup auto-reload value
2891
  *         @arg @ref LL_RTC_BKP_DR25 (*)
2892
  * @rmtoll WUTR         WUT           LL_RTC_WAKEUP_GetAutoReload
2892
  *         @arg @ref LL_RTC_BKP_DR26 (*)
2893
  * @param  RTCx RTC Instance
2893
  *         @arg @ref LL_RTC_BKP_DR27 (*)
2894
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
2894
  *         @arg @ref LL_RTC_BKP_DR28 (*)
2895
  */
2895
  *         @arg @ref LL_RTC_BKP_DR29 (*)
2896
__STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
2896
  *         @arg @ref LL_RTC_BKP_DR30 (*)
2897
{
2897
  *         @arg @ref LL_RTC_BKP_DR31 (*)
2898
  return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
2898
  *
2899
}
2899
  *         (*) value not applicable to all devices.
2900
 
2900
  * @param  Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
2901
/**
2901
  * @retval None
2902
  * @}
2902
  */
2903
  */
2903
__STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
2904
#endif /* RTC_WAKEUP_SUPPORT */
2904
{
2905
 
2905
  uint32_t temp;
2906
#if defined(RTC_BACKUP_SUPPORT)
2906
 
2907
/** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
2907
  temp = (uint32_t)(&(RTCx->BKP0R));
2908
  * @{
2908
  temp += (BackupRegister * 4U);
2909
  */
2909
 
2910
 
2910
  /* Write the specified register */
2911
/**
2911
  *(__IO uint32_t *)temp = (uint32_t)Data;
2912
  * @brief  Writes a data in a specified RTC Backup data register.
2912
}
2913
  * @rmtoll BKPxR        BKP           LL_RTC_BAK_SetRegister
2913
 
2914
  * @param  RTCx RTC Instance
2914
/**
2915
  * @param  BackupRegister This parameter can be one of the following values:
2915
  * @brief  Reads data from the specified RTC Backup data Register.
2916
  *         @arg @ref LL_RTC_BKP_DR0
2916
  * @rmtoll BKPxR        BKP           LL_RTC_BAK_GetRegister
2917
  *         @arg @ref LL_RTC_BKP_DR1
2917
  * @param  RTCx RTC Instance
2918
  *         @arg @ref LL_RTC_BKP_DR2
2918
  * @param  BackupRegister This parameter can be one of the following values:
2919
  *         @arg @ref LL_RTC_BKP_DR3
2919
  *         @arg @ref LL_RTC_BKP_DR0
2920
  *         @arg @ref LL_RTC_BKP_DR4
2920
  *         @arg @ref LL_RTC_BKP_DR1
2921
  *         @arg @ref LL_RTC_BKP_DR5 (*)
2921
  *         @arg @ref LL_RTC_BKP_DR2
2922
  *         @arg @ref LL_RTC_BKP_DR6 (*)
2922
  *         @arg @ref LL_RTC_BKP_DR3
2923
  *         @arg @ref LL_RTC_BKP_DR7 (*)
2923
  *         @arg @ref LL_RTC_BKP_DR4
2924
  *         @arg @ref LL_RTC_BKP_DR8 (*)
2924
  *         @arg @ref LL_RTC_BKP_DR5 (*)
2925
  *         @arg @ref LL_RTC_BKP_DR9 (*)
2925
  *         @arg @ref LL_RTC_BKP_DR6 (*)
2926
  *         @arg @ref LL_RTC_BKP_DR10 (*)
2926
  *         @arg @ref LL_RTC_BKP_DR7 (*)
2927
  *         @arg @ref LL_RTC_BKP_DR11 (*)
2927
  *         @arg @ref LL_RTC_BKP_DR8 (*)
2928
  *         @arg @ref LL_RTC_BKP_DR12 (*)
2928
  *         @arg @ref LL_RTC_BKP_DR9 (*)
2929
  *         @arg @ref LL_RTC_BKP_DR13 (*)
2929
  *         @arg @ref LL_RTC_BKP_DR10 (*)
2930
  *         @arg @ref LL_RTC_BKP_DR14 (*)
2930
  *         @arg @ref LL_RTC_BKP_DR11 (*)
2931
  *         @arg @ref LL_RTC_BKP_DR15 (*)
2931
  *         @arg @ref LL_RTC_BKP_DR12 (*)
2932
  *         @arg @ref LL_RTC_BKP_DR16 (*)
2932
  *         @arg @ref LL_RTC_BKP_DR13 (*)
2933
  *         @arg @ref LL_RTC_BKP_DR17 (*)
2933
  *         @arg @ref LL_RTC_BKP_DR14 (*)
2934
  *         @arg @ref LL_RTC_BKP_DR18 (*)
2934
  *         @arg @ref LL_RTC_BKP_DR15 (*)
2935
  *         @arg @ref LL_RTC_BKP_DR19 (*)
2935
  *         @arg @ref LL_RTC_BKP_DR16 (*)
2936
  *         @arg @ref LL_RTC_BKP_DR20 (*)
2936
  *         @arg @ref LL_RTC_BKP_DR17 (*)
2937
  *         @arg @ref LL_RTC_BKP_DR21 (*)
2937
  *         @arg @ref LL_RTC_BKP_DR18 (*)
2938
  *         @arg @ref LL_RTC_BKP_DR22 (*)
2938
  *         @arg @ref LL_RTC_BKP_DR19 (*)
2939
  *         @arg @ref LL_RTC_BKP_DR23 (*)
2939
  *         @arg @ref LL_RTC_BKP_DR20 (*)
2940
  *         @arg @ref LL_RTC_BKP_DR24 (*)
2940
  *         @arg @ref LL_RTC_BKP_DR21 (*)
2941
  *         @arg @ref LL_RTC_BKP_DR25 (*)
2941
  *         @arg @ref LL_RTC_BKP_DR22 (*)
2942
  *         @arg @ref LL_RTC_BKP_DR26 (*)
2942
  *         @arg @ref LL_RTC_BKP_DR23 (*)
2943
  *         @arg @ref LL_RTC_BKP_DR27 (*)
2943
  *         @arg @ref LL_RTC_BKP_DR24 (*)
2944
  *         @arg @ref LL_RTC_BKP_DR28 (*)
2944
  *         @arg @ref LL_RTC_BKP_DR25 (*)
2945
  *         @arg @ref LL_RTC_BKP_DR29 (*)
2945
  *         @arg @ref LL_RTC_BKP_DR26 (*)
2946
  *         @arg @ref LL_RTC_BKP_DR30 (*)
2946
  *         @arg @ref LL_RTC_BKP_DR27 (*)
2947
  *         @arg @ref LL_RTC_BKP_DR31 (*)
2947
  *         @arg @ref LL_RTC_BKP_DR28 (*)
2948
  *
2948
  *         @arg @ref LL_RTC_BKP_DR29 (*)
2949
  *         (*) value not defined in all devices.
2949
  *         @arg @ref LL_RTC_BKP_DR30 (*)
2950
  * @param  Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
2950
  *         @arg @ref LL_RTC_BKP_DR31 (*)
2951
  * @retval None
2951
  *
2952
  */
2952
  *         (*) value not applicable to all devices.
2953
__STATIC_INLINE void LL_RTC_BAK_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
2953
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
2954
{
2954
  */
2955
  uint32_t tmp = 0U;
2955
__STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
2956
 
2956
{
2957
  tmp = (uint32_t)(&(RTCx->BKP0R));
2957
  uint32_t temp;
2958
  tmp += (BackupRegister * 4U);
2958
 
2959
 
2959
  temp = (uint32_t)(&(RTCx->BKP0R));
2960
  /* Write the specified register */
2960
  temp += (BackupRegister * 4U);
2961
  *(__IO uint32_t *)tmp = (uint32_t)Data;
2961
 
2962
}
2962
  /* Read the specified register */
2963
 
2963
  return (*(__IO uint32_t *)temp);
2964
/**
2964
}
2965
  * @brief  Reads data from the specified RTC Backup data Register.
2965
 
2966
  * @rmtoll BKPxR        BKP           LL_RTC_BAK_GetRegister
2966
/**
2967
  * @param  RTCx RTC Instance
2967
  * @}
2968
  * @param  BackupRegister This parameter can be one of the following values:
2968
  */
2969
  *         @arg @ref LL_RTC_BKP_DR0
2969
 
2970
  *         @arg @ref LL_RTC_BKP_DR1
2970
/** @defgroup RTC_LL_EF_Calibration Calibration
2971
  *         @arg @ref LL_RTC_BKP_DR2
2971
  * @{
2972
  *         @arg @ref LL_RTC_BKP_DR3
2972
  */
2973
  *         @arg @ref LL_RTC_BKP_DR4
2973
 
2974
  *         @arg @ref LL_RTC_BKP_DR5 (*)
2974
/**
2975
  *         @arg @ref LL_RTC_BKP_DR6 (*)
2975
  * @brief  Set Calibration output frequency (1 Hz or 512 Hz)
2976
  *         @arg @ref LL_RTC_BKP_DR7 (*)
2976
  * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
2977
  *         @arg @ref LL_RTC_BKP_DR8 (*)
2977
  * @rmtoll CR           COE           LL_RTC_CAL_SetOutputFreq\n
2978
  *         @arg @ref LL_RTC_BKP_DR9 (*)
2978
  *         CR           COSEL         LL_RTC_CAL_SetOutputFreq
2979
  *         @arg @ref LL_RTC_BKP_DR10 (*)
2979
  * @param  RTCx RTC Instance
2980
  *         @arg @ref LL_RTC_BKP_DR11 (*)
2980
  * @param  Frequency This parameter can be one of the following values:
2981
  *         @arg @ref LL_RTC_BKP_DR12 (*)
2981
  *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
2982
  *         @arg @ref LL_RTC_BKP_DR13 (*)
2982
  *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ (*)
2983
  *         @arg @ref LL_RTC_BKP_DR14 (*)
2983
  *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
2984
  *         @arg @ref LL_RTC_BKP_DR15 (*)
2984
  *
2985
  *         @arg @ref LL_RTC_BKP_DR16 (*)
2985
  *         (*) value not applicable to all devices.
2986
  *         @arg @ref LL_RTC_BKP_DR17 (*)
2986
  * @retval None
2987
  *         @arg @ref LL_RTC_BKP_DR18 (*)
2987
  */
2988
  *         @arg @ref LL_RTC_BKP_DR19 (*)
2988
__STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
2989
  *         @arg @ref LL_RTC_BKP_DR20 (*)
2989
{
2990
  *         @arg @ref LL_RTC_BKP_DR21 (*)
2990
#if defined(RTC_CR_COSEL)
2991
  *         @arg @ref LL_RTC_BKP_DR22 (*)
2991
  MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
2992
  *         @arg @ref LL_RTC_BKP_DR23 (*)
2992
#else /* RTC_CR_COSEL */
2993
  *         @arg @ref LL_RTC_BKP_DR24 (*)
2993
  MODIFY_REG(RTCx->CR, RTC_CR_COE, Frequency);
2994
  *         @arg @ref LL_RTC_BKP_DR25 (*)
2994
#endif /* RTC_CR_COSEL */
2995
  *         @arg @ref LL_RTC_BKP_DR26 (*)
2995
}
2996
  *         @arg @ref LL_RTC_BKP_DR27 (*)
2996
 
2997
  *         @arg @ref LL_RTC_BKP_DR28 (*)
2997
/**
2998
  *         @arg @ref LL_RTC_BKP_DR29 (*)
2998
  * @brief  Get Calibration output frequency (1 Hz or 512 Hz)
2999
  *         @arg @ref LL_RTC_BKP_DR30 (*)
2999
  * @rmtoll CR           COE           LL_RTC_CAL_GetOutputFreq\n
3000
  *         @arg @ref LL_RTC_BKP_DR31 (*)
3000
  *         CR           COSEL         LL_RTC_CAL_GetOutputFreq
3001
  *
3001
  * @param  RTCx RTC Instance
3002
  *         (*) value not defined in all devices.
3002
  * @retval Returned value can be one of the following values:
3003
  * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
3003
  *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3004
  */
3004
  *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ (*)
3005
__STATIC_INLINE uint32_t LL_RTC_BAK_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
3005
  *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3006
{
3006
  *
3007
  uint32_t tmp = 0U;
3007
  *         (*) value not applicable to all devices.
3008
 
3008
  */
3009
  tmp = (uint32_t)(&(RTCx->BKP0R));
3009
__STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
3010
  tmp += (BackupRegister * 4U);
3010
{
3011
 
3011
#if defined(RTC_CR_COSEL)
3012
  /* Read the specified register */
3012
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3013
  return (*(__IO uint32_t *)tmp);
3013
#else /* RTC_CR_COSEL */
3014
}
3014
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE));
3015
 
3015
#endif /* RTC_CR_COSEL */
3016
/**
3016
}
3017
  * @}
3017
 
3018
  */
3018
/**
3019
#endif /* RTC_BACKUP_SUPPORT */
3019
  * @brief  Enable Coarse digital calibration
3020
 
3020
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3021
/** @defgroup RTC_LL_EF_Calibration Calibration
3021
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3022
  * @{
3022
  * @rmtoll CR           DCE           LL_RTC_CAL_EnableCoarseDigital
3023
  */
3023
  * @param  RTCx RTC Instance
3024
 
3024
  * @retval None
3025
/**
3025
  */
3026
  * @brief  Set Calibration output frequency (1 Hz or 512 Hz)
3026
__STATIC_INLINE void LL_RTC_CAL_EnableCoarseDigital(RTC_TypeDef *RTCx)
3027
  * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3027
{
3028
  * @rmtoll CR           COE           LL_RTC_CAL_SetOutputFreq\n
3028
  SET_BIT(RTCx->CR, RTC_CR_DCE);
3029
  *         CR           COSEL         LL_RTC_CAL_SetOutputFreq
3029
}
3030
  * @param  RTCx RTC Instance
3030
 
3031
  * @param  Frequency This parameter can be one of the following values:
3031
/**
3032
  *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3032
  * @brief  Disable Coarse digital calibration
3033
  *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ (*)
3033
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3034
  *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3034
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3035
  *
3035
  * @rmtoll CR           DCE           LL_RTC_CAL_DisableCoarseDigital
3036
  *         (*) value not defined in all devices.
3036
  * @param  RTCx RTC Instance
3037
  * @retval None
3037
  * @retval None
3038
  */
3038
  */
3039
__STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
3039
__STATIC_INLINE void LL_RTC_CAL_DisableCoarseDigital(RTC_TypeDef  *RTCx)
3040
{
3040
{
3041
#if defined(RTC_CR_COSEL)
3041
  CLEAR_BIT(RTCx->CR, RTC_CR_DCE);
3042
  MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
3042
}
3043
#else
3043
 
3044
  MODIFY_REG(RTCx->CR, RTC_CR_COE, Frequency);
3044
/**
3045
#endif /* RTC_CR_COSEL */
3045
  * @brief  Set the coarse digital calibration
3046
}
3046
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3047
 
3047
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3048
/**
3048
  * @rmtoll CALIBR       DCS           LL_RTC_CAL_ConfigCoarseDigital\n
3049
  * @brief  Get Calibration output frequency (1 Hz or 512 Hz)
3049
  *         CALIBR       DC            LL_RTC_CAL_ConfigCoarseDigital
3050
  * @rmtoll CR           COE           LL_RTC_CAL_GetOutputFreq\n
3050
  * @param  RTCx RTC Instance
3051
  *         CR           COSEL         LL_RTC_CAL_GetOutputFreq
3051
  * @param  Sign This parameter can be one of the following values:
3052
  * @param  RTCx RTC Instance
3052
  *         @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3053
  * @retval Returned value can be one of the following values:
3053
  *         @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3054
  *         @arg @ref LL_RTC_CALIB_OUTPUT_NONE
3054
  * @param  Value value of coarse calibration expressed in ppm (coded on 5 bits)
3055
  *         @arg @ref LL_RTC_CALIB_OUTPUT_1HZ (*)
3055
  * @note   This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step.
3056
  *         @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
3056
  * @note   This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step.
3057
  *
3057
  * @retval None
3058
  *         (*) value not defined in all devices.
3058
  */
3059
  */
3059
__STATIC_INLINE void LL_RTC_CAL_ConfigCoarseDigital(RTC_TypeDef *RTCx, uint32_t Sign, uint32_t Value)
3060
__STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
3060
{
3061
{
3061
  MODIFY_REG(RTCx->CALIBR, RTC_CALIBR_DCS | RTC_CALIBR_DC, Sign | Value);
3062
#if defined(RTC_CR_COSEL)
3062
}
3063
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
3063
 
3064
#else
3064
/**
3065
  return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE));
3065
  * @brief  Get the coarse digital calibration value
3066
#endif /* RTC_CR_COSEL */
3066
  * @rmtoll CALIBR       DC            LL_RTC_CAL_GetCoarseDigitalValue
3067
}
3067
  * @param  RTCx RTC Instance
3068
 
3068
  * @retval value of coarse calibration expressed in ppm (coded on 5 bits)
3069
/**
3069
  */
3070
  * @brief  Enable Coarse digital calibration
3070
__STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalValue(RTC_TypeDef *RTCx)
3071
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3071
{
3072
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3072
  return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DC));
3073
  * @rmtoll CR           DCE           LL_RTC_CAL_EnableCoarseDigital
3073
}
3074
  * @param  RTCx RTC Instance
3074
 
3075
  * @retval None
3075
/**
3076
  */
3076
  * @brief  Get the coarse digital calibration sign
3077
__STATIC_INLINE void LL_RTC_CAL_EnableCoarseDigital(RTC_TypeDef *RTCx)
3077
  * @rmtoll CALIBR       DCS           LL_RTC_CAL_GetCoarseDigitalSign
3078
{
3078
  * @param  RTCx RTC Instance
3079
  SET_BIT(RTCx->CR, RTC_CR_DCE);
3079
  * @retval Returned value can be one of the following values:
3080
}
3080
  *         @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3081
 
3081
  *         @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3082
/**
3082
  */
3083
  * @brief  Disable Coarse digital calibration
3083
__STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalSign(RTC_TypeDef *RTCx)
3084
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3084
{
3085
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3085
  return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DCS));
3086
  * @rmtoll CR           DCE           LL_RTC_CAL_DisableCoarseDigital
3086
}
3087
  * @param  RTCx RTC Instance
3087
 
3088
  * @retval None
3088
#if defined(RTC_SMOOTHCALIB_SUPPORT)
3089
  */
3089
/**
3090
__STATIC_INLINE void LL_RTC_CAL_DisableCoarseDigital(RTC_TypeDef  *RTCx)
3090
  * @brief  Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3091
{
3091
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3092
  CLEAR_BIT(RTCx->CR, RTC_CR_DCE);
3092
  * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3093
}
3093
  * @rmtoll CALR         CALP          LL_RTC_CAL_SetPulse
3094
 
3094
  * @param  RTCx RTC Instance
3095
/**
3095
  * @param  Pulse This parameter can be one of the following values:
3096
  * @brief  Set the coarse digital calibration
3096
  *         @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3097
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3097
  *         @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3098
  * @note   It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
3098
  * @retval None
3099
  * @rmtoll CALIBR       DCS           LL_RTC_CAL_ConfigCoarseDigital\n
3099
  */
3100
  *         CALIBR       DC            LL_RTC_CAL_ConfigCoarseDigital
3100
__STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3101
  * @param  RTCx RTC Instance
3101
{
3102
  * @param  Sign This parameter can be one of the following values:
3102
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3103
  *         @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3103
}
3104
  *         @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3104
 
3105
  * @param  Value value of coarse calibration expressed in ppm (coded on 5 bits)
3105
/**
3106
  * @note   This Calibration value should be between 0 and 63 when using negative sign with a 2-ppm step.
3106
  * @brief  Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3107
  * @note   This Calibration value should be between 0 and 126 when using positive sign with a 4-ppm step.
3107
  * @rmtoll CALR         CALP          LL_RTC_CAL_IsPulseInserted
3108
  * @retval None
3108
  * @param  RTCx RTC Instance
3109
  */
3109
  * @retval State of bit (1 or 0).
3110
__STATIC_INLINE void LL_RTC_CAL_ConfigCoarseDigital(RTC_TypeDef *RTCx, uint32_t Sign, uint32_t Value)
3110
  */
3111
{
3111
__STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
3112
  MODIFY_REG(RTCx->CALIBR, RTC_CALIBR_DCS | RTC_CALIBR_DC, Sign | Value);
3112
{
3113
}
3113
  return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1UL : 0UL);
3114
 
3114
}
3115
/**
3115
 
3116
  * @brief  Get the coarse digital calibration value
3116
/**
3117
  * @rmtoll CALIBR       DC            LL_RTC_CAL_GetCoarseDigitalValue
3117
  * @brief  Set smooth calibration cycle period
3118
  * @param  RTCx RTC Instance
3118
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3119
  * @retval value of coarse calibration expressed in ppm (coded on 5 bits)
3119
  * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3120
  */
3120
  * @rmtoll CALR         CALW8         LL_RTC_CAL_SetPeriod\n
3121
__STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalValue(RTC_TypeDef *RTCx)
3121
  *         CALR         CALW16        LL_RTC_CAL_SetPeriod
3122
{
3122
  * @param  RTCx RTC Instance
3123
  return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DC));
3123
  * @param  Period This parameter can be one of the following values:
3124
}
3124
  *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3125
 
3125
  *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3126
/**
3126
  *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3127
  * @brief  Get the coarse digital calibration sign
3127
  * @retval None
3128
  * @rmtoll CALIBR       DCS           LL_RTC_CAL_GetCoarseDigitalSign
3128
  */
3129
  * @param  RTCx RTC Instance
3129
__STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3130
  * @retval Returned value can be one of the following values:
3130
{
3131
  *         @arg @ref LL_RTC_CALIB_SIGN_POSITIVE
3131
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3132
  *         @arg @ref LL_RTC_CALIB_SIGN_NEGATIVE
3132
}
3133
  */
3133
 
3134
__STATIC_INLINE uint32_t LL_RTC_CAL_GetCoarseDigitalSign(RTC_TypeDef *RTCx)
3134
/**
3135
{
3135
  * @brief  Get smooth calibration cycle period
3136
  return (uint32_t)(READ_BIT(RTCx->CALIBR, RTC_CALIBR_DCS));
3136
  * @rmtoll CALR         CALW8         LL_RTC_CAL_GetPeriod\n
3137
}
3137
  *         CALR         CALW16        LL_RTC_CAL_GetPeriod
3138
 
3138
  * @param  RTCx RTC Instance
3139
#if defined(RTC_SMOOTHCALIB_SUPPORT)
3139
  * @retval Returned value can be one of the following values:
3140
/**
3140
  *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3141
  * @brief  Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
3141
  *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3142
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3142
  *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3143
  * @note Bit can be written only when RECALPF is set to 0 in RTC_ISR
3143
  */
3144
  * @rmtoll CALR         CALP          LL_RTC_CAL_SetPulse
3144
__STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
3145
  * @param  RTCx RTC Instance
3145
{
3146
  * @param  Pulse This parameter can be one of the following values:
3146
  return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3147
  *         @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
3147
}
3148
  *         @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
3148
 
3149
  * @retval None
3149
/**
3150
  */
3150
  * @brief  Set smooth Calibration minus
3151
__STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
3151
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3152
{
3152
  * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3153
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
3153
  * @rmtoll CALR         CALM          LL_RTC_CAL_SetMinus
3154
}
3154
  * @param  RTCx RTC Instance
3155
 
3155
  * @param  CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3156
/**
3156
  * @retval None
3157
  * @brief  Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
3157
  */
3158
  * @rmtoll CALR         CALP          LL_RTC_CAL_IsPulseInserted
3158
__STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3159
  * @param  RTCx RTC Instance
3159
{
3160
  * @retval State of bit (1 or 0).
3160
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3161
  */
3161
}
3162
__STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
3162
 
3163
{
3163
/**
3164
  return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1UL : 0UL);
3164
  * @brief  Get smooth Calibration minus
3165
}
3165
  * @rmtoll CALR         CALM          LL_RTC_CAL_GetMinus
3166
 
3166
  * @param  RTCx RTC Instance
3167
/**
3167
  * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3168
  * @brief  Set the calibration cycle period
3168
  */
3169
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3169
__STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
3170
  * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3170
{
3171
  * @rmtoll CALR         CALW8         LL_RTC_CAL_SetPeriod\n
3171
  return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3172
  *         CALR         CALW16        LL_RTC_CAL_SetPeriod
3172
}
3173
  * @param  RTCx RTC Instance
3173
#endif /* RTC_SMOOTHCALIB_SUPPORT */
3174
  * @param  Period This parameter can be one of the following values:
3174
 
3175
  *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3175
/**
3176
  *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3176
  * @}
3177
  *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3177
  */
3178
  * @retval None
3178
 
3179
  */
3179
/** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3180
__STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
3180
  * @{
3181
{
3181
  */
3182
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
3182
 
3183
}
3183
#if defined(RTC_SMOOTHCALIB_SUPPORT)
3184
 
3184
/**
3185
/**
3185
  * @brief  Get Recalibration pending Flag
3186
  * @brief  Get the calibration cycle period
3186
  * @rmtoll ISR          RECALPF       LL_RTC_IsActiveFlag_RECALP
3187
  * @rmtoll CALR         CALW8         LL_RTC_CAL_GetPeriod\n
3187
  * @param  RTCx RTC Instance
3188
  *         CALR         CALW16        LL_RTC_CAL_GetPeriod
3188
  * @retval State of bit (1 or 0).
3189
  * @param  RTCx RTC Instance
3189
  */
3190
  * @retval Returned value can be one of the following values:
3190
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
3191
  *         @arg @ref LL_RTC_CALIB_PERIOD_32SEC
3191
{
3192
  *         @arg @ref LL_RTC_CALIB_PERIOD_16SEC
3192
  return ((READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)) ? 1UL : 0UL);
3193
  *         @arg @ref LL_RTC_CALIB_PERIOD_8SEC
3193
}
3194
  */
3194
#endif /* RTC_SMOOTHCALIB_SUPPORT */
3195
__STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
3195
 
3196
{
3196
#if defined(RTC_TAMPER3_SUPPORT)
3197
  return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
3197
/**
3198
}
3198
  * @brief  Get RTC_TAMP3 detection flag
3199
 
3199
  * @rmtoll ISR          TAMP3F        LL_RTC_IsActiveFlag_TAMP3
3200
/**
3200
  * @param  RTCx RTC Instance
3201
  * @brief  Set Calibration minus
3201
  * @retval State of bit (1 or 0).
3202
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3202
  */
3203
  * @note   Bit can be written only when RECALPF is set to 0 in RTC_ISR
3203
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
3204
  * @rmtoll CALR         CALM          LL_RTC_CAL_SetMinus
3204
{
3205
  * @param  RTCx RTC Instance
3205
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F)) ? 1UL : 0UL);
3206
  * @param  CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
3206
}
3207
  * @retval None
3207
#endif /* RTC_TAMPER3_SUPPORT */
3208
  */
3208
 
3209
__STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
3209
#if defined(RTC_TAMPER2_SUPPORT)
3210
{
3210
/**
3211
  MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
3211
  * @brief  Get RTC_TAMP2 detection flag
3212
}
3212
  * @rmtoll ISR          TAMP2F        LL_RTC_IsActiveFlag_TAMP2
3213
 
3213
  * @param  RTCx RTC Instance
3214
/**
3214
  * @retval State of bit (1 or 0).
3215
  * @brief  Get Calibration minus
3215
  */
3216
  * @rmtoll CALR         CALM          LL_RTC_CAL_GetMinus
3216
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
3217
  * @param  RTCx RTC Instance
3217
{
3218
  * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
3218
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)) ? 1UL : 0UL);
3219
  */
3219
}
3220
__STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
3220
#endif /* RTC_TAMPER2_SUPPORT */
3221
{
3221
 
3222
  return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
3222
/**
3223
}
3223
  * @brief  Get RTC_TAMP1 detection flag
3224
#endif /* RTC_SMOOTHCALIB_SUPPORT */
3224
  * @rmtoll ISR          TAMP1F        LL_RTC_IsActiveFlag_TAMP1
3225
 
3225
  * @param  RTCx RTC Instance
3226
/**
3226
  * @retval State of bit (1 or 0).
3227
  * @}
3227
  */
3228
  */
3228
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
3229
 
3229
{
3230
/** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
3230
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)) ? 1UL : 0UL);
3231
  * @{
3231
}
3232
  */
3232
 
3233
 
3233
/**
3234
#if defined(RTC_SMOOTHCALIB_SUPPORT)
3234
  * @brief  Get Time-stamp overflow flag
3235
/**
3235
  * @rmtoll ISR          TSOVF         LL_RTC_IsActiveFlag_TSOV
3236
  * @brief  Get Recalibration pending Flag
3236
  * @param  RTCx RTC Instance
3237
  * @rmtoll ISR          RECALPF       LL_RTC_IsActiveFlag_RECALP
3237
  * @retval State of bit (1 or 0).
3238
  * @param  RTCx RTC Instance
3238
  */
3239
  * @retval State of bit (1 or 0).
3239
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
3240
  */
3240
{
3241
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
3241
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)) ? 1UL : 0UL);
3242
{
3242
}
3243
  return ((READ_BIT(RTCx->ISR, RTC_ISR_RECALPF) == (RTC_ISR_RECALPF)) ? 1UL : 0UL);
3243
 
3244
}
3244
/**
3245
#endif /* RTC_SMOOTHCALIB_SUPPORT */
3245
  * @brief  Get Time-stamp flag
3246
 
3246
  * @rmtoll ISR          TSF           LL_RTC_IsActiveFlag_TS
3247
#if defined(RTC_TAMPER3_SUPPORT)
3247
  * @param  RTCx RTC Instance
3248
/**
3248
  * @retval State of bit (1 or 0).
3249
  * @brief  Get RTC_TAMP3 detection flag
3249
  */
3250
  * @rmtoll ISR          TAMP3F        LL_RTC_IsActiveFlag_TAMP3
3250
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
3251
  * @param  RTCx RTC Instance
3251
{
3252
  * @retval State of bit (1 or 0).
3252
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)) ? 1UL : 0UL);
3253
  */
3253
}
3254
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
3254
 
3255
{
3255
/**
3256
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP3F) == (RTC_ISR_TAMP3F)) ? 1UL : 0UL);
3256
  * @brief  Get Wakeup timer flag
3257
}
3257
  * @rmtoll ISR          WUTF          LL_RTC_IsActiveFlag_WUT
3258
#endif /* RTC_TAMPER3_SUPPORT */
3258
  * @param  RTCx RTC Instance
3259
 
3259
  * @retval State of bit (1 or 0).
3260
#if defined(RTC_TAMPER2_SUPPORT)
3260
  */
3261
/**
3261
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
3262
  * @brief  Get RTC_TAMP2 detection flag
3262
{
3263
  * @rmtoll ISR          TAMP2F        LL_RTC_IsActiveFlag_TAMP2
3263
  return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)) ? 1UL : 0UL);
3264
  * @param  RTCx RTC Instance
3264
}
3265
  * @retval State of bit (1 or 0).
3265
 
3266
  */
3266
/**
3267
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
3267
  * @brief  Get Alarm B flag
3268
{
3268
  * @rmtoll ISR          ALRBF         LL_RTC_IsActiveFlag_ALRB
3269
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP2F) == (RTC_ISR_TAMP2F)) ? 1UL : 0UL);
3269
  * @param  RTCx RTC Instance
3270
}
3270
  * @retval State of bit (1 or 0).
3271
#endif /* RTC_TAMPER2_SUPPORT */
3271
  */
3272
 
3272
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
3273
#if defined(RTC_TAMPER1_SUPPORT)
3273
{
3274
/**
3274
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)) ? 1UL : 0UL);
3275
  * @brief  Get RTC_TAMP1 detection flag
3275
}
3276
  * @rmtoll ISR          TAMP1F        LL_RTC_IsActiveFlag_TAMP1
3276
 
3277
  * @param  RTCx RTC Instance
3277
/**
3278
  * @retval State of bit (1 or 0).
3278
  * @brief  Get Alarm A flag
3279
  */
3279
  * @rmtoll ISR          ALRAF         LL_RTC_IsActiveFlag_ALRA
3280
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
3280
  * @param  RTCx RTC Instance
3281
{
3281
  * @retval State of bit (1 or 0).
3282
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TAMP1F) == (RTC_ISR_TAMP1F)) ? 1UL : 0UL);
3282
  */
3283
}
3283
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
3284
#endif /* RTC_TAMPER1_SUPPORT */
3284
{
3285
 
3285
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)) ? 1UL : 0UL);
3286
/**
3286
}
3287
  * @brief  Get Time-stamp overflow flag
3287
 
3288
  * @rmtoll ISR          TSOVF         LL_RTC_IsActiveFlag_TSOV
3288
#if defined(RTC_TAMPER3_SUPPORT)
3289
  * @param  RTCx RTC Instance
3289
/**
3290
  * @retval State of bit (1 or 0).
3290
  * @brief  Clear RTC_TAMP3 detection flag
3291
  */
3291
  * @rmtoll ISR          TAMP3F        LL_RTC_ClearFlag_TAMP3
3292
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
3292
  * @param  RTCx RTC Instance
3293
{
3293
  * @retval None
3294
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TSOVF) == (RTC_ISR_TSOVF)) ? 1UL : 0UL);
3294
  */
3295
}
3295
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
3296
 
3296
{
3297
/**
3297
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3298
  * @brief  Get Time-stamp flag
3298
}
3299
  * @rmtoll ISR          TSF           LL_RTC_IsActiveFlag_TS
3299
#endif /* RTC_TAMPER3_SUPPORT */
3300
  * @param  RTCx RTC Instance
3300
 
3301
  * @retval State of bit (1 or 0).
3301
#if defined(RTC_TAMPER2_SUPPORT)
3302
  */
3302
/**
3303
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
3303
  * @brief  Clear RTC_TAMP2 detection flag
3304
{
3304
  * @rmtoll ISR          TAMP2F        LL_RTC_ClearFlag_TAMP2
3305
  return ((READ_BIT(RTCx->ISR, RTC_ISR_TSF) == (RTC_ISR_TSF)) ? 1UL : 0UL);
3305
  * @param  RTCx RTC Instance
3306
}
3306
  * @retval None
3307
 
3307
  */
3308
#if defined(RTC_WAKEUP_SUPPORT)
3308
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
3309
/**
3309
{
3310
  * @brief  Get Wakeup timer flag
3310
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3311
  * @rmtoll ISR          WUTF          LL_RTC_IsActiveFlag_WUT
3311
}
3312
  * @param  RTCx RTC Instance
3312
#endif /* RTC_TAMPER2_SUPPORT */
3313
  * @retval State of bit (1 or 0).
3313
 
3314
  */
3314
/**
3315
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
3315
  * @brief  Clear RTC_TAMP1 detection flag
3316
{
3316
  * @rmtoll ISR          TAMP1F        LL_RTC_ClearFlag_TAMP1
3317
  return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTF) == (RTC_ISR_WUTF)) ? 1UL : 0UL);
3317
  * @param  RTCx RTC Instance
3318
}
3318
  * @retval None
3319
#endif /* RTC_WAKEUP_SUPPORT */
3319
  */
3320
 
3320
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
3321
/**
3321
{
3322
  * @brief  Get Alarm B flag
3322
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3323
  * @rmtoll ISR          ALRBF         LL_RTC_IsActiveFlag_ALRB
3323
}
3324
  * @param  RTCx RTC Instance
3324
 
3325
  * @retval State of bit (1 or 0).
3325
/**
3326
  */
3326
  * @brief  Clear Time-stamp overflow flag
3327
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
3327
  * @rmtoll ISR          TSOVF         LL_RTC_ClearFlag_TSOV
3328
{
3328
  * @param  RTCx RTC Instance
3329
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBF) == (RTC_ISR_ALRBF)) ? 1UL : 0UL);
3329
  * @retval None
3330
}
3330
  */
3331
 
3331
__STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
3332
/**
3332
{
3333
  * @brief  Get Alarm A flag
3333
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3334
  * @rmtoll ISR          ALRAF         LL_RTC_IsActiveFlag_ALRA
3334
}
3335
  * @param  RTCx RTC Instance
3335
 
3336
  * @retval State of bit (1 or 0).
3336
/**
3337
  */
3337
  * @brief  Clear Time-stamp flag
3338
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
3338
  * @rmtoll ISR          TSF           LL_RTC_ClearFlag_TS
3339
{
3339
  * @param  RTCx RTC Instance
3340
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAF) == (RTC_ISR_ALRAF)) ? 1UL : 0UL);
3340
  * @retval None
3341
 
3341
  */
3342
}
3342
__STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
3343
 
3343
{
3344
#if defined(RTC_TAMPER3_SUPPORT)
3344
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3345
/**
3345
}
3346
  * @brief  Clear RTC_TAMP3 detection flag
3346
 
3347
  * @rmtoll ISR          TAMP3F        LL_RTC_ClearFlag_TAMP3
3347
/**
3348
  * @param  RTCx RTC Instance
3348
  * @brief  Clear Wakeup timer flag
3349
  * @retval None
3349
  * @rmtoll ISR          WUTF          LL_RTC_ClearFlag_WUT
3350
  */
3350
  * @param  RTCx RTC Instance
3351
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
3351
  * @retval None
3352
{
3352
  */
3353
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP3F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3353
__STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
3354
}
3354
{
3355
#endif /* RTC_TAMPER3_SUPPORT */
3355
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3356
 
3356
}
3357
#if defined(RTC_TAMPER2_SUPPORT)
3357
 
3358
/**
3358
/**
3359
  * @brief  Clear RTC_TAMP2 detection flag
3359
  * @brief  Clear Alarm B flag
3360
  * @rmtoll ISR          TAMP2F        LL_RTC_ClearFlag_TAMP2
3360
  * @rmtoll ISR          ALRBF         LL_RTC_ClearFlag_ALRB
3361
  * @param  RTCx RTC Instance
3361
  * @param  RTCx RTC Instance
3362
  * @retval None
3362
  * @retval None
3363
  */
3363
  */
3364
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
3364
__STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
3365
{
3365
{
3366
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP2F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3366
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3367
}
3367
}
3368
#endif /* RTC_TAMPER2_SUPPORT */
3368
 
3369
 
3369
/**
3370
#if defined(RTC_TAMPER1_SUPPORT)
3370
  * @brief  Clear Alarm A flag
3371
/**
3371
  * @rmtoll ISR          ALRAF         LL_RTC_ClearFlag_ALRA
3372
  * @brief  Clear RTC_TAMP1 detection flag
3372
  * @param  RTCx RTC Instance
3373
  * @rmtoll ISR          TAMP1F        LL_RTC_ClearFlag_TAMP1
3373
  * @retval None
3374
  * @param  RTCx RTC Instance
3374
  */
3375
  * @retval None
3375
__STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
3376
  */
3376
{
3377
__STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
3377
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3378
{
3378
}
3379
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TAMP1F | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3379
 
3380
}
3380
/**
3381
#endif /* RTC_TAMPER1_SUPPORT */
3381
  * @brief  Get Initialization flag
3382
 
3382
  * @rmtoll ISR          INITF         LL_RTC_IsActiveFlag_INIT
3383
/**
3383
  * @param  RTCx RTC Instance
3384
  * @brief  Clear Time-stamp overflow flag
3384
  * @retval State of bit (1 or 0).
3385
  * @rmtoll ISR          TSOVF         LL_RTC_ClearFlag_TSOV
3385
  */
3386
  * @param  RTCx RTC Instance
3386
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
3387
  * @retval None
3387
{
3388
  */
3388
  return ((READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)) ? 1UL : 0UL);
3389
__STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
3389
}
3390
{
3390
 
3391
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSOVF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3391
/**
3392
}
3392
  * @brief  Get Registers synchronization flag
3393
 
3393
  * @rmtoll ISR          RSF           LL_RTC_IsActiveFlag_RS
3394
/**
3394
  * @param  RTCx RTC Instance
3395
  * @brief  Clear Time-stamp flag
3395
  * @retval State of bit (1 or 0).
3396
  * @rmtoll ISR          TSF           LL_RTC_ClearFlag_TS
3396
  */
3397
  * @param  RTCx RTC Instance
3397
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
3398
  * @retval None
3398
{
3399
  */
3399
  return ((READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)) ? 1UL : 0UL);
3400
__STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
3400
}
3401
{
3401
 
3402
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_TSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3402
/**
3403
}
3403
  * @brief  Clear Registers synchronization flag
3404
 
3404
  * @rmtoll ISR          RSF           LL_RTC_ClearFlag_RS
3405
#if defined(RTC_WAKEUP_SUPPORT)
3405
  * @param  RTCx RTC Instance
3406
/**
3406
  * @retval None
3407
  * @brief  Clear Wakeup timer flag
3407
  */
3408
  * @rmtoll ISR          WUTF          LL_RTC_ClearFlag_WUT
3408
__STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
3409
  * @param  RTCx RTC Instance
3409
{
3410
  * @retval None
3410
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3411
  */
3411
}
3412
__STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
3412
 
3413
{
3413
/**
3414
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_WUTF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3414
  * @brief  Get Initialization status flag
3415
}
3415
  * @rmtoll ISR          INITS         LL_RTC_IsActiveFlag_INITS
3416
#endif /* RTC_WAKEUP_SUPPORT */
3416
  * @param  RTCx RTC Instance
3417
 
3417
  * @retval State of bit (1 or 0).
3418
/**
3418
  */
3419
  * @brief  Clear Alarm B flag
3419
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
3420
  * @rmtoll ISR          ALRBF         LL_RTC_ClearFlag_ALRB
3420
{
3421
  * @param  RTCx RTC Instance
3421
  return ((READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)) ? 1UL : 0UL);
3422
  * @retval None
3422
}
3423
  */
3423
 
3424
__STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
3424
#if defined(RTC_SUBSECOND_SUPPORT)
3425
{
3425
/**
3426
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRBF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3426
  * @brief  Get Shift operation pending flag
3427
}
3427
  * @rmtoll ISR          SHPF          LL_RTC_IsActiveFlag_SHP
3428
 
3428
  * @param  RTCx RTC Instance
3429
/**
3429
  * @retval State of bit (1 or 0).
3430
  * @brief  Clear Alarm A flag
3430
  */
3431
  * @rmtoll ISR          ALRAF         LL_RTC_ClearFlag_ALRA
3431
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
3432
  * @param  RTCx RTC Instance
3432
{
3433
  * @retval None
3433
  return ((READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)) ? 1UL : 0UL);
3434
  */
3434
}
3435
__STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
3435
#endif /* RTC_SUBSECOND_SUPPORT */
3436
{
3436
 
3437
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_ALRAF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3437
/**
3438
}
3438
  * @brief  Get Wakeup timer write flag
3439
 
3439
  * @rmtoll ISR          WUTWF         LL_RTC_IsActiveFlag_WUTW
3440
/**
3440
  * @param  RTCx RTC Instance
3441
  * @brief  Get Initialization flag
3441
  * @retval State of bit (1 or 0).
3442
  * @rmtoll ISR          INITF         LL_RTC_IsActiveFlag_INIT
3442
  */
3443
  * @param  RTCx RTC Instance
3443
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
3444
  * @retval State of bit (1 or 0).
3444
{
3445
  */
3445
  return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)) ? 1UL : 0UL);
3446
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
3446
}
3447
{
3447
 
3448
  return ((READ_BIT(RTCx->ISR, RTC_ISR_INITF) == (RTC_ISR_INITF)) ? 1UL : 0UL);
3448
/**
3449
}
3449
  * @brief  Get Alarm B write flag
3450
 
3450
  * @rmtoll ISR          ALRBWF        LL_RTC_IsActiveFlag_ALRBW
3451
/**
3451
  * @param  RTCx RTC Instance
3452
  * @brief  Get Registers synchronization flag
3452
  * @retval State of bit (1 or 0).
3453
  * @rmtoll ISR          RSF           LL_RTC_IsActiveFlag_RS
3453
  */
3454
  * @param  RTCx RTC Instance
3454
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
3455
  * @retval State of bit (1 or 0).
3455
{
3456
  */
3456
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)) ? 1UL : 0UL);
3457
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
3457
}
3458
{
3458
 
3459
  return ((READ_BIT(RTCx->ISR, RTC_ISR_RSF) == (RTC_ISR_RSF)) ? 1UL : 0UL);
3459
/**
3460
}
3460
  * @brief  Get Alarm A write flag
3461
 
3461
  * @rmtoll ISR          ALRAWF        LL_RTC_IsActiveFlag_ALRAW
3462
/**
3462
  * @param  RTCx RTC Instance
3463
  * @brief  Clear Registers synchronization flag
3463
  * @retval State of bit (1 or 0).
3464
  * @rmtoll ISR          RSF           LL_RTC_ClearFlag_RS
3464
  */
3465
  * @param  RTCx RTC Instance
3465
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
3466
  * @retval None
3466
{
3467
  */
3467
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)) ? 1UL : 0UL);
3468
__STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
3468
}
3469
{
3469
 
3470
  WRITE_REG(RTCx->ISR, (~((RTC_ISR_RSF | RTC_ISR_INIT) & 0x0000FFFFU) | (RTCx->ISR & RTC_ISR_INIT)));
3470
/**
3471
}
3471
  * @}
3472
 
3472
  */
3473
/**
3473
 
3474
  * @brief  Get Initialization status flag
3474
/** @defgroup RTC_LL_EF_IT_Management IT_Management
3475
  * @rmtoll ISR          INITS         LL_RTC_IsActiveFlag_INITS
3475
  * @{
3476
  * @param  RTCx RTC Instance
3476
  */
3477
  * @retval State of bit (1 or 0).
3477
 
3478
  */
3478
/**
3479
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
3479
  * @brief  Enable Time-stamp interrupt
3480
{
3480
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3481
  return ((READ_BIT(RTCx->ISR, RTC_ISR_INITS) == (RTC_ISR_INITS)) ? 1UL : 0UL);
3481
  * @rmtoll CR           TSIE          LL_RTC_EnableIT_TS
3482
}
3482
  * @param  RTCx RTC Instance
3483
 
3483
  * @retval None
3484
#if defined(RTC_ISR_SHPF)
3484
  */
3485
/**
3485
__STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
3486
  * @brief  Get Shift operation pending flag
3486
{
3487
  * @rmtoll ISR          SHPF          LL_RTC_IsActiveFlag_SHP
3487
  SET_BIT(RTCx->CR, RTC_CR_TSIE);
3488
  * @param  RTCx RTC Instance
3488
}
3489
  * @retval State of bit (1 or 0).
3489
 
3490
  */
3490
/**
3491
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
3491
  * @brief  Disable Time-stamp interrupt
3492
{
3492
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3493
  return ((READ_BIT(RTCx->ISR, RTC_ISR_SHPF) == (RTC_ISR_SHPF)) ? 1UL : 0UL);
3493
  * @rmtoll CR           TSIE          LL_RTC_DisableIT_TS
3494
}
3494
  * @param  RTCx RTC Instance
3495
#endif /* RTC_ISR_SHPF */
3495
  * @retval None
3496
 
3496
  */
3497
#if defined(RTC_WAKEUP_SUPPORT)
3497
__STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
3498
/**
3498
{
3499
  * @brief  Get Wakeup timer write flag
3499
  CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
3500
  * @rmtoll ISR          WUTWF         LL_RTC_IsActiveFlag_WUTW
3500
}
3501
  * @param  RTCx RTC Instance
3501
 
3502
  * @retval State of bit (1 or 0).
3502
/**
3503
  */
3503
  * @brief  Enable Wakeup timer interrupt
3504
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
3504
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3505
{
3505
  * @rmtoll CR           WUTIE         LL_RTC_EnableIT_WUT
3506
  return ((READ_BIT(RTCx->ISR, RTC_ISR_WUTWF) == (RTC_ISR_WUTWF)) ? 1UL : 0UL);
3506
  * @param  RTCx RTC Instance
3507
}
3507
  * @retval None
3508
#endif /* RTC_WAKEUP_SUPPORT */
3508
  */
3509
 
3509
__STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
3510
/**
3510
{
3511
  * @brief  Get Alarm B write flag
3511
  SET_BIT(RTCx->CR, RTC_CR_WUTIE);
3512
  * @rmtoll ISR          ALRBWF        LL_RTC_IsActiveFlag_ALRBW
3512
}
3513
  * @param  RTCx RTC Instance
3513
 
3514
  * @retval State of bit (1 or 0).
3514
/**
3515
  */
3515
  * @brief  Disable Wakeup timer interrupt
3516
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
3516
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3517
{
3517
  * @rmtoll CR           WUTIE         LL_RTC_DisableIT_WUT
3518
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRBWF) == (RTC_ISR_ALRBWF)) ? 1UL : 0UL);
3518
  * @param  RTCx RTC Instance
3519
}
3519
  * @retval None
3520
 
3520
  */
3521
/**
3521
__STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
3522
  * @brief  Get Alarm A write flag
3522
{
3523
  * @rmtoll ISR          ALRAWF        LL_RTC_IsActiveFlag_ALRAW
3523
  CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
3524
  * @param  RTCx RTC Instance
3524
}
3525
  * @retval State of bit (1 or 0).
3525
 
3526
  */
3526
/**
3527
__STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
3527
  * @brief  Enable Alarm B interrupt
3528
{
3528
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3529
  return ((READ_BIT(RTCx->ISR, RTC_ISR_ALRAWF) == (RTC_ISR_ALRAWF)) ? 1UL : 0UL);
3529
  * @rmtoll CR           ALRBIE        LL_RTC_EnableIT_ALRB
3530
}
3530
  * @param  RTCx RTC Instance
3531
 
3531
  * @retval None
3532
/**
3532
  */
3533
  * @}
3533
__STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
3534
  */
3534
{
3535
 
3535
  SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
3536
/** @defgroup RTC_LL_EF_IT_Management IT_Management
3536
}
3537
  * @{
3537
 
3538
  */
3538
/**
3539
 
3539
  * @brief  Disable Alarm B interrupt
3540
/**
3540
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3541
  * @brief  Enable Time-stamp interrupt
3541
  * @rmtoll CR           ALRBIE        LL_RTC_DisableIT_ALRB
3542
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3542
  * @param  RTCx RTC Instance
3543
  * @rmtoll CR           TSIE          LL_RTC_EnableIT_TS
3543
  * @retval None
3544
  * @param  RTCx RTC Instance
3544
  */
3545
  * @retval None
3545
__STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
3546
  */
3546
{
3547
__STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
3547
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
3548
{
3548
}
3549
  SET_BIT(RTCx->CR, RTC_CR_TSIE);
3549
 
3550
}
3550
/**
3551
 
3551
  * @brief  Enable Alarm A interrupt
3552
/**
3552
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3553
  * @brief  Disable Time-stamp interrupt
3553
  * @rmtoll CR           ALRAIE        LL_RTC_EnableIT_ALRA
3554
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3554
  * @param  RTCx RTC Instance
3555
  * @rmtoll CR           TSIE          LL_RTC_DisableIT_TS
3555
  * @retval None
3556
  * @param  RTCx RTC Instance
3556
  */
3557
  * @retval None
3557
__STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
3558
  */
3558
{
3559
__STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
3559
  SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
3560
{
3560
}
3561
  CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
3561
 
3562
}
3562
/**
3563
 
3563
  * @brief  Disable Alarm A interrupt
3564
#if defined(RTC_WAKEUP_SUPPORT)
3564
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3565
/**
3565
  * @rmtoll CR           ALRAIE        LL_RTC_DisableIT_ALRA
3566
  * @brief  Enable Wakeup timer interrupt
3566
  * @param  RTCx RTC Instance
3567
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3567
  * @retval None
3568
  * @rmtoll CR           WUTIE         LL_RTC_EnableIT_WUT
3568
  */
3569
  * @param  RTCx RTC Instance
3569
__STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
3570
  * @retval None
3570
{
3571
  */
3571
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
3572
__STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
3572
}
3573
{
3573
 
3574
  SET_BIT(RTCx->CR, RTC_CR_WUTIE);
3574
/**
3575
}
3575
  * @brief  Enable all Tamper Interrupt
3576
 
3576
  * @rmtoll TAFCR       TAMPIE        LL_RTC_EnableIT_TAMP
3577
/**
3577
  * @param  RTCx RTC Instance
3578
  * @brief  Disable Wakeup timer interrupt
3578
  * @retval None
3579
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3579
  */
3580
  * @rmtoll CR           WUTIE         LL_RTC_DisableIT_WUT
3580
__STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
3581
  * @param  RTCx RTC Instance
3581
{
3582
  * @retval None
3582
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3583
  */
3583
}
3584
__STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
3584
 
3585
{
3585
/**
3586
  CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
3586
  * @brief  Disable all Tamper Interrupt
3587
}
3587
  * @rmtoll TAFCR       TAMPIE        LL_RTC_DisableIT_TAMP
3588
#endif /* RTC_WAKEUP_SUPPORT */
3588
  * @param  RTCx RTC Instance
3589
 
3589
  * @retval None
3590
/**
3590
  */
3591
  * @brief  Enable Alarm B interrupt
3591
__STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
3592
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3592
{
3593
  * @rmtoll CR           ALRBIE        LL_RTC_EnableIT_ALRB
3593
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3594
  * @param  RTCx RTC Instance
3594
}
3595
  * @retval None
3595
 
3596
  */
3596
/**
3597
__STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
3597
  * @brief  Check if  Time-stamp interrupt is enabled or not
3598
{
3598
  * @rmtoll CR           TSIE          LL_RTC_IsEnabledIT_TS
3599
  SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
3599
  * @param  RTCx RTC Instance
3600
}
3600
  * @retval State of bit (1 or 0).
3601
 
3601
  */
3602
/**
3602
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
3603
  * @brief  Disable Alarm B interrupt
3603
{
3604
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3604
  return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1UL : 0UL);
3605
  * @rmtoll CR           ALRBIE        LL_RTC_DisableIT_ALRB
3605
}
3606
  * @param  RTCx RTC Instance
3606
 
3607
  * @retval None
3607
/**
3608
  */
3608
  * @brief  Check if  Wakeup timer interrupt is enabled or not
3609
__STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
3609
  * @rmtoll CR           WUTIE         LL_RTC_IsEnabledIT_WUT
3610
{
3610
  * @param  RTCx RTC Instance
3611
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
3611
  * @retval State of bit (1 or 0).
3612
}
3612
  */
3613
 
3613
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
3614
/**
3614
{
3615
  * @brief  Enable Alarm A interrupt
3615
  return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1UL : 0UL);
3616
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3616
}
3617
  * @rmtoll CR           ALRAIE        LL_RTC_EnableIT_ALRA
3617
 
3618
  * @param  RTCx RTC Instance
3618
/**
3619
  * @retval None
3619
  * @brief  Check if  Alarm B interrupt is enabled or not
3620
  */
3620
  * @rmtoll CR           ALRBIE        LL_RTC_IsEnabledIT_ALRB
3621
__STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
3621
  * @param  RTCx RTC Instance
3622
{
3622
  * @retval State of bit (1 or 0).
3623
  SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
3623
  */
3624
}
3624
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
3625
 
3625
{
3626
/**
3626
  return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1UL : 0UL);
3627
  * @brief  Disable Alarm A interrupt
3627
}
3628
  * @note   Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
3628
 
3629
  * @rmtoll CR           ALRAIE        LL_RTC_DisableIT_ALRA
3629
/**
3630
  * @param  RTCx RTC Instance
3630
  * @brief  Check if  Alarm A interrupt is enabled or not
3631
  * @retval None
3631
  * @rmtoll CR           ALRAIE        LL_RTC_IsEnabledIT_ALRA
3632
  */
3632
  * @param  RTCx RTC Instance
3633
__STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
3633
  * @retval State of bit (1 or 0).
3634
{
3634
  */
3635
  CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
3635
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
3636
}
3636
{
3637
 
3637
  return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1UL : 0UL);
3638
/**
3638
}
3639
  * @brief  Enable all Tamper Interrupt
3639
 
3640
  * @rmtoll TAFCR       TAMPIE        LL_RTC_EnableIT_TAMP
3640
/**
3641
  * @param  RTCx RTC Instance
3641
  * @brief  Check if all the TAMPER interrupts are enabled or not
3642
  * @retval None
3642
  * @rmtoll TAFCR       TAMPIE        LL_RTC_IsEnabledIT_TAMP
3643
  */
3643
  * @param  RTCx RTC Instance
3644
__STATIC_INLINE void LL_RTC_EnableIT_TAMP(RTC_TypeDef *RTCx)
3644
  * @retval State of bit (1 or 0).
3645
{
3645
  */
3646
  SET_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3646
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
3647
}
3647
{
3648
 
3648
  return ((READ_BIT(RTCx->TAFCR,
3649
/**
3649
                    RTC_TAFCR_TAMPIE) == (RTC_TAFCR_TAMPIE)) ? 1UL : 0UL);
3650
  * @brief  Disable all Tamper Interrupt
3650
}
3651
  * @rmtoll TAFCR       TAMPIE        LL_RTC_DisableIT_TAMP
3651
 
3652
  * @param  RTCx RTC Instance
3652
/**
3653
  * @retval None
3653
  * @}
3654
  */
3654
  */
3655
__STATIC_INLINE void LL_RTC_DisableIT_TAMP(RTC_TypeDef *RTCx)
3655
 
3656
{
3656
#if defined(USE_FULL_LL_DRIVER)
3657
  CLEAR_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE);
3657
/** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
3658
}
3658
  * @{
3659
 
3659
  */
3660
/**
3660
 
3661
  * @brief  Check if  Time-stamp interrupt is enabled or not
3661
ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
3662
  * @rmtoll CR           TSIE          LL_RTC_IsEnabledIT_TS
3662
ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
3663
  * @param  RTCx RTC Instance
3663
void        LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
3664
  * @retval State of bit (1 or 0).
3664
ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
3665
  */
3665
void        LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
3666
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
3666
ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
3667
{
3667
void        LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
3668
  return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1UL : 0UL);
3668
ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3669
}
3669
ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3670
 
3670
void        LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3671
#if defined(RTC_WAKEUP_SUPPORT)
3671
void        LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
3672
/**
3672
ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
3673
  * @brief  Check if  Wakeup timer interrupt is enabled or not
3673
ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
3674
  * @rmtoll CR           WUTIE         LL_RTC_IsEnabledIT_WUT
3674
ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
3675
  * @param  RTCx RTC Instance
3675
 
3676
  * @retval State of bit (1 or 0).
3676
/**
3677
  */
3677
  * @}
3678
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
3678
  */
3679
{
3679
#endif /* USE_FULL_LL_DRIVER */
3680
  return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1UL : 0UL);
3680
 
3681
}
3681
/**
3682
#endif /* RTC_WAKEUP_SUPPORT */
3682
  * @}
3683
 
3683
  */
3684
/**
3684
 
3685
  * @brief  Check if  Alarm B interrupt is enabled or not
3685
/**
3686
  * @rmtoll CR           ALRBIE        LL_RTC_IsEnabledIT_ALRB
3686
  * @}
3687
  * @param  RTCx RTC Instance
3687
  */
3688
  * @retval State of bit (1 or 0).
3688
 
3689
  */
3689
#endif /* defined(RTC) */
3690
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
3690
 
3691
{
3691
/**
3692
  return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1UL : 0UL);
3692
  * @}
3693
}
3693
  */
3694
 
3694
 
3695
/**
3695
#ifdef __cplusplus
3696
  * @brief  Check if  Alarm A interrupt is enabled or not
3696
}
3697
  * @rmtoll CR           ALRAIE        LL_RTC_IsEnabledIT_ALRA
3697
#endif
3698
  * @param  RTCx RTC Instance
3698
 
3699
  * @retval State of bit (1 or 0).
3699
#endif /* STM32L1xx_LL_RTC_H */
3700
  */
-
 
3701
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
-
 
3702
{
-
 
3703
  return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1UL : 0UL);
-
 
3704
 
-
 
3705
}
-
 
3706
 
-
 
3707
/**
-
 
3708
  * @brief  Check if all the TAMPER interrupts are enabled or not
-
 
3709
  * @rmtoll TAFCR       TAMPIE        LL_RTC_IsEnabledIT_TAMP
-
 
3710
  * @param  RTCx RTC Instance
-
 
3711
  * @retval State of bit (1 or 0).
-
 
3712
  */
-
 
3713
__STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP(RTC_TypeDef *RTCx)
-
 
3714
{
-
 
3715
  return ((READ_BIT(RTCx->TAFCR, RTC_TAFCR_TAMPIE) == (RTC_TAFCR_TAMPIE)) ? 1UL : 0UL);
-
 
3716
}
-
 
3717
 
-
 
3718
/**
-
 
3719
  * @}
-
 
3720
  */
-
 
3721
 
-
 
3722
#if defined(USE_FULL_LL_DRIVER)
-
 
3723
/** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
-
 
3724
  * @{
-
 
3725
  */
-
 
3726
 
-
 
3727
ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
-
 
3728
ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
-
 
3729
void        LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
-
 
3730
ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
-
 
3731
void        LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
-
 
3732
ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
-
 
3733
void        LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
-
 
3734
ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
-
 
3735
ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
-
 
3736
void        LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
-
 
3737
void        LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
-
 
3738
ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
-
 
3739
ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
-
 
3740
ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
-
 
3741
 
-
 
3742
/**
-
 
3743
  * @}
-
 
3744
  */
-
 
3745
#endif /* USE_FULL_LL_DRIVER */
-
 
3746
 
-
 
3747
/**
-
 
3748
  * @}
-
 
3749
  */
-
 
3750
 
-
 
3751
/**
-
 
3752
  * @}
-
 
3753
  */
-
 
3754
 
-
 
3755
#endif /* defined(RTC) */
-
 
3756
 
-
 
3757
/**
-
 
3758
  * @}
-
 
3759
  */
-
 
3760
 
-
 
3761
#ifdef __cplusplus
-
 
3762
}
-
 
3763
#endif
-
 
3764
 
-
 
3765
#endif /* __STM32L1xx_LL_RTC_H */
-
 
3766
 
-
 
3767
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-