mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Fri Apr 15 11:00:11 2016 +0100
Parent:
110:ee5a402b756a
Child:
112:df58eca2f41d
Commit message:
Synchronized with git revision 9b277ae859dd9b09ceec43e4c89b18eb6a840cd6

Full URL: https://github.com/mbedmicro/mbed/commit/9b277ae859dd9b09ceec43e4c89b18eb6a840cd6/

* Add DEVICE_RTC_LSI=0

* Change LSI value to 32 kHz

This is the value written in the device datasheet.

* Replace tabulations with spaces

Changed in this revision

targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c	Wed Apr 13 16:00:11 2016 +0100
+++ b/targets/hal/TARGET_STM/TARGET_STM32L4/rtc_api.c	Fri Apr 15 11:00:11 2016 +0100
@@ -65,9 +65,9 @@
         HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
         rtc_freq = LSE_VALUE;
     } else {
-	    error("Cannot initialize RTC with LSE\n");
+        error("Cannot initialize RTC with LSE\n");
     }
-#else	
+#else
     // Enable Power clock
     __HAL_RCC_PWR_CLK_ENABLE();
 
@@ -78,22 +78,22 @@
     __HAL_RCC_BACKUPRESET_FORCE();
     __HAL_RCC_BACKUPRESET_RELEASE();
 
-	// Enable LSI clock
-	RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
-	RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
-	RCC_OscInitStruct.LSEState       = RCC_LSE_OFF;
-	RCC_OscInitStruct.LSIState       = RCC_LSI_ON;
-	if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
-		error("Cannot initialize RTC with LSI\n");
-	}
-	// Connect LSI to RTC
-	PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
-	PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
-	if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
-		error("Cannot initialize RTC with LSI\n");
-	}
-	// This value is LSI typical value. To be measured precisely using a timer input capture for example.
-	rtc_freq = 40000;
+    // Enable LSI clock
+    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;
+    RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
+    RCC_OscInitStruct.LSEState       = RCC_LSE_OFF;
+    RCC_OscInitStruct.LSIState       = RCC_LSI_ON;
+    if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
+        error("Cannot initialize RTC with LSI\n");
+    }
+    // Connect LSI to RTC
+    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
+    PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
+    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
+        error("Cannot initialize RTC with LSI\n");
+    }
+    // This value is LSI typical value (see device datasheet)
+    rtc_freq = 32000;
 #endif
 
     // Check if RTC is already initialized
@@ -141,7 +141,7 @@
 
 #if DEVICE_RTC_LSI
     rtc_inited = 0;
-#endif	
+#endif
 }
 
 int rtc_isenabled(void)