STM32F0 - Rename RTC_LSI

pull/2816/head
svastm 2016-09-26 16:46:03 +02:00
parent 2564a833c0
commit 9053d3b9ea
2 changed files with 10 additions and 10 deletions

View File

@ -624,7 +624,7 @@
"core": "Cortex-M0",
"default_toolchain": "uARM",
"extra_labels": ["STM", "STM32F0", "STM32F031K6"],
"macros": ["DEVICE_RTC_LSI=1"],
"macros": ["RTC_LSI=1"],
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
"inherits": ["Target"],
"progen": {"target": "nucleo-f031k6"},
@ -638,7 +638,7 @@
"core": "Cortex-M0",
"default_toolchain": "uARM",
"extra_labels": ["STM", "STM32F0", "STM32F042K6"],
"macros": ["DEVICE_RTC_LSI=1"],
"macros": ["RTC_LSI=1"],
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
"inherits": ["Target"],
"progen": {"target": "nucleo-f042k6"},

View File

@ -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
@ -62,14 +62,14 @@ static RTC_HandleTypeDef RtcHandle;
void rtc_init(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
#if DEVICE_RTC_LSI
#if RTC_LSI
if (rtc_inited) return;
rtc_inited = 1;
#endif
RtcHandle.Instance = RTC;
#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!
@ -119,7 +119,7 @@ void rtc_init(void) {
}
#if DEVICE_LOWPOWERTIMER
#if DEVICE_RTC_LSI
#if RTC_LSI
rtc_write(0);
#else
if (!rtc_isenabled()) {
@ -134,7 +134,7 @@ void rtc_init(void) {
}
void rtc_free(void) {
#if DEVICE_RTC_LSI
#if RTC_LSI
// Enable Power clock
__PWR_CLK_ENABLE();
@ -157,13 +157,13 @@ 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) {