mirror of https://github.com/ARMmbed/mbed-os.git
STM32L1 - Rename RTC_LSI
parent
da44e99a1c
commit
f361a430ef
|
@ -1192,7 +1192,7 @@
|
|||
"core": "Cortex-M3",
|
||||
"default_toolchain": "uARM",
|
||||
"extra_labels": ["STM", "STM32L1", "STM32L152RC"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"macros": ["RTC_LSI=1"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"progen": {"target": "stm32l151rc"},
|
||||
"detect_code": ["4100"],
|
||||
|
@ -1227,7 +1227,7 @@
|
|||
"default_toolchain": "uARM",
|
||||
"program_cycle_s": 1.5,
|
||||
"extra_labels": ["STM", "STM32L1", "STM32L151RC"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"macros": ["RTC_LSI=1"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM"],
|
||||
"progen": {"target": "stm32l151rc"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||
|
|
|
@ -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
|
||||
|
@ -63,14 +63,14 @@ 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_LSI | RCC_OSCILLATORTYPE_LSE;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
|
||||
|
@ -128,7 +128,7 @@ void rtc_init(void)
|
|||
}
|
||||
|
||||
#if DEVICE_LOWPOWERTIMER
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
rtc_write(0);
|
||||
#else
|
||||
if (!rtc_isenabled()) {
|
||||
|
@ -144,7 +144,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -167,14 +167,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) {
|
||||
|
|
Loading…
Reference in New Issue