Skip to content

Commit d7ea564

Browse files
committed
fix(examples): use RTC_SSR_SS for subsecond management
STM32F2xx also have no subsecond Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent ead6df5 commit d7ea564

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/advancedRTCAlarm/advancedRTCAlarm.ino

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ volatile int alarmBMatch_counter = 0;
3030
#endif
3131

3232
/* Change this value to set alarm match offset in millisecond */
33-
/* Note that STM32F1xx does not manage subsecond only second */
33+
/* Note that only mcu with RTC_SSR_SS defined managed subsecond else only second */
34+
#if defined(RTC_SSR_SS)
3435
static uint32_t atime = 678;
35-
36+
#else
37+
static uint32_t atime = 1000;
38+
#endif
3639
/* Change these values to set the current initial time */
3740
const byte seconds = 0;
3841
const byte minutes = 0;
@@ -83,14 +86,10 @@ void alarmMatch(void *data)
8386

8487
if (data != NULL) {
8588
_millis = *(uint32_t*)data;
86-
// Minimum is 1 second
87-
if (sec == 0) {
88-
sec = 1;
89-
}
9089
}
9190

9291
sec = _millis / 1000;
93-
#ifdef STM32F1xx
92+
#if !defined(RTC_SSR_SS)
9493
// Minimum is 1 second
9594
if (sec == 0) {
9695
sec = 1;

0 commit comments

Comments
 (0)