File tree 1 file changed +15
-18
lines changed
1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -76,25 +76,22 @@ void STM32RTC::begin(RTC_Hour_Format format)
76
76
RTC_init ((format == RTC_HOUR_12)? HOUR_FORMAT_12: HOUR_FORMAT_24,
77
77
(_clockSource == RTC_LSE_CLOCK)? LSE_CLOCK:
78
78
(_clockSource == RTC_HSE_CLOCK)? HSE_CLOCK : LSI_CLOCK);
79
+ // Must be set before call of sync methods
80
+ _configured = true ;
81
+ syncTime ();
82
+ syncDate ();
83
+ // Use current time to init alarm members
84
+ _alarmDate = _date;
85
+ _alarmHours = _hours;
86
+ _alarmMinutes = _minutes;
87
+ _alarmSeconds = _seconds;
88
+ _alarmSubSeconds = _subSeconds;
89
+ _alarmPeriod = _hoursPeriod;
90
+ } else {
91
+ syncTime ();
92
+ syncDate ();
93
+ syncAlarmTime ();
79
94
}
80
-
81
- _hoursPeriod = RTC_AM;
82
- _hours = 0 ;
83
- _minutes = 0 ;
84
- _seconds = 0 ;
85
- _subSeconds = 0 ;
86
- _year = 0 ;
87
- _month = 0 ;
88
- _date = 0 ;
89
- _day = 0 ;
90
- _alarmDate = 0 ;
91
- _alarmHours = 0 ;
92
- _alarmMinutes = 0 ;
93
- _alarmSeconds = 0 ;
94
- _alarmSubSeconds = 0 ;
95
- _alarmPeriod = RTC_AM;
96
-
97
- _configured = true ;
98
95
}
99
96
100
97
/* *
You can’t perform that action at this time.
0 commit comments