mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

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