Skip to content

Commit

Permalink
Update rtc_api.c
Browse files Browse the repository at this point in the history
  • Loading branch information
star297 committed Feb 2, 2016
1 parent 216fca1 commit 0ffdc57
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

#include "mbed_error.h"

static int rtc_inited = 0;

static RTC_HandleTypeDef RtcHandle;

void rtc_init(void)
Expand All @@ -43,9 +41,6 @@ void rtc_init(void)
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
uint32_t rtc_freq = 0;

if (rtc_inited) return;
rtc_inited = 1;

RtcHandle.Instance = RTC;

// Enable Power clock
Expand Down Expand Up @@ -128,13 +123,15 @@ void rtc_free(void)
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
HAL_RCC_OscConfig(&RCC_OscInitStruct);

rtc_inited = 0;
}

int rtc_isenabled(void)
{
return rtc_inited;
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS){
return 1;
} else {
return 0;
}
}

/*
Expand Down

0 comments on commit 0ffdc57

Please sign in to comment.