You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3879 lines
143 KiB

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