The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Release 145 of the mbed library.

Who changed what in which revision?

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