This is a RTC additional function. This is only for Nucleo F401RE & F411RE mbed(Added L152RE, F334R8, L476RG & F746xx). If you connected battery backup circuit for internal RTC, you can make a power-off and reset condition. RTC still has proper time and date.

Dependents:   Nucleo_rtos_sample PB_Emma_Ethernet

Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/

Revision:
7:fa32602e23ec
Parent:
6:ef7d2c83034d
Child:
10:16ee1c956319
--- a/SetRTC.cpp	Thu Feb 19 02:56:12 2015 +0000
+++ b/SetRTC.cpp	Sat May 16 00:34:50 2015 +0000
@@ -7,7 +7,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:  October   24th, 2014
- *      Revised:  Feburary  19th, 2015
+ *      Revised:  May       16th, 2015
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -54,15 +54,15 @@
 static uint32_t check_RTC_backup_reg( void );
 static int xatoi (char **str, unsigned long *res);
 static void get_line (char *buff, int len);
-static void set_5v_drop_detect(void);
+static void set_5v_drop_detect(uint8_t function_use);
 
 //-------------------------------------------------------------------------------------------------
 //  Control Program
 //-------------------------------------------------------------------------------------------------
-int32_t SetRTC()
+int32_t SetRTC(uint8_t use_comparator)
 {
     if (rtc_external_osc_init() == 1) {
-        set_5v_drop_detect();
+        set_5v_drop_detect(use_comparator);
         return 1;
     } else {
         return 0;
@@ -489,8 +489,9 @@
     }
 }
 
-void set_5v_drop_detect(void)
+void set_5v_drop_detect(uint8_t function_use)
 {
+    if (function_use == 0){ return;}
     set_BOR_level3();
     // Set Analog voltage input (PB5 or PB6)
 #if defined(USE_PB5_FOR_COMP)
@@ -526,14 +527,14 @@
     HAL_NVIC_EnableIRQ(COMP_IRQn);
 }
 #else   // defined(USE_IRQ_FOR_RTC_BKUP)
-void set_5v_drop_detect(void)
+void set_5v_drop_detect(uint8_t function_use)
 {
     ;   // No implementation
 }
 #endif  // defined(USE_IRQ_FOR_RTC_BKUP)
 
 #else   // defined(TARGET_NUCLEO_L152RE)
-void set_5v_drop_detect(void)
+void set_5v_drop_detect(uint8_t function_use)
 {
     ;   // No implementation
 }