mirror of https://github.com/ARMmbed/mbed-os.git
commit
49e9627882
|
@ -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"},
|
||||
|
@ -726,7 +726,7 @@
|
|||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F3", "STM32F303K8"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"macros": ["RTC_LSI=1"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"inherits": ["Target"],
|
||||
"progen": {"target": "nucleo-f303k8"},
|
||||
|
@ -832,8 +832,8 @@
|
|||
"extra_labels": ["STM", "STM32F4", "STM32F429", "STM32F429ZI", "STM32F429xx"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"progen": {"target": "nucleo-f429zi"},
|
||||
"macros": ["DEVICE_RTC_LSI=1", "TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "RTC_LSI", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "TRNG"],
|
||||
"macros": ["RTC_LSI=1", "TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "TRNG"],
|
||||
"detect_code": ["0796"],
|
||||
"features": ["IPV4"],
|
||||
"release_versions": ["2", "5"]
|
||||
|
@ -1041,20 +1041,20 @@
|
|||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F3", "STM32F303", "STM32F303VC"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"macros": ["RTC_LSI=1"],
|
||||
"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": {
|
||||
"inherits": ["Target"],
|
||||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F3", "STM32F334C8"],
|
||||
"macros": ["DEVICE_RTC_LSI=1"],
|
||||
"macros": ["RTC_LSI=1"],
|
||||
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
|
||||
"progen": {"target": "disco-f334c8"},
|
||||
"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",
|
||||
"release_versions": ["2"]
|
||||
},
|
||||
|
@ -1072,7 +1072,7 @@
|
|||
"core": "Cortex-M4F",
|
||||
"default_toolchain": "ARM",
|
||||
"extra_labels": ["STM", "STM32F4", "STM32F429", "STM32F429ZI", "STM32F429xx"],
|
||||
"macros": ["DEVICE_RTC_LSI=1","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"macros": ["RTC_LSI=1","TRANSACTION_QUEUE_SIZE_SPI=2"],
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"progen": {"target": "disco-f429zi"},
|
||||
"device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "ERROR_RED", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "STDIO_MESSAGES", "TRNG"],
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
|
|
@ -46,7 +46,7 @@ void rtc_init(void)
|
|||
|
||||
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!
|
||||
|
@ -94,7 +94,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "mbed_error.h"
|
||||
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
static int rtc_inited = 0;
|
||||
#endif
|
||||
|
||||
|
@ -44,13 +44,13 @@ void rtc_init(void)
|
|||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
uint32_t rtc_freq = 0;
|
||||
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
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! */
|
||||
|
@ -106,7 +106,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -128,14 +128,14 @@ void rtc_free(void)
|
|||
RCC_OscInitStruct.LSIState = RCC_LSI_OFF;
|
||||
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) {
|
||||
|
|
|
@ -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_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()) {
|
||||
|
@ -135,7 +135,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -158,14 +158,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) return 1;
|
||||
|
|
|
@ -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_LSE;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; /* Mandatory, otherwise the PLL is reconfigured! */
|
||||
|
@ -121,7 +121,7 @@ void rtc_init(void)
|
|||
}
|
||||
|
||||
#if DEVICE_LOWPOWERTIMER
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
rtc_write(0);
|
||||
#else
|
||||
if (!rtc_isenabled()) {
|
||||
|
@ -137,7 +137,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -160,14 +160,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) return 1;
|
||||
|
|
|
@ -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_LSE;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
|
||||
|
@ -122,7 +122,7 @@ void rtc_init(void)
|
|||
}
|
||||
|
||||
#if DEVICE_LOWPOWERTIMER
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
rtc_write(0);
|
||||
#else
|
||||
if (!rtc_isenabled()) {
|
||||
|
@ -138,7 +138,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -161,14 +161,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) {
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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!
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
@ -64,14 +64,14 @@ void rtc_init(void)
|
|||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
|
||||
#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!
|
||||
|
@ -130,7 +130,7 @@ void rtc_init(void)
|
|||
}
|
||||
|
||||
#if DEVICE_LOWPOWERTIMER
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
rtc_write(0);
|
||||
#else
|
||||
if (!rtc_isenabled()) {
|
||||
|
@ -146,7 +146,7 @@ void rtc_init(void)
|
|||
|
||||
void rtc_free(void)
|
||||
{
|
||||
#if DEVICE_RTC_LSI
|
||||
#if RTC_LSI
|
||||
// Enable Power clock
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
|
@ -169,14 +169,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