In the past, you need modify rtc_api.c in mbed-dev source code. From this revision, you can just use RTC function all of conditions (Normal, Reset, Stand-by, Power OFF).
Note
From now on, you do NOT need any modification for mbed-dev library because STM team updates rtc_api.c source code and support RTC function under reset & standby condition includes power off condition (You need additional VBAT back-up hardware).
Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/
Diff: main.cpp
- Revision:
- 3:7b3edf54c706
- Parent:
- 2:77ec44bf1fa5
- Child:
- 4:a9cebfe4715f
--- a/main.cpp Mon Feb 16 13:07:57 2015 +0000 +++ b/main.cpp Wed Feb 18 09:15:37 2015 +0000 @@ -6,7 +6,7 @@ * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: January 17th, 2015 - * Revised: Feburary 16th, 2015 + * Revised: Feburary 18th, 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 @@ -110,15 +110,16 @@ // 12345678 lcd.printf(" Sleep " ); #endif - pc.printf("\r\nEnter Deep Sleep Mode, please push RESET to wake-up\r\n"); + // 123456789012345678901234567890123456789012345678 + pc.printf("\r\nEnter Standby Mode, please push RESET to wake-up\r\n"); wait(1.0); myled = 0; - deepsleep_preparation(); - deepsleep(); + goto_standby(); } } if (counter){ - pc.printf(" \r"); + // 12345678901234567890123456789012345678901234567890 + pc.printf(" \r"); } myled = !myled; }