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/
Diff: SetRTC.h
- Revision:
- 2:765470eab2a6
- Parent:
- 0:e4c20fd769f1
- Child:
- 5:1a8e7aed053d
diff -r e4c20fd769f1 -r 765470eab2a6 SetRTC.h --- a/SetRTC.h Sat Feb 07 02:19:57 2015 +0000 +++ b/SetRTC.h Mon Feb 16 12:33:22 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 7th, 2015 + * Revised: Feburary 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 @@ -16,11 +16,24 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* + * 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. + * http://developer.mbed.org/users/kenjiArai/notebook/ + * nucleo-series-rtc-control-under-power-onoff-and-re/ + */ + #ifndef SET_RTC_H #define SET_RTC_H #include "mbed.h" +#if defined(TARGET_NUCLEO_L152RE) +#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) +#endif + #define TIMEOUT ((uint32_t)5000) #define RTC_DAT0 0x55aa55aa #define RTC_DAT1 0xaa55aa55 @@ -37,6 +50,7 @@ * This is cased by mbed initial subroutine problem. * This program intends to use RTC with X2 and works well with battery back-up hardware setting. * + * * @code * #include "mbed.h" * #include "SetRTC.h" @@ -56,8 +70,22 @@ */ int32_t SetRTC(void); +/** Show(print) RTC related registers + * @param none + * @return none + */ void show_RTC_reg( void ); +/** Enter RTC initial data from PC Vertual Com + * @param none + * @return none + */ void time_enter_mode(void); +/** Preparation for Deep Sleep (Set I/O port and other peripheral low power condition) + * @param none + * @return none + */ +void deepsleep_preparation(void); + #endif // SET_RTC_H