@@ -56,7 +56,6 @@ extern "C" {
56
56
/* Private define ------------------------------------------------------------*/
57
57
/* Private macro -------------------------------------------------------------*/
58
58
/* Private variables ---------------------------------------------------------*/
59
- static RTC_HandleTypeDef RtcHandle = {0 };
60
59
static voidCallbackPtr RTCUserCallback = NULL ;
61
60
static void * callbackUserData = NULL ;
62
61
#ifdef RTC_ALARM_B
@@ -94,8 +93,56 @@ static inline int _log2(int x)
94
93
return (x > 0 ) ? (sizeof (int ) * 8 - __builtin_clz (x ) - 1 ) : 0 ;
95
94
}
96
95
96
+ /* Exported variable --------------------------------------------------------*/
97
+ RTC_HandleTypeDef RtcHandle = {0 };
98
+
97
99
/* Exported functions --------------------------------------------------------*/
98
100
101
+ /* HAL MSP function used for RTC_Init */
102
+ void HAL_RTC_MspInit (RTC_HandleTypeDef * rtcHandle )
103
+ {
104
+ #if defined(STM32WLxx )
105
+ /* Only the STM32WLxx series has a TAMP_STAMP_LSECSS_SSRU_IRQn */
106
+ if (rtcHandle -> Instance == RTC )
107
+ {
108
+ if (HAL_RTCEx_SetSSRU_IT (rtcHandle ) != HAL_OK ) {
109
+ Error_Handler ();
110
+ }
111
+ /* Give init value for the RtcFeatures enable */
112
+ rtcHandle -> IsEnabled .RtcFeatures = 0 ;
113
+
114
+ /* RTC interrupt Init */
115
+ HAL_NVIC_SetPriority (TAMP_STAMP_LSECSS_SSRU_IRQn , 0 , 0 );
116
+ HAL_NVIC_EnableIRQ (TAMP_STAMP_LSECSS_SSRU_IRQn );
117
+
118
+ }
119
+ #else
120
+ UNUSED (rtcHandle );
121
+ #endif /* STM32WLxx */
122
+ /* RTC_Alarm_IRQn is enabled when enabling Alarm */
123
+ }
124
+
125
+ void HAL_RTC_MspDeInit (RTC_HandleTypeDef * rtcHandle )
126
+ {
127
+
128
+ if (rtcHandle -> Instance == RTC )
129
+ {
130
+ /* USER CODE BEGIN RTC_MspDeInit 0 */
131
+
132
+ /* USER CODE END RTC_MspDeInit 0 */
133
+ /* Peripheral clock disable */
134
+ __HAL_RCC_RTC_DISABLE ();
135
+ __HAL_RCC_RTCAPB_CLK_DISABLE ();
136
+
137
+ /* RTC interrupt Deinit */
138
+ HAL_NVIC_DisableIRQ (TAMP_STAMP_LSECSS_SSRU_IRQn );
139
+ HAL_NVIC_DisableIRQ (RTC_Alarm_IRQn );
140
+ /* USER CODE BEGIN RTC_MspDeInit 1 */
141
+
142
+ /* USER CODE END RTC_MspDeInit 1 */
143
+ }
144
+ }
145
+
99
146
/**
100
147
* @brief Set RTC clock source
101
148
* @param source: RTC clock source: LSE, LSI or HSE
@@ -737,7 +784,7 @@ void RTC_GetDate(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *wday)
737
784
*/
738
785
void RTC_StartAlarm (alarm_t name , uint8_t day , uint8_t hours , uint8_t minutes , uint8_t seconds , uint32_t subSeconds , hourAM_PM_t period , uint8_t mask )
739
786
{
740
- RTC_AlarmTypeDef RTC_AlarmStructure ;
787
+ RTC_AlarmTypeDef RTC_AlarmStructure = { 0 } ;
741
788
742
789
/* Ignore time AM PM configuration if in 24 hours format */
743
790
if (initFormat == HOUR_FORMAT_24 ) {
0 commit comments