Skip to content

Commit 5c16018

Browse files
authored
Merge pull request #12509 from SiliconLabs/bugfix/rtcc_lpticker_coexistence
EFM32: RTCC bugfix for #12374
2 parents 67e9502 + 9bc59fe commit 5c16018

File tree

1 file changed

+3
-9
lines changed
  • targets/TARGET_Silicon_Labs/TARGET_EFM32

1 file changed

+3
-9
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/rtcc.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void rtc_init(void)
5656
rtcc_init.presc = rtccCntPresc_32768;
5757
RTCC_Init(&rtcc_init);
5858
RTCC_Enable(true);
59+
RTCC->RET[0].REG = 0;
5960
}
6061

6162
void rtc_free(void)
@@ -71,20 +72,13 @@ int rtc_isenabled(void)
7172

7273
time_t rtc_read(void)
7374
{
74-
return RTCC_CounterGet();
75+
return RTCC_CounterGet() + RTCC->RET[0].REG;
7576
}
7677

7778
void rtc_write(time_t t)
7879
{
7980
core_util_critical_section_enter();
80-
uint32_t diff = t - RTCC_CounterGet();
81-
lptick_offset += diff;
82-
83-
if(RTCC_IntGetEnabled() & RTCC_IF_CC0) {
84-
RTCC->CC[0].CCV += diff << 15;
85-
}
86-
87-
RTCC_CounterSet(t);
81+
RTCC->RET[0].REG = t - RTCC_CounterGet();
8882
core_util_critical_section_exit();
8983
}
9084

0 commit comments

Comments
 (0)