Skip to content

Commit c571d8d

Browse files
committed
STM32 RTC: initializes structures
1 parent df88a9d commit c571d8d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ static void RTC_IRQHandler(void);
5757

5858
void rtc_init(void)
5959
{
60-
RCC_OscInitTypeDef RCC_OscInitStruct;
61-
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
60+
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
61+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
6262

6363
// Enable access to Backup domain
6464
HAL_PWR_EnableBkUpAccess();
@@ -162,7 +162,7 @@ void rtc_free(void)
162162
#endif
163163

164164
// Disable LSI and LSE clocks
165-
RCC_OscInitTypeDef RCC_OscInitStruct;
165+
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
166166
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
167167
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
168168
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
@@ -217,8 +217,8 @@ It is then not a problem to not use shifts.
217217

218218
time_t rtc_read(void)
219219
{
220-
RTC_DateTypeDef dateStruct;
221-
RTC_TimeTypeDef timeStruct;
220+
RTC_DateTypeDef dateStruct = {0};
221+
RTC_TimeTypeDef timeStruct = {0};
222222
struct tm timeinfo;
223223

224224
RtcHandle.Instance = RTC;
@@ -247,8 +247,8 @@ time_t rtc_read(void)
247247

248248
void rtc_write(time_t t)
249249
{
250-
RTC_DateTypeDef dateStruct;
251-
RTC_TimeTypeDef timeStruct;
250+
RTC_DateTypeDef dateStruct = {0};
251+
RTC_TimeTypeDef timeStruct = {0};
252252

253253
RtcHandle.Instance = RTC;
254254

0 commit comments

Comments
 (0)