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:
13:44e5327acb05
Parent:
7:fa32602e23ec
--- a/SetRTC.h	Fri Jan 29 07:35:34 2016 +0000
+++ b/SetRTC.h	Fri May 27 20:16:09 2016 +0000
@@ -3,11 +3,11 @@
  *      Check & set RTC function and set proper clock if we can set
  *      ONLY FOR "Nucleo Board"
  *
- *  Copyright (c) 2014-2015 Kenji Arai / JH1PJL
+ *  Copyright (c) 2014,'15,'16 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
- *      Created:  October   24th, 2014
- *      Revised:  May       16th, 2015
+ *      Created: October   24th, 2014
+ *      Revised: May       28th, 2016
  *
  * 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
@@ -17,8 +17,8 @@
  */
 
 /*
- * CAUTION! You need to modify "rtc_api.c" file in the mbed-src library.
- *          Please refer "modify_info_xxx.h" file and/or following NOTE.
+ * CAUTION! You need to modify "rtc_api.c" file in the mbed-dev library.
+ *          Please refer "modify_info_xxx.h" file and/or following my notebook.
  *          http://developer.mbed.org/users/kenjiArai/notebook/
  *              nucleo-series-rtc-control-under-power-onoff-and-re/
  */
@@ -28,7 +28,7 @@
 
 #include "mbed.h"
 
-#if defined(TARGET_NUCLEO_L152RE)
+#if defined(TARGET_STM32L152RE)
 #define USE_IRQ_FOR_RTC_BKUP    // Use interrupt for enter RTC backup mode
 #define USE_PB5_FOR_COMP        // Use PB5 port for low voltage detection (+5V line)
 //#define USE_PB6_FOR_COMP        // Use PB6 port for low voltage detection (+5V line)