Skip to content

Commit 64e4f8c

Browse files
committed
Add STM32RTC::end() method
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent d28089d commit 64e4f8c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/STM32RTC.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ void STM32RTC::begin(RTCHourFormats_t format)
9595
_configured = true;
9696
}
9797

98+
/**
99+
* @brief Deinitialize and stop the RTC
100+
* @param None
101+
* @retval None
102+
*/
103+
void STM32RTC::end(void)
104+
{
105+
if(_configured == true) {
106+
RTC_DeInit();
107+
_configured = false;
108+
}
109+
}
110+
98111
/**
99112
* @brief set the RTC clock source. By default LSI clock is selected. This
100113
* method must be called before begin().

src/STM32RTC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class STM32RTC {
9292
void begin(bool resetTime, RTCHourFormats_t format = HOUR_24);
9393
void begin(RTCHourFormats_t format = HOUR_24);
9494

95+
void end(void);
96+
9597
void setClockSource(RTC_sourceClock_t source);
9698

9799
void enableAlarm(Alarm_Match match);

0 commit comments

Comments
 (0)