From c4018e4ea8e1697b6c9f09553c37a2630d4d1eed Mon Sep 17 00:00:00 2001 From: Mikko Polojarvi Date: Wed, 14 Oct 2015 14:55:38 +0300 Subject: [PATCH] SiLabs Pearl: Correct includes and interrupt names in RTC Conditionals for including em_rtc.h and em_rtcc.h. Use the correct interrupt name in RTCC code. --- .../TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c | 11 ++++++++--- .../hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c | 13 ++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c index e41ea5970a..a22c0b7c59 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c @@ -35,6 +35,11 @@ #include "rtc_api_HAL.h" #include "lp_ticker_api.h" +#include "em_int.h" +#if (defined RTCC_COUNT) && (RTCC_COUNT > 0) +#include "em_rtcc.h" +#endif + static int rtc_reserved = 0; void lp_ticker_init() @@ -154,12 +159,12 @@ void lp_ticker_set_interrupt(timestamp_t timestamp) /* Set callback */ RTCC_ChannelCCVSet(0, (uint32_t)timestamp_ticks); - RTCC_IntEnable(RTCC_IF_COMP0); + RTCC_IntEnable(RTCC_IF_CC0); } inline void lp_ticker_disable_interrupt() { - RTCC_IntDisable(RTCC_IF_COMP0); + RTCC_IntDisable(RTCC_IF_CC0); INT_Disable(); if(rtc_reserved) { @@ -171,7 +176,7 @@ inline void lp_ticker_disable_interrupt() inline void lp_ticker_clear_interrupt() { - RTCC_IntClear(RTCC_IF_COMP0); + RTCC_IntClear(RTCC_IF_CC0); } timestamp_t lp_ticker_read() diff --git a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c index 76036f7a7a..c771b537fe 100644 --- a/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c +++ b/libraries/mbed/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c @@ -34,10 +34,17 @@ #include "rtc_api.h" #include "rtc_api_HAL.h" #include "em_cmu.h" -#include "em_rtc.h" #include "sleep_api.h" #include "sleepmodes.h" +#if (defined RTC_COUNT) && (RTC_COUNT > 0) +#include "em_rtc.h" +#endif + +#if (defined RTCC_COUNT) && (RTCC_COUNT > 0) +#include "em_rtcc.h" +#endif + static bool rtc_inited = false; static time_t time_base = 0; static uint32_t useflags = 0; @@ -153,8 +160,8 @@ void RTCC_IRQHandler(void) time_extend += 1; } - if (flags & RTCC_IF_COMP0) { - RTCC_IntClear(RTCC_IF_COMP0); + if (flags & RTCC_IF_CC0) { + RTCC_IntClear(RTCC_IF_CC0); if (comp0_handler != NULL) { comp0_handler(); }