Skip to content

STM32 - Rename RTC_LSI #2816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions hal/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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"},
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
},
Expand All @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down
16 changes: 8 additions & 8 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F0/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!
Expand Down Expand Up @@ -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()) {
Expand All @@ -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();

Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F1/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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();

Expand Down
12 changes: 6 additions & 6 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F2/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "mbed_error.h"

#if DEVICE_RTC_LSI
#if RTC_LSI
static int rtc_inited = 0;
#endif

Expand All @@ -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! */
Expand Down Expand Up @@ -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();

Expand All @@ -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) {
Expand Down
16 changes: 8 additions & 8 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F3/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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! */
Expand Down Expand Up @@ -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()) {
Expand All @@ -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();

Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F4/rtc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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! */
Expand Down Expand Up @@ -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()) {
Expand All @@ -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();

Expand All @@ -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;
Expand Down
Loading