stm32f7xx_hal_rtc_ex.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_rtc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RTC HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F7xx_HAL_RTC_EX_H
  37. #define __STM32F7xx_HAL_RTC_EX_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f7xx_hal_def.h"
  43. /** @addtogroup STM32F7xx_HAL_Driver
  44. * @{
  45. */
  46. /** @addtogroup RTCEx
  47. * @{
  48. */
  49. /* Exported types ------------------------------------------------------------*/
  50. /** @defgroup RTCEx_Exported_Types RTCEx Exported Types
  51. * @{
  52. */
  53. /**
  54. * @brief RTC Tamper structure definition
  55. */
  56. typedef struct
  57. {
  58. uint32_t Tamper; /*!< Specifies the Tamper Pin.
  59. This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */
  60. uint32_t Interrupt; /*!< Specifies the Tamper Interrupt.
  61. This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */
  62. uint32_t Trigger; /*!< Specifies the Tamper Trigger.
  63. This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */
  64. uint32_t NoErase; /*!< Specifies the Tamper no erase mode.
  65. This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */
  66. uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking.
  67. This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */
  68. uint32_t Filter; /*!< Specifies the RTC Filter Tamper.
  69. This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */
  70. uint32_t SamplingFrequency; /*!< Specifies the sampling frequency.
  71. This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */
  72. uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration .
  73. This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */
  74. uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp .
  75. This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */
  76. uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection.
  77. This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */
  78. }RTC_TamperTypeDef;
  79. /**
  80. * @}
  81. */
  82. /* Exported constants --------------------------------------------------------*/
  83. /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants
  84. * @{
  85. */
  86. /** @defgroup RTCEx_Output_selection_Definitions RTCEx Output selection Definitions
  87. * @{
  88. */
  89. #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000U)
  90. #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000U)
  91. #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000U)
  92. #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000U)
  93. /**
  94. * @}
  95. */
  96. /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions
  97. * @{
  98. */
  99. #define RTC_BKP_DR0 ((uint32_t)0x00000000U)
  100. #define RTC_BKP_DR1 ((uint32_t)0x00000001U)
  101. #define RTC_BKP_DR2 ((uint32_t)0x00000002U)
  102. #define RTC_BKP_DR3 ((uint32_t)0x00000003U)
  103. #define RTC_BKP_DR4 ((uint32_t)0x00000004U)
  104. #define RTC_BKP_DR5 ((uint32_t)0x00000005U)
  105. #define RTC_BKP_DR6 ((uint32_t)0x00000006U)
  106. #define RTC_BKP_DR7 ((uint32_t)0x00000007U)
  107. #define RTC_BKP_DR8 ((uint32_t)0x00000008U)
  108. #define RTC_BKP_DR9 ((uint32_t)0x00000009U)
  109. #define RTC_BKP_DR10 ((uint32_t)0x0000000AU)
  110. #define RTC_BKP_DR11 ((uint32_t)0x0000000BU)
  111. #define RTC_BKP_DR12 ((uint32_t)0x0000000CU)
  112. #define RTC_BKP_DR13 ((uint32_t)0x0000000DU)
  113. #define RTC_BKP_DR14 ((uint32_t)0x0000000EU)
  114. #define RTC_BKP_DR15 ((uint32_t)0x0000000FU)
  115. #define RTC_BKP_DR16 ((uint32_t)0x00000010U)
  116. #define RTC_BKP_DR17 ((uint32_t)0x00000011U)
  117. #define RTC_BKP_DR18 ((uint32_t)0x00000012U)
  118. #define RTC_BKP_DR19 ((uint32_t)0x00000013U)
  119. #define RTC_BKP_DR20 ((uint32_t)0x00000014U)
  120. #define RTC_BKP_DR21 ((uint32_t)0x00000015U)
  121. #define RTC_BKP_DR22 ((uint32_t)0x00000016U)
  122. #define RTC_BKP_DR23 ((uint32_t)0x00000017U)
  123. #define RTC_BKP_DR24 ((uint32_t)0x00000018U)
  124. #define RTC_BKP_DR25 ((uint32_t)0x00000019U)
  125. #define RTC_BKP_DR26 ((uint32_t)0x0000001AU)
  126. #define RTC_BKP_DR27 ((uint32_t)0x0000001BU)
  127. #define RTC_BKP_DR28 ((uint32_t)0x0000001CU)
  128. #define RTC_BKP_DR29 ((uint32_t)0x0000001DU)
  129. #define RTC_BKP_DR30 ((uint32_t)0x0000001EU)
  130. #define RTC_BKP_DR31 ((uint32_t)0x0000001FU)
  131. /**
  132. * @}
  133. */
  134. /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definitions
  135. * @{
  136. */
  137. #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000U)
  138. #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008U)
  139. /**
  140. * @}
  141. */
  142. /** @defgroup RTCEx_Tamper_Pins_Definitions RTCEx Tamper Pins Definitions
  143. * @{
  144. */
  145. #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E
  146. #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E
  147. #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E
  148. /**
  149. * @}
  150. */
  151. /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTCEx Tamper Interrupt Definitions
  152. * @{
  153. */
  154. #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE
  155. #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE
  156. #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE
  157. #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE
  158. /**
  159. * @}
  160. */
  161. /** @defgroup RTCEx_TimeStamp_Pin_Selection RTCEx TimeStamp Pin Selection
  162. * @{
  163. */
  164. #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000U)
  165. #define RTC_TIMESTAMPPIN_POS1 ((uint32_t)0x00000002U)
  166. #define RTC_TIMESTAMPPIN_POS2 ((uint32_t)0x00000004U)
  167. /**
  168. * @}
  169. */
  170. /** @defgroup RTCEx_Tamper_Trigger_Definitions RTCEx Tamper Trigger Definitions
  171. * @{
  172. */
  173. #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000U)
  174. #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002U)
  175. #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE
  176. #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE
  177. /**
  178. * @}
  179. */
  180. /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTCEx Tamper EraseBackUp Definitions
  181. * @{
  182. */
  183. #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000U)
  184. #define RTC_TAMPER_ERASE_BACKUP_DISABLE ((uint32_t)0x00020000U)
  185. /**
  186. * @}
  187. */
  188. /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTCEx Tamper MaskFlag Definitions
  189. * @{
  190. */
  191. #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000U)
  192. #define RTC_TAMPERMASK_FLAG_ENABLE ((uint32_t)0x00040000U)
  193. /**
  194. * @}
  195. */
  196. /** @defgroup RTCEx_Tamper_Filter_Definitions RTCEx Tamper Filter Definitions
  197. * @{
  198. */
  199. #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000U) /*!< Tamper filter is disabled */
  200. #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800U) /*!< Tamper is activated after 2
  201. consecutive samples at the active level */
  202. #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000U) /*!< Tamper is activated after 4
  203. consecutive samples at the active level */
  204. #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800U) /*!< Tamper is activated after 8
  205. consecutive samples at the active leve. */
  206. /**
  207. * @}
  208. */
  209. /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definitions
  210. * @{
  211. */
  212. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000U) /*!< Each of the tamper inputs are sampled
  213. with a frequency = RTCCLK / 32768 */
  214. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100U) /*!< Each of the tamper inputs are sampled
  215. with a frequency = RTCCLK / 16384 */
  216. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200U) /*!< Each of the tamper inputs are sampled
  217. with a frequency = RTCCLK / 8192 */
  218. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300U) /*!< Each of the tamper inputs are sampled
  219. with a frequency = RTCCLK / 4096 */
  220. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400U) /*!< Each of the tamper inputs are sampled
  221. with a frequency = RTCCLK / 2048 */
  222. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500U) /*!< Each of the tamper inputs are sampled
  223. with a frequency = RTCCLK / 1024 */
  224. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600U) /*!< Each of the tamper inputs are sampled
  225. with a frequency = RTCCLK / 512 */
  226. #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700U) /*!< Each of the tamper inputs are sampled
  227. with a frequency = RTCCLK / 256 */
  228. /**
  229. * @}
  230. */
  231. /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definitions
  232. * @{
  233. */
  234. #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000U) /*!< Tamper pins are pre-charged before
  235. sampling during 1 RTCCLK cycle */
  236. #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000U) /*!< Tamper pins are pre-charged before
  237. sampling during 2 RTCCLK cycles */
  238. #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000U) /*!< Tamper pins are pre-charged before
  239. sampling during 4 RTCCLK cycles */
  240. #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000U) /*!< Tamper pins are pre-charged before
  241. sampling during 8 RTCCLK cycles */
  242. /**
  243. * @}
  244. */
  245. /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTCEx Tamper TimeStampOnTamperDetection Definitions
  246. * @{
  247. */
  248. #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAMPCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */
  249. #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000U) /*!< TimeStamp on Tamper Detection event is not saved */
  250. /**
  251. * @}
  252. */
  253. /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTCEx Tamper Pull UP Definitions
  254. * @{
  255. */
  256. #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000U) /*!< TimeStamp on Tamper Detection event saved */
  257. #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAMPCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */
  258. /**
  259. * @}
  260. */
  261. /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions
  262. * @{
  263. */
  264. #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000U)
  265. #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001U)
  266. #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002U)
  267. #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003U)
  268. #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004U)
  269. #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006U)
  270. /**
  271. * @}
  272. */
  273. /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definitions
  274. * @{
  275. */
  276. #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
  277. period is 32s, else 2exp20 RTCCLK seconds */
  278. #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
  279. period is 16s, else 2exp19 RTCCLK seconds */
  280. #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000U) /*!< If RTCCLK = 32768 Hz, Smooth calibration
  281. period is 8s, else 2exp18 RTCCLK seconds */
  282. /**
  283. * @}
  284. */
  285. /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions
  286. * @{
  287. */
  288. #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000U) /*!< The number of RTCCLK pulses added
  289. during a X -second window = Y - CALM[8:0]
  290. with Y = 512, 256, 128 when X = 32, 16, 8 */
  291. #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000U) /*!< The number of RTCCLK pulses subbstited
  292. during a 32-second window = CALM[8:0] */
  293. /**
  294. * @}
  295. */
  296. /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTCEx Add 1 Second Parameter Definitions
  297. * @{
  298. */
  299. #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000U)
  300. #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000U)
  301. /**
  302. * @}
  303. */
  304. /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output selection Definitions
  305. * @{
  306. */
  307. #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000U)
  308. #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000U)
  309. /**
  310. * @}
  311. */
  312. /**
  313. * @}
  314. */
  315. /* Exported macros -----------------------------------------------------------*/
  316. /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
  317. * @{
  318. */
  319. /**
  320. * @brief Enable the RTC WakeUp Timer peripheral.
  321. * @param __HANDLE__ specifies the RTC handle.
  322. * @retval None
  323. */
  324. #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
  325. /**
  326. * @brief Disable the RTC WakeUp Timer peripheral.
  327. * @param __HANDLE__ specifies the RTC handle.
  328. * @retval None
  329. */
  330. #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
  331. /**
  332. * @brief Enable the RTC WakeUpTimer interrupt.
  333. * @param __HANDLE__ specifies the RTC handle.
  334. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
  335. * This parameter can be:
  336. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  337. * @retval None
  338. */
  339. #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  340. /**
  341. * @brief Disable the RTC WakeUpTimer interrupt.
  342. * @param __HANDLE__ specifies the RTC handle.
  343. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled or disabled.
  344. * This parameter can be:
  345. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  346. * @retval None
  347. */
  348. #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  349. /**
  350. * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
  351. * @param __HANDLE__ specifies the RTC handle.
  352. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to check.
  353. * This parameter can be:
  354. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  355. * @retval None
  356. */
  357. #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET)
  358. /**
  359. * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
  360. * @param __HANDLE__ specifies the RTC handle.
  361. * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check.
  362. * This parameter can be:
  363. * @arg RTC_IT_WUT: WakeUpTimer interrupt
  364. * @retval None
  365. */
  366. #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
  367. /**
  368. * @brief Get the selected RTC WakeUpTimer's flag status.
  369. * @param __HANDLE__ specifies the RTC handle.
  370. * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not.
  371. * This parameter can be:
  372. * @arg RTC_FLAG_WUTF
  373. * @arg RTC_FLAG_WUTWF
  374. * @retval None
  375. */
  376. #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
  377. /**
  378. * @brief Clear the RTC Wake Up timer's pending flags.
  379. * @param __HANDLE__ specifies the RTC handle.
  380. * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear.
  381. * This parameter can be:
  382. * @arg RTC_FLAG_WUTF
  383. * @retval None
  384. */
  385. #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  386. /**
  387. * @brief Enable the RTC Tamper1 input detection.
  388. * @param __HANDLE__ specifies the RTC handle.
  389. * @retval None
  390. */
  391. #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E))
  392. /**
  393. * @brief Disable the RTC Tamper1 input detection.
  394. * @param __HANDLE__ specifies the RTC handle.
  395. * @retval None
  396. */
  397. #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E))
  398. /**
  399. * @brief Enable the RTC Tamper2 input detection.
  400. * @param __HANDLE__ specifies the RTC handle.
  401. * @retval None
  402. */
  403. #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E))
  404. /**
  405. * @brief Disable the RTC Tamper2 input detection.
  406. * @param __HANDLE__ specifies the RTC handle.
  407. * @retval None
  408. */
  409. #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E))
  410. /**
  411. * @brief Enable the RTC Tamper3 input detection.
  412. * @param __HANDLE__ specifies the RTC handle.
  413. * @retval None
  414. */
  415. #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E))
  416. /**
  417. * @brief Disable the RTC Tamper3 input detection.
  418. * @param __HANDLE__ specifies the RTC handle.
  419. * @retval None
  420. */
  421. #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E))
  422. /**
  423. * @brief Check whether the specified RTC Tamper interrupt has occurred or not.
  424. * @param __HANDLE__ specifies the RTC handle.
  425. * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check.
  426. * This parameter can be:
  427. * @arg RTC_IT_TAMP: All tampers interrupts
  428. * @arg RTC_IT_TAMP1: Tamper1 interrupt
  429. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  430. * @arg RTC_IT_TAMP3: Tamper3 interrupt
  431. * @retval None
  432. */
  433. #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 3)) != RESET) ? SET : RESET) : \
  434. ((__INTERRUPT__) == RTC_IT_TAMP2) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 5)) != RESET) ? SET : RESET) : \
  435. (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 7)) != RESET) ? SET : RESET))
  436. /**
  437. * @brief Check whether the specified RTC Tamper interrupt has been enabled or not.
  438. * @param __HANDLE__ specifies the RTC handle.
  439. * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check.
  440. * This parameter can be:
  441. * @arg RTC_IT_TAMP: All tampers interrupts
  442. * @arg RTC_IT_TAMP1: Tamper1 interrupt
  443. * @arg RTC_IT_TAMP2: Tamper2 interrupt
  444. * @arg RTC_IT_TAMP3: Tamper3 interrupt
  445. * @retval None
  446. */
  447. #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
  448. /**
  449. * @brief Get the selected RTC Tamper's flag status.
  450. * @param __HANDLE__ specifies the RTC handle.
  451. * @param __FLAG__ specifies the RTC Tamper Flag is pending or not.
  452. * This parameter can be:
  453. * @arg RTC_FLAG_TAMP1F: Tamper1 flag
  454. * @arg RTC_FLAG_TAMP2F: Tamper2 flag
  455. * @arg RTC_FLAG_TAMP3F: Tamper3 flag
  456. * @retval None
  457. */
  458. #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
  459. /**
  460. * @brief Clear the RTC Tamper's pending flags.
  461. * @param __HANDLE__ specifies the RTC handle.
  462. * @param __FLAG__ specifies the RTC Tamper Flag sources to clear.
  463. * This parameter can be:
  464. * @arg RTC_FLAG_TAMP1F: Tamper1 flag
  465. * @arg RTC_FLAG_TAMP2F: Tamper2 flag
  466. * @arg RTC_FLAG_TAMP3F: Tamper3 flag
  467. * @retval None
  468. */
  469. #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  470. /**
  471. * @brief Enable the RTC TimeStamp peripheral.
  472. * @param __HANDLE__ specifies the RTC handle.
  473. * @retval None
  474. */
  475. #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
  476. /**
  477. * @brief Disable the RTC TimeStamp peripheral.
  478. * @param __HANDLE__ specifies the RTC handle.
  479. * @retval None
  480. */
  481. #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE))
  482. /**
  483. * @brief Enable the RTC TimeStamp interrupt.
  484. * @param __HANDLE__ specifies the RTC handle.
  485. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
  486. * This parameter can be:
  487. * @arg RTC_IT_TS: TimeStamp interrupt
  488. * @retval None
  489. */
  490. #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
  491. /**
  492. * @brief Disable the RTC TimeStamp interrupt.
  493. * @param __HANDLE__ specifies the RTC handle.
  494. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to be enabled or disabled.
  495. * This parameter can be:
  496. * @arg RTC_IT_TS: TimeStamp interrupt
  497. * @retval None
  498. */
  499. #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
  500. /**
  501. * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
  502. * @param __HANDLE__ specifies the RTC handle.
  503. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt sources to check.
  504. * This parameter can be:
  505. * @arg RTC_IT_TS: TimeStamp interrupt
  506. * @retval None
  507. */
  508. #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET)
  509. /**
  510. * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not.
  511. * @param __HANDLE__ specifies the RTC handle.
  512. * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check.
  513. * This parameter can be:
  514. * @arg RTC_IT_TS: TimeStamp interrupt
  515. * @retval None
  516. */
  517. #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
  518. /**
  519. * @brief Get the selected RTC TimeStamp's flag status.
  520. * @param __HANDLE__ specifies the RTC handle.
  521. * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not.
  522. * This parameter can be:
  523. * @arg RTC_FLAG_TSF
  524. * @arg RTC_FLAG_TSOVF
  525. * @retval None
  526. */
  527. #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
  528. /**
  529. * @brief Clear the RTC Time Stamp's pending flags.
  530. * @param __HANDLE__ specifies the RTC handle.
  531. * @param __FLAG__ specifies the RTC Alarm Flag sources to clear.
  532. * This parameter can be:
  533. * @arg RTC_FLAG_TSF
  534. * @arg RTC_FLAG_TSOVF
  535. * @retval None
  536. */
  537. #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  538. /**
  539. * @brief Enable the RTC internal TimeStamp peripheral.
  540. * @param __HANDLE__ specifies the RTC handle.
  541. * @retval None
  542. */
  543. #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE))
  544. /**
  545. * @brief Disable the RTC internal TimeStamp peripheral.
  546. * @param __HANDLE__ specifies the RTC handle.
  547. * @retval None
  548. */
  549. #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE))
  550. /**
  551. * @brief Get the selected RTC Internal Time Stamp's flag status.
  552. * @param __HANDLE__ specifies the RTC handle.
  553. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not.
  554. * This parameter can be:
  555. * @arg RTC_FLAG_ITSF
  556. * @retval None
  557. */
  558. #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
  559. /**
  560. * @brief Clear the RTC Internal Time Stamp's pending flags.
  561. * @param __HANDLE__ specifies the RTC handle.
  562. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear.
  563. * This parameter can be:
  564. * @arg RTC_FLAG_ITSF
  565. * @retval None
  566. */
  567. #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0003FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
  568. /**
  569. * @brief Enable the RTC calibration output.
  570. * @param __HANDLE__ specifies the RTC handle.
  571. * @retval None
  572. */
  573. #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE))
  574. /**
  575. * @brief Disable the calibration output.
  576. * @param __HANDLE__ specifies the RTC handle.
  577. * @retval None
  578. */
  579. #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE))
  580. /**
  581. * @brief Enable the clock reference detection.
  582. * @param __HANDLE__ specifies the RTC handle.
  583. * @retval None
  584. */
  585. #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON))
  586. /**
  587. * @brief Disable the clock reference detection.
  588. * @param __HANDLE__ specifies the RTC handle.
  589. * @retval None
  590. */
  591. #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON))
  592. /**
  593. * @brief Get the selected RTC shift operation's flag status.
  594. * @param __HANDLE__ specifies the RTC handle.
  595. * @param __FLAG__ specifies the RTC shift operation Flag is pending or not.
  596. * This parameter can be:
  597. * @arg RTC_FLAG_SHPF
  598. * @retval None
  599. */
  600. #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
  601. /**
  602. * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line.
  603. * @retval None
  604. */
  605. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  606. /**
  607. * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line.
  608. * @retval None
  609. */
  610. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  611. /**
  612. * @brief Enable event on the RTC WakeUp Timer associated Exti line.
  613. * @retval None.
  614. */
  615. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  616. /**
  617. * @brief Disable event on the RTC WakeUp Timer associated Exti line.
  618. * @retval None.
  619. */
  620. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  621. /**
  622. * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line.
  623. * @retval None.
  624. */
  625. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  626. /**
  627. * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
  628. * @retval None.
  629. */
  630. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  631. /**
  632. * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
  633. * @retval None.
  634. */
  635. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  636. /**
  637. * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
  638. * @retval None.
  639. */
  640. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
  641. /**
  642. * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
  643. * @retval None.
  644. */
  645. #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();
  646. /**
  647. * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
  648. * This parameter can be:
  649. * @retval None.
  650. */
  651. #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();
  652. /**
  653. * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not.
  654. * @retval Line Status.
  655. */
  656. #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  657. /**
  658. * @brief Clear the RTC WakeUp Timer associated Exti line flag.
  659. * @retval None.
  660. */
  661. #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  662. /**
  663. * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
  664. * @retval None.
  665. */
  666. #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
  667. /**
  668. * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line.
  669. * @retval None
  670. */
  671. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  672. /**
  673. * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line.
  674. * @retval None
  675. */
  676. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  677. /**
  678. * @brief Enable event on the RTC Tamper and Timestamp associated Exti line.
  679. * @retval None.
  680. */
  681. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  682. /**
  683. * @brief Disable event on the RTC Tamper and Timestamp associated Exti line.
  684. * @retval None.
  685. */
  686. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  687. /**
  688. * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  689. * @retval None.
  690. */
  691. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  692. /**
  693. * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  694. * @retval None.
  695. */
  696. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  697. /**
  698. * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
  699. * @retval None.
  700. */
  701. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  702. /**
  703. * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line.
  704. * @retval None.
  705. */
  706. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT))
  707. /**
  708. * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  709. * @retval None.
  710. */
  711. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE();
  712. /**
  713. * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line.
  714. * This parameter can be:
  715. * @retval None.
  716. */
  717. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE();
  718. /**
  719. * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not.
  720. * @retval Line Status.
  721. */
  722. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  723. /**
  724. * @brief Clear the RTC Tamper and Timestamp associated Exti line flag.
  725. * @retval None.
  726. */
  727. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  728. /**
  729. * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line
  730. * @retval None.
  731. */
  732. #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)
  733. /**
  734. * @}
  735. */
  736. /* Exported functions --------------------------------------------------------*/
  737. /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions
  738. * @{
  739. */
  740. /** @addtogroup RTCEx_Exported_Functions_Group1
  741. * @{
  742. */
  743. /* RTC TimeStamp and Tamper functions *****************************************/
  744. HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
  745. HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin);
  746. HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc);
  747. HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc);
  748. HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc);
  749. HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format);
  750. HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
  751. HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper);
  752. HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper);
  753. void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
  754. void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
  755. void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
  756. void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
  757. void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
  758. HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  759. HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  760. HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  761. HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  762. /**
  763. * @}
  764. */
  765. /** @addtogroup RTCEx_Exported_Functions_Group2
  766. * @{
  767. */
  768. /* RTC Wake-up functions ******************************************************/
  769. HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
  770. HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock);
  771. uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc);
  772. uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc);
  773. void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc);
  774. void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc);
  775. HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  776. /**
  777. * @}
  778. */
  779. /** @addtogroup RTCEx_Exported_Functions_Group3
  780. * @{
  781. */
  782. /* Extension Control functions ************************************************/
  783. void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
  784. uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
  785. HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
  786. HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
  787. HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput);
  788. HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc);
  789. HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc);
  790. HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc);
  791. HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc);
  792. HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc);
  793. /**
  794. * @}
  795. */
  796. /** @addtogroup RTCEx_Exported_Functions_Group4
  797. * @{
  798. */
  799. /* Extension RTC features functions *******************************************/
  800. void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc);
  801. HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
  802. /**
  803. * @}
  804. */
  805. /**
  806. * @}
  807. */
  808. /* Private types -------------------------------------------------------------*/
  809. /* Private variables ---------------------------------------------------------*/
  810. /* Private constants ---------------------------------------------------------*/
  811. /** @defgroup RTCEx_Private_Constants RTCEx Private Constants
  812. * @{
  813. */
  814. #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)EXTI_IMR_IM21) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
  815. #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_IM22) /*!< External interrupt line 22 Connected to the RTC Wake-up event */
  816. /**
  817. * @}
  818. */
  819. /* Private constants ---------------------------------------------------------*/
  820. /** @defgroup RTCEx_Private_Constants RTCEx Private Constants
  821. * @{
  822. */
  823. /* Masks Definition */
  824. #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E))
  825. #define RTC_TAMPCR_TAMPXIE ((uint32_t) (RTC_TAMPER1_INTERRUPT | RTC_TAMPER2_INTERRUPT | RTC_TAMPER3_INTERRUPT | RTC_ALL_TAMPER_INTERRUPT))
  826. /**
  827. * @}
  828. */
  829. /* Private macros ------------------------------------------------------------*/
  830. /** @defgroup RTCEx_Private_Macros RTCEx Private Macros
  831. * @{
  832. */
  833. /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
  834. * @{
  835. */
  836. #define IS_RTC_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_OUTPUT_DISABLE) || \
  837. ((__OUTPUT__) == RTC_OUTPUT_ALARMA) || \
  838. ((__OUTPUT__) == RTC_OUTPUT_ALARMB) || \
  839. ((__OUTPUT__) == RTC_OUTPUT_WAKEUP))
  840. #define IS_RTC_BKP(__BKP__) ((__BKP__) < (uint32_t) RTC_BKP_NUMBER)
  841. #define IS_TIMESTAMP_EDGE(__EDGE__) (((__EDGE__) == RTC_TIMESTAMPEDGE_RISING) || \
  842. ((__EDGE__) == RTC_TIMESTAMPEDGE_FALLING))
  843. #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & ((uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXE))) == 0x00U) && ((__TAMPER__) != (uint32_t)RESET))
  844. #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) ((((__INTERRUPT__) & (uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXIE)) == 0x00U) && ((__INTERRUPT__) != (uint32_t)RESET))
  845. #define IS_RTC_TIMESTAMP_PIN(__PIN__) (((__PIN__) == RTC_TIMESTAMPPIN_DEFAULT) || \
  846. ((__PIN__) == RTC_TIMESTAMPPIN_POS1) || \
  847. ((__PIN__) == RTC_TIMESTAMPPIN_POS2))
  848. #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \
  849. ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \
  850. ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \
  851. ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL))
  852. #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \
  853. ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE))
  854. #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \
  855. ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE))
  856. #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \
  857. ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \
  858. ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \
  859. ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE))
  860. #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \
  861. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \
  862. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \
  863. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \
  864. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \
  865. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \
  866. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \
  867. ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256))
  868. #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \
  869. ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \
  870. ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \
  871. ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK))
  872. #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(__DETECTION__) (((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \
  873. ((__DETECTION__) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE))
  874. #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \
  875. ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE))
  876. #define IS_RTC_WAKEUP_CLOCK(__CLOCK__) (((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \
  877. ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \
  878. ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \
  879. ((__CLOCK__) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \
  880. ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \
  881. ((__CLOCK__) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS))
  882. #define IS_RTC_WAKEUP_COUNTER(__COUNTER__) ((__COUNTER__) <= 0xFFFF)
  883. #define IS_RTC_SMOOTH_CALIB_PERIOD(__PERIOD__) (((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \
  884. ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \
  885. ((__PERIOD__) == RTC_SMOOTHCALIB_PERIOD_8SEC))
  886. #define IS_RTC_SMOOTH_CALIB_PLUS(__PLUS__) (((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \
  887. ((__PLUS__) == RTC_SMOOTHCALIB_PLUSPULSES_RESET))
  888. #define IS_RTC_SMOOTH_CALIB_MINUS(__VALUE__) ((__VALUE__) <= 0x000001FF)
  889. #define IS_RTC_SHIFT_ADD1S(__SEL__) (((__SEL__) == RTC_SHIFTADD1S_RESET) || \
  890. ((__SEL__) == RTC_SHIFTADD1S_SET))
  891. #define IS_RTC_SHIFT_SUBFS(__FS__) ((__FS__) <= 0x00007FFF)
  892. #define IS_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == RTC_CALIBOUTPUT_512HZ) || \
  893. ((__OUTPUT__) == RTC_CALIBOUTPUT_1HZ))
  894. /**
  895. * @}
  896. */
  897. /**
  898. * @}
  899. */
  900. /**
  901. * @}
  902. */
  903. /**
  904. * @}
  905. */
  906. #ifdef __cplusplus
  907. }
  908. #endif
  909. #endif /* __STM32F7xx_HAL_RTC_EX_H */
  910. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/