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.
pull/1501/head
Mikko Polojarvi 2015-10-14 14:55:38 +03:00 committed by Steven Cooreman
parent 21a242049f
commit c4018e4ea8
2 changed files with 18 additions and 6 deletions

View File

@ -35,6 +35,11 @@
#include "rtc_api_HAL.h" #include "rtc_api_HAL.h"
#include "lp_ticker_api.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; static int rtc_reserved = 0;
void lp_ticker_init() void lp_ticker_init()
@ -154,12 +159,12 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
/* Set callback */ /* Set callback */
RTCC_ChannelCCVSet(0, (uint32_t)timestamp_ticks); RTCC_ChannelCCVSet(0, (uint32_t)timestamp_ticks);
RTCC_IntEnable(RTCC_IF_COMP0); RTCC_IntEnable(RTCC_IF_CC0);
} }
inline void lp_ticker_disable_interrupt() inline void lp_ticker_disable_interrupt()
{ {
RTCC_IntDisable(RTCC_IF_COMP0); RTCC_IntDisable(RTCC_IF_CC0);
INT_Disable(); INT_Disable();
if(rtc_reserved) { if(rtc_reserved) {
@ -171,7 +176,7 @@ inline void lp_ticker_disable_interrupt()
inline void lp_ticker_clear_interrupt() inline void lp_ticker_clear_interrupt()
{ {
RTCC_IntClear(RTCC_IF_COMP0); RTCC_IntClear(RTCC_IF_CC0);
} }
timestamp_t lp_ticker_read() timestamp_t lp_ticker_read()

View File

@ -34,10 +34,17 @@
#include "rtc_api.h" #include "rtc_api.h"
#include "rtc_api_HAL.h" #include "rtc_api_HAL.h"
#include "em_cmu.h" #include "em_cmu.h"
#include "em_rtc.h"
#include "sleep_api.h" #include "sleep_api.h"
#include "sleepmodes.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 bool rtc_inited = false;
static time_t time_base = 0; static time_t time_base = 0;
static uint32_t useflags = 0; static uint32_t useflags = 0;
@ -153,8 +160,8 @@ void RTCC_IRQHandler(void)
time_extend += 1; time_extend += 1;
} }
if (flags & RTCC_IF_COMP0) { if (flags & RTCC_IF_CC0) {
RTCC_IntClear(RTCC_IF_COMP0); RTCC_IntClear(RTCC_IF_CC0);
if (comp0_handler != NULL) { if (comp0_handler != NULL) {
comp0_handler(); comp0_handler();
} }