RTC works correctly

Removes unnecesary code, and moved some things around, now it works
fine.
pull/476/head
Sissors 2014-09-09 22:52:51 +02:00
parent c9194f0f9e
commit 47988de521
1 changed files with 2 additions and 9 deletions

View File

@ -23,17 +23,10 @@
#include "PeripheralPins.h"
void rtc_init(void) {
if (PinMap_RTC[0].pin == NC) {
RTC_HAL_SetOscillatorCmd(RTC_BASE, true);
}
SIM_HAL_EnableRtcClock(SIM_BASE, 0U);
RTC_HAL_SetSecsReg(RTC_BASE, 1);
RTC_HAL_Enable(RTC_BASE);
RTC_HAL_Init(RTC_BASE);
// select RTC clock source
SIM->SOPT1 &= ~SIM_SOPT1_OSC32KSEL_MASK;
SIM->SOPT1 |= SIM_SOPT1_OSC32KSEL(PinMap_RTC[0].peripheral);
RTC_HAL_Init(RTC_BASE);
RTC_HAL_Enable(RTC_BASE);
RTC_HAL_EnableCounter(RTC_BASE, true);
}