py32f0xx_hal_rtc_ex.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /**
  2. ******************************************************************************
  3. * @file py32f0xx_hal_rtc_ex.h
  4. * @author MCU Application Team
  5. * @brief Header file of RTC HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. /* Define to prevent recursive inclusion -------------------------------------*/
  31. #ifndef __PY32F0xxHAL_RTC_EX_H
  32. #define __PY32F0xxHAL_RTC_EX_H
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "py32f0xx_hal_def.h"
  38. /** @addtogroup PY32F0xx_HAL_Driver
  39. * @{
  40. */
  41. /** @addtogroup RTCEx
  42. * @{
  43. */
  44. /** @addtogroup RTCEx_Private_Macros
  45. * @{
  46. */
  47. /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters
  48. * @{
  49. */
  50. #define IS_RTC_SMOOTH_CALIB_MINUS(__VALUE__) ((__VALUE__) <= 0x0000007FU)
  51. /**
  52. * @}
  53. */
  54. /**
  55. * @}
  56. */
  57. /* Exported macro ------------------------------------------------------------*/
  58. /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros
  59. * @{
  60. */
  61. /**
  62. * @brief Enable the RTC Second interrupt.
  63. * @param __HANDLE__: specifies the RTC handle.
  64. * @param __INTERRUPT__: specifies the RTC Second interrupt sources to be enabled
  65. * This parameter can be any combination of the following values:
  66. * @arg RTC_IT_SEC: Second A interrupt
  67. * @retval None
  68. */
  69. #define __HAL_RTC_SECOND_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  70. /**
  71. * @brief Disable the RTC Second interrupt.
  72. * @param __HANDLE__: specifies the RTC handle.
  73. * @param __INTERRUPT__: specifies the RTC Second interrupt sources to be disabled.
  74. * This parameter can be any combination of the following values:
  75. * @arg RTC_IT_SEC: Second A interrupt
  76. * @retval None
  77. */
  78. #define __HAL_RTC_SECOND_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  79. /**
  80. * @brief Check whether the specified RTC Second interrupt has occurred or not.
  81. * @param __HANDLE__: specifies the RTC handle.
  82. * @param __INTERRUPT__: specifies the RTC Second interrupt sources to be enabled or disabled.
  83. * This parameter can be:
  84. * @arg RTC_IT_SEC: Second A interrupt
  85. * @retval None
  86. */
  87. #define __HAL_RTC_SECOND_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__)))) != RESET)? SET : RESET)
  88. /**
  89. * @brief Get the selected RTC Second's flag status.
  90. * @param __HANDLE__: specifies the RTC handle.
  91. * @param __FLAG__: specifies the RTC Second Flag sources to be enabled or disabled.
  92. * This parameter can be:
  93. * @arg RTC_FLAG_SEC
  94. * @retval None
  95. */
  96. #define __HAL_RTC_SECOND_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
  97. /**
  98. * @brief Clear the RTC Second's pending flags.
  99. * @param __HANDLE__: specifies the RTC handle.
  100. * @param __FLAG__: specifies the RTC Second Flag sources to be enabled or disabled.
  101. * This parameter can be:
  102. * @arg RTC_FLAG_SEC
  103. * @retval None
  104. */
  105. #define __HAL_RTC_SECOND_CLEAR_FLAG(__HANDLE__, __FLAG__) CLEAR_BIT((__HANDLE__)->Instance->CRL,(__FLAG__))
  106. /**
  107. * @brief Enable the RTC Overflow interrupt.
  108. * @param __HANDLE__: specifies the RTC handle.
  109. * @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be enabled
  110. * This parameter can be any combination of the following values:
  111. * @arg RTC_IT_OW: Overflow A interrupt
  112. * @retval None
  113. */
  114. #define __HAL_RTC_OVERFLOW_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  115. /**
  116. * @brief Disable the RTC Overflow interrupt.
  117. * @param __HANDLE__: specifies the RTC handle.
  118. * @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be disabled.
  119. * This parameter can be any combination of the following values:
  120. * @arg RTC_IT_OW: Overflow A interrupt
  121. * @retval None
  122. */
  123. #define __HAL_RTC_OVERFLOW_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CRH, (__INTERRUPT__))
  124. /**
  125. * @brief Check whether the specified RTC Overflow interrupt has occurred or not.
  126. * @param __HANDLE__: specifies the RTC handle.
  127. * @param __INTERRUPT__: specifies the RTC Overflow interrupt sources to be enabled or disabled.
  128. * This parameter can be:
  129. * @arg RTC_IT_OW: Overflow A interrupt
  130. * @retval None
  131. */
  132. #define __HAL_RTC_OVERFLOW_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((__HANDLE__)->Instance->CRH)& ((__INTERRUPT__))) ) != RESET)? SET : RESET)
  133. /**
  134. * @brief Get the selected RTC Overflow's flag status.
  135. * @param __HANDLE__: specifies the RTC handle.
  136. * @param __FLAG__: specifies the RTC Overflow Flag sources to be enabled or disabled.
  137. * This parameter can be:
  138. * @arg RTC_FLAG_OW
  139. * @retval None
  140. */
  141. #define __HAL_RTC_OVERFLOW_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->CRL) & (__FLAG__)) != RESET)? SET : RESET)
  142. /**
  143. * @brief Clear the RTC Overflow's pending flags.
  144. * @param __HANDLE__: specifies the RTC handle.
  145. * @param __FLAG__: specifies the RTC Overflow Flag sources to be enabled or disabled.
  146. * This parameter can be:
  147. * @arg RTC_FLAG_OW
  148. * @retval None
  149. */
  150. #define __HAL_RTC_OVERFLOW_CLEAR_FLAG(__HANDLE__, __FLAG__) CLEAR_BIT((__HANDLE__)->Instance->CRL,(__FLAG__))
  151. /**
  152. * @}
  153. */
  154. /* Exported functions --------------------------------------------------------*/
  155. /** @addtogroup RTCEx_Exported_Functions
  156. * @{
  157. */
  158. /* RTC Second functions *****************************************/
  159. /** @addtogroup RTCEx_Exported_Functions_Group2
  160. * @{
  161. */
  162. HAL_StatusTypeDef HAL_RTCEx_SetSecond_IT(RTC_HandleTypeDef *hrtc);
  163. HAL_StatusTypeDef HAL_RTCEx_DeactivateSecond(RTC_HandleTypeDef *hrtc);
  164. void HAL_RTCEx_RTCIRQHandler(RTC_HandleTypeDef *hrtc);
  165. void HAL_RTCEx_RTCEventCallback(RTC_HandleTypeDef *hrtc);
  166. void HAL_RTCEx_RTCEventErrorCallback(RTC_HandleTypeDef *hrtc);
  167. /**
  168. * @}
  169. */
  170. /* Extension Control functions ************************************************/
  171. /** @addtogroup RTCEx_Exported_Functions_Group3
  172. * @{
  173. */
  174. HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
  175. /**
  176. * @}
  177. */
  178. /**
  179. * @}
  180. */
  181. /**
  182. * @}
  183. */
  184. /**
  185. * @}
  186. */
  187. #ifdef __cplusplus
  188. }
  189. #endif
  190. #endif /* __PY32F0xxHAL_RTC_EX_H */
  191. /************************ (C) COPYRIGHT Puya *****END OF FILE****/