Skip to content

Commit b8cbccd

Browse files
committed
Update example to add clock source selection
Fix #8 Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent b232d34 commit b8cbccd

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

examples/Epoch/Epoch.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ STM32RTC& rtc = STM32RTC::getInstance();
4444
void setup() {
4545
Serial.begin(9600);
4646

47+
// Select RTC clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK.
48+
// By default the LSI is selected as source.
49+
//rtc.setClockSource(STM32RTC::RTC_LSE_CLOCK);
50+
4751
rtc.begin(); // initialize RTC 24H format
4852

4953
rtc.setEpoch(1451606400); // Jan 1, 2016

examples/SimpleRTC/SimpleRTC.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ void setup()
5757
{
5858
Serial.begin(9600);
5959

60+
// Select RTC clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK.
61+
// By default the LSI is selected as source.
62+
//rtc.setClockSource(STM32RTC::RTC_LSE_CLOCK);
63+
6064
rtc.begin(); // initialize RTC 24H format
6165

6266
// Set the time

examples/advancedRTCAlarm/advancedRTCAlarm.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ void setup()
4040
{
4141
Serial.begin(9600);
4242

43+
// Select RTC clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK.
44+
// By default the LSI is selected as source.
45+
//rtc.setClockSource(STM32RTC::RTC_LSE_CLOCK);
46+
4347
rtc.begin(); // initialize RTC 24H format
4448

4549
rtc.setTime(hours, minutes, seconds);

examples/simpleRTCAlarm/simpleRTCAlarm.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ void setup()
5555
{
5656
Serial.begin(9600);
5757

58+
// Select RTC clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK.
59+
// By default the LSI is selected as source.
60+
//rtc.setClockSource(STM32RTC::RTC_LSE_CLOCK);
61+
5862
rtc.begin(); // initialize RTC 24H format
5963

6064
rtc.setTime(hours, minutes, seconds);

0 commit comments

Comments
 (0)