Skip to content

Commit

Permalink
STM32L0 - Rename RTC_LSI
Browse files Browse the repository at this point in the history
  • Loading branch information
svastm committed Sep 29, 2016
1 parent 57208bb commit da44e99
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hal/targets/hal/TARGET_STM/TARGET_STM32L0/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@

#include "mbed_error.h"

#if DEVICE_RTC_LSI
#if RTC_LSI
static int rtc_inited = 0;
#endif

static RTC_HandleTypeDef RtcHandle;

#if DEVICE_RTC_LSI
#if RTC_LSI
#define RTC_CLOCK LSI_VALUE
#else
#define RTC_CLOCK LSE_VALUE
Expand All @@ -64,7 +64,7 @@ void rtc_init(void)
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;

#if DEVICE_RTC_LSI
#if RTC_LSI
if (rtc_inited) return;
rtc_inited = 1;
#endif
Expand All @@ -79,7 +79,7 @@ void rtc_init(void)
// Enable access to Backup domain
HAL_PWR_EnableBkUpAccess();

#if !DEVICE_RTC_LSI
#if !RTC_LSI
// Enable LSE Oscillator
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
Expand Down Expand Up @@ -129,7 +129,7 @@ void rtc_init(void)
}

#if DEVICE_LOWPOWERTIMER
#if DEVICE_RTC_LSI
#if RTC_LSI
rtc_write(0);
#else
if (!rtc_isenabled()) {
Expand All @@ -145,7 +145,7 @@ void rtc_init(void)

void rtc_free(void)
{
#if DEVICE_RTC_LSI
#if RTC_LSI
// Enable Power clock
__PWR_CLK_ENABLE();

Expand All @@ -168,14 +168,14 @@ void rtc_free(void)
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
HAL_RCC_OscConfig(&RCC_OscInitStruct);

#if DEVICE_RTC_LSI
#if RTC_LSI
rtc_inited = 0;
#endif
}

int rtc_isenabled(void)
{
#if DEVICE_RTC_LSI
#if RTC_LSI
return rtc_inited;
#else
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) {
Expand Down

0 comments on commit da44e99

Please sign in to comment.