mirror of https://github.com/ARMmbed/mbed-os.git
STM32F3 - Rename RTC_LSI
parent
574e7b7622
commit
faae46385f
|
|
@ -726,7 +726,7 @@
|
||||||
"core": "Cortex-M4F",
|
"core": "Cortex-M4F",
|
||||||
"default_toolchain": "ARM",
|
"default_toolchain": "ARM",
|
||||||
"extra_labels": ["STM", "STM32F3", "STM32F303K8"],
|
"extra_labels": ["STM", "STM32F3", "STM32F303K8"],
|
||||||
"macros": ["DEVICE_RTC_LSI=1"],
|
"macros": ["RTC_LSI=1"],
|
||||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
"progen": {"target": "nucleo-f303k8"},
|
"progen": {"target": "nucleo-f303k8"},
|
||||||
|
|
@ -1041,20 +1041,20 @@
|
||||||
"core": "Cortex-M4F",
|
"core": "Cortex-M4F",
|
||||||
"default_toolchain": "ARM",
|
"default_toolchain": "ARM",
|
||||||
"extra_labels": ["STM", "STM32F3", "STM32F303", "STM32F303VC"],
|
"extra_labels": ["STM", "STM32F3", "STM32F303", "STM32F303VC"],
|
||||||
"macros": ["DEVICE_RTC_LSI=1"],
|
"macros": ["RTC_LSI=1"],
|
||||||
"supported_toolchains": ["GCC_ARM"],
|
"supported_toolchains": ["GCC_ARM"],
|
||||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"]
|
||||||
},
|
},
|
||||||
"DISCO_F334C8": {
|
"DISCO_F334C8": {
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
"core": "Cortex-M4F",
|
"core": "Cortex-M4F",
|
||||||
"default_toolchain": "ARM",
|
"default_toolchain": "ARM",
|
||||||
"extra_labels": ["STM", "STM32F3", "STM32F334C8"],
|
"extra_labels": ["STM", "STM32F3", "STM32F334C8"],
|
||||||
"macros": ["DEVICE_RTC_LSI=1"],
|
"macros": ["RTC_LSI=1"],
|
||||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||||
"progen": {"target": "disco-f334c8"},
|
"progen": {"target": "disco-f334c8"},
|
||||||
"detect_code": ["0810"],
|
"detect_code": ["0810"],
|
||||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
|
||||||
"default_lib": "small",
|
"default_lib": "small",
|
||||||
"release_versions": ["2"]
|
"release_versions": ["2"]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@
|
||||||
|
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
|
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
static int rtc_inited = 0;
|
static int rtc_inited = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static RTC_HandleTypeDef RtcHandle;
|
static RTC_HandleTypeDef RtcHandle;
|
||||||
|
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
#define RTC_CLOCK LSI_VALUE
|
#define RTC_CLOCK LSI_VALUE
|
||||||
#else
|
#else
|
||||||
#define RTC_CLOCK LSE_VALUE
|
#define RTC_CLOCK LSE_VALUE
|
||||||
|
|
@ -63,14 +63,14 @@ void rtc_init(void)
|
||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
if (rtc_inited) return;
|
if (rtc_inited) return;
|
||||||
rtc_inited = 1;
|
rtc_inited = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RtcHandle.Instance = RTC;
|
RtcHandle.Instance = RTC;
|
||||||
|
|
||||||
#if !DEVICE_RTC_LSI
|
#if !RTC_LSI
|
||||||
// Enable LSE Oscillator
|
// Enable LSE Oscillator
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; /* Mandatory, otherwise the PLL is reconfigured! */
|
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_LOWPOWERTIMER
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
rtc_write(0);
|
rtc_write(0);
|
||||||
#else
|
#else
|
||||||
if (!rtc_isenabled()) {
|
if (!rtc_isenabled()) {
|
||||||
|
|
@ -135,7 +135,7 @@ void rtc_init(void)
|
||||||
|
|
||||||
void rtc_free(void)
|
void rtc_free(void)
|
||||||
{
|
{
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
// Enable Power clock
|
// Enable Power clock
|
||||||
__PWR_CLK_ENABLE();
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
|
@ -158,14 +158,14 @@ void rtc_free(void)
|
||||||
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
|
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
|
||||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||||
|
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
rtc_inited = 0;
|
rtc_inited = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtc_isenabled(void)
|
int rtc_isenabled(void)
|
||||||
{
|
{
|
||||||
#if DEVICE_RTC_LSI
|
#if RTC_LSI
|
||||||
return rtc_inited;
|
return rtc_inited;
|
||||||
#else
|
#else
|
||||||
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return 1;
|
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue