Aditya Mehrotra / mbed-dev

Dependents:   CAN_TEST SPIne_Plus_DYNO_SENSORS SPIne_Plus_v2 SPIne_Plus_Dyno_v2

Committer:
saloutos
Date:
Thu Nov 26 04:08:56 2020 +0000
Revision:
0:083111ae2a11
first commit of leaned mbed dev lib

Who changed what in which revision?

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