Test of the Nucleo boards standby mode. sleep() and deepsleep() use the STM32 SLEEP and STOP modes. This uses the 3rd low power mode STANDBY. Utilises the WakeUp code here: https://developer.mbed.org/users/Sissors/code/WakeUp/ Adds a ClearWakeUp so that Standby can be entered repeatedly.

Dependencies:   WakeUp mbed

Files at this revision

API Documentation at this revision

Comitter:
MichaelW
Date:
Sat May 07 12:23:15 2016 +0000
Parent:
0:1ecaa40f74d0
Commit message:
Code reduced to minimal working; Verified that ClearWakeUp is required. ; Standby uses lower power than deepsleep

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
rtc_wakeup.h Show diff for this revision Revisions of this file
diff -r 1ecaa40f74d0 -r 085a87258f10 main.cpp
--- a/main.cpp	Sat May 07 11:51:56 2016 +0000
+++ b/main.cpp	Sat May 07 12:23:15 2016 +0000
@@ -1,101 +1,35 @@
-// Depending on the LED connections either the LED is off the 2 seconds
-// the target spends in deepsleep(), and on for the other second. Or it is inverted
-
-
 #include "mbed.h"
 #include "WakeUp.h"
-#include "stm32f0xx_hal.h"
-#include "stm32f0xx_hal_rtc_ex.h"
-#include "rtc_wakeup.h"
-
-#define RTC_CR_WUTE   (1<<10)
-#define RTC_CR_WUTIE    (1<<14)
-#define EXTI_IMR_MR20 0x00100000
-
 
 DigitalOut myled(LED1);
-DigitalOut Buzz(A2);
-DigitalOut RST(D0);
-
-static RTC_HandleTypeDef RtcHandle;
 
 void ClearWakeUp(void);
 
 int main()
 {
-    ClearWakeUp();
-    RST = 1;
-    Buzz = 0;
     myled = 1;
     wait(0.2);
     myled = 0;
     wait(0.2);
-    //print("Wake %i\r\n", TM_LOWPOWER_StandbyReset() );
+
     //The low-power oscillator can be quite inaccurate on some targets
     //this function calibrates it against the main clock
     WakeUp::calibrate();
 
 
-
-    //RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, DISABLE);   //Need write access to DBP bit
-
-    //__HAL_RCC_PWR_CLK_ENABLE();
-    //PWR->CR |= PWR_CR_DBP;
-    //SET_BIT(PWR->CR, PWR_CR_DBP);
-    /* //Wait for Backup domain Write protection disable
-    uint32_t tickstart = HAL_GetTick();
-
-
-    while((PWR->CR & PWR_CR_DBP) == RESET)
-      {
-        if((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE)
-        {
-          return HAL_TIMEOUT;
-        }
-      }
-    */
-    /*
-      HAL_PWR_EnableBkUpAccess();
-
-      RtcHandle.Instance = RTC;
-      __HAL_RTC_WRITEPROTECTION_DISABLE(&RtcHandle);
-
-       __HAL_RTC_ALARM_EXTI_CLEAR_FLAG();
-       __HAL_RTC_ALARM_CLEAR_FLAG(&RtcHandle, RTC_FLAG_ALRAF);
-       __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&RtcHandle, RTC_FLAG_WUTF);
-      //__HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() ;
-
-    // __HAL_RCC_BACKUPRESET_FORCE();
-    //__HAL_RCC_BACKUPRESET_FORCE();
-
-       __HAL_RTC_WRITEPROTECTION_ENABLE(&RtcHandle);
-
-    */
-
-    ///Direct register access version  ***************************************************
-
-    // ClearWakeUp();
-
-    //RCC_APB1PeriphCmd(RCC_APB1Periph_PWR, ENABLE);
-
-    // __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
-    //From Below works  ***************************************************
-
-    WakeUp::set_ms(2000);
-
-    //Enter deepsleep, the program won't go beyond this point until it is woken up
-    //deepsleep();
-
-    printf("Standby Mode\r\n");
-
+    WakeUp::set_ms(5000);
     ClearWakeUp();
 
+    printf("Entering Standby Mode\r\n");
+
     HAL_PWR_EnterSTANDBYMode();
-
+    
     //This will never be executed
     printf("After sleep\r\n");
+
 }
-void ClearWakeUp(void){
+void ClearWakeUp(void)
+{
     PWR->CR |= PWR_CR_DBP;      //Enable power domain
     RTC->WPR = 0xCA;            //Disable RTC write protection
     RTC->WPR = 0x53;
@@ -105,39 +39,4 @@
 
     RTC->WPR = 0xFF;        //Enable RTC write protection
     PWR->CR &= ~PWR_CR_DBP; //Disable power domain
-}
-
-void ClearWakeUp2(void)
-{
-    ///Direct register access version  ***************************************************
-    RtcHandle.Instance = RTC;
-
-    __HAL_RTC_WAKEUPTIMER_DISABLE(&RtcHandle);
-    __HAL_RTC_WAKEUPTIMER_DISABLE_IT(&RtcHandle,RTC_IT_WUT);
-
-    PWR->CR |= PWR_CR_DBP;      //Enable power domain                           //*******************
-    RTC->WPR = 0xCA;            //Disable RTC write protection
-    RTC->WPR = 0x53;
-
-    __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() ;
-    __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() ;
-
-    /* Disable the Alarm A interrupt */
-    __HAL_RTC_ALARMA_DISABLE(&RtcHandle);
-
-    /* Clear flag alarm A */
-    __HAL_RTC_ALARM_CLEAR_FLAG(&RtcHandle, RTC_FLAG_ALRAF);
-
-    __HAL_RTC_ALARM_EXTI_CLEAR_FLAG();
-    __HAL_RTC_ALARM_CLEAR_FLAG(&RtcHandle, RTC_FLAG_ALRAF);
-    __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&RtcHandle, RTC_FLAG_WUTF);
-
-    // #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG()            (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
-    __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() ;
-
-    EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT ;
-    EXTI->PR = 0x007FFFFF;
-    RTC->WPR = 0xFF;        //Enable RTC write protection
-    PWR->CR &= ~PWR_CR_DBP; //Disable power domain
-
 }
\ No newline at end of file
diff -r 1ecaa40f74d0 -r 085a87258f10 rtc_wakeup.h
--- a/rtc_wakeup.h	Sat May 07 11:51:56 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +0,0 @@
-/**
-  * @brief  Enable the RTC WakeUp Timer peripheral.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__)                      ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
- 
-/**
-  * @brief  Disable the RTC WakeUp Timer peripheral.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__)                     ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
- 
-/**
-  * @brief  Enable the RTC WakeUpTimer interrupt.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled.
-  *         This parameter can be:
-  *            @arg RTC_IT_WUT: WakeUpTimer interrupt
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__)    ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
- 
-/**
-  * @brief  Disable the RTC WakeUpTimer interrupt.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be disabled.
-  *         This parameter can be:
-  *            @arg RTC_IT_WUT: WakeUpTimer interrupt
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
- 
-/**
-  * @brief  Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __INTERRUPT__: specifies the RTC WakeUpTimer interrupt to check.
-  *         This parameter can be:
-  *            @arg RTC_IT_WUT:  WakeUpTimer interrupt
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__)       (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET)
- 
-/**
-  * @brief  Check whether the specified RTC Wake Up timer interrupt has been enabled or not.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __INTERRUPT__: specifies the RTC Wake Up timer interrupt sources to check.
-  *         This parameter can be:
-  *            @arg RTC_IT_WUT:  WakeUpTimer interrupt
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
- 
-/**
-  * @brief  Get the selected RTC WakeUpTimer's flag status.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __FLAG__: specifies the RTC WakeUpTimer Flag is pending or not.
-  *          This parameter can be:
-  *             @arg RTC_FLAG_WUTF
-  *             @arg RTC_FLAG_WUTWF
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)   (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
- 
-/**
-  * @brief  Clear the RTC Wake Up timer's pending flags.
-  * @param  __HANDLE__: specifies the RTC handle.
-  * @param  __FLAG__: specifies the RTC WakeUpTimer Flag to clear.
-  *         This parameter can be:
-  *            @arg RTC_FLAG_WUTF
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) 
- 
-/* WAKE-UP TIMER EXTI */
-/* ------------------ */
-/**
-  * @brief  Enable interrupt on the RTC WakeUp Timer associated Exti line.
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT()       (EXTI->IMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief  Disable interrupt on the RTC WakeUp Timer associated Exti line.
-  * @retval None
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT()      (EXTI->IMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
- 
-/**
-  * @brief  Enable event on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT()    (EXTI->EMR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief  Disable event on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT()   (EXTI->EMR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
- 
-/**
-  * @brief  Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. 
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE()   (EXTI->FTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief  Disable falling edge trigger on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE()  (EXTI->FTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
- 
-/**
-  * @brief  Enable rising edge trigger on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE()    (EXTI->RTSR |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief  Disable rising edge trigger on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE()   (EXTI->RTSR &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT))
- 
-/**
-  * @brief  Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();
- 
-/**
-  * @brief  Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line.
-  * This parameter can be:
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();__HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();
- 
-/**
-  * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not.
-  * @retval Line Status.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG()              (EXTI->PR & RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief Clear the RTC WakeUp Timer associated Exti line flag.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG()            (EXTI->PR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
- 
-/**
-  * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line.
-  * @retval None.
-  */
-#define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT()         (EXTI->SWIER |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT)
-
-
-/** @defgroup RTCEx_Backup_Registers_Definitions RTCEx Backup Registers Definition
-  * @{
-  */
-#define RTC_BKP_DR0                       ((uint32_t)0x00000000)
-#define RTC_BKP_DR1                       ((uint32_t)0x00000001)
-#define RTC_BKP_DR2                       ((uint32_t)0x00000002)
-#define RTC_BKP_DR3                       ((uint32_t)0x00000003)
-#define RTC_BKP_DR4                       ((uint32_t)0x00000004)
-/**
-  * @}
-  */
-/* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB) */
- 
-/** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition
-  * @{
-  */
-#define RTC_TIMESTAMPEDGE_RISING          ((uint32_t)0x00000000)
-#define RTC_TIMESTAMPEDGE_FALLING         ((uint32_t)0x00000008)
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_TimeStamp_Pin_Selections RTCEx TimeStamp Pin Selection
-  * @{
-  */
-#define RTC_TIMESTAMPPIN_DEFAULT              ((uint32_t)0x00000000)
- 
-/**
-  * @}
-  */
- 
-  
-/** @defgroup RTCEx_Tamper_Pins_Definitions RTCEx Tamper Pins Definition
-  * @{
-  */
-#define RTC_TAMPER_1                    RTC_TAFCR_TAMP1E
-#define RTC_TAMPER_2                    RTC_TAFCR_TAMP2E
-#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
-#define RTC_TAMPER_3                    RTC_TAFCR_TAMP3E
-#endif
- 
-/**
-  * @}
-  */
- 
- 
- 
-/** @defgroup RTCEx_Tamper_Trigger_Definitions RTCEx Tamper Trigger Definition
-  * @{
-  */
-#define RTC_TAMPERTRIGGER_RISINGEDGE       ((uint32_t)0x00000000)
-#define RTC_TAMPERTRIGGER_FALLINGEDGE      ((uint32_t)0x00000002)
-#define RTC_TAMPERTRIGGER_LOWLEVEL         RTC_TAMPERTRIGGER_RISINGEDGE
-#define RTC_TAMPERTRIGGER_HIGHLEVEL        RTC_TAMPERTRIGGER_FALLINGEDGE
- 
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Tamper_Filter_Definitions RTCEx Tamper Filter Definition
-  * @{
-  */
-#define RTC_TAMPERFILTER_DISABLE   ((uint32_t)0x00000000)  /*!< Tamper filter is disabled */
- 
-#define RTC_TAMPERFILTER_2SAMPLE   ((uint32_t)0x00000800)  /*!< Tamper is activated after 2
-                                                                consecutive samples at the active level */
-#define RTC_TAMPERFILTER_4SAMPLE   ((uint32_t)0x00001000)  /*!< Tamper is activated after 4
-                                                                consecutive samples at the active level */
-#define RTC_TAMPERFILTER_8SAMPLE   ((uint32_t)0x00001800)  /*!< Tamper is activated after 8
-                                                                consecutive samples at the active level. */
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definition  
-  * @{
-  */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768  ((uint32_t)0x00000000)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 32768 */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384  ((uint32_t)0x00000100)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 16384 */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192   ((uint32_t)0x00000200)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 8192  */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096   ((uint32_t)0x00000300)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 4096  */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048   ((uint32_t)0x00000400)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 2048  */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024   ((uint32_t)0x00000500)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 1024  */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512    ((uint32_t)0x00000600)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 512   */
-#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256    ((uint32_t)0x00000700)  /*!< Each of the tamper inputs are sampled
-                                                                             with a frequency =  RTCCLK / 256   */
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definition
-  * @{
-  */
-#define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000)  /*!< Tamper pins are pre-charged before
-                                                                         sampling during 1 RTCCLK cycle */
-#define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000)  /*!< Tamper pins are pre-charged before
-                                                                         sampling during 2 RTCCLK cycles */
-#define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000)  /*!< Tamper pins are pre-charged before
-                                                                         sampling during 4 RTCCLK cycles */
-#define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000)  /*!< Tamper pins are pre-charged before
-                                                                         sampling during 8 RTCCLK cycles */
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTCEx Tamper TimeStampOnTamperDetection Definition
-  * @{
-  */
-#define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE  ((uint32_t)RTC_TAFCR_TAMPTS)  /*!< TimeStamp on Tamper Detection event saved */
-#define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000)        /*!< TimeStamp on Tamper Detection event is not saved */
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTCEx Tamper Pull UP Definition
-  * @{
-  */
-#define RTC_TAMPER_PULLUP_ENABLE  ((uint32_t)0x00000000)            /*!< Tamper pins are pre-charged before sampling */
-#define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAFCR_TAMPPUDIS)   /*!< TimeStamp on Tamper Detection event is not saved */
- 
-/**
-  * @}
-  */
- 
-/** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definition
-  * @{
-  */
-#define RTC_WAKEUPCLOCK_RTCCLK_DIV16        ((uint32_t)0x00000000)
-#define RTC_WAKEUPCLOCK_RTCCLK_DIV8         ((uint32_t)0x00000001)
-#define RTC_WAKEUPCLOCK_RTCCLK_DIV4         ((uint32_t)0x00000002)
-#define RTC_WAKEUPCLOCK_RTCCLK_DIV2         ((uint32_t)0x00000003)
-#define RTC_WAKEUPCLOCK_CK_SPRE_16BITS      ((uint32_t)0x00000004)
-#define RTC_WAKEUPCLOCK_CK_SPRE_17BITS      ((uint32_t)0x00000006)
- 
-