int main(void)
00059 {
00060 /*!< At this stage the microcontroller clock setting is already configured,
00061 this is done through SystemInit() function which is called from startup
00062 file (startup_stm32f0xx.s) before to branch to application main.
00063 To reconfigure the default setting of SystemInit() function, refer to
00064 system_stm32f0xx.c file
00065 */
00066
00067 /* Configure LED3 */
00068 STM_EVAL_LEDInit(LED3);
00069
00070 /* Configure Systick */
00071 SysTick_Configuration();
00072
00073 /* Turn ON LED3 */
00074 STM_EVAL_LEDOn(LED3);
00075
00076 /* Configures Tamper button */
00077 STM_EVAL_PBInit(BUTTON_TAMPER,BUTTON_MODE_GPIO);
00078
00079 /* Configure RTC clock source and prescaler */
00080 RTC_Config();
00081
00082 /* Wait till Tamper button is pressed */
00083 while(STM_EVAL_PBGetState(BUTTON_TAMPER) != RESET);
00084
00085 /* Enter STANDBY mode, RTC Alarm within 3 second or an external RESET will
00086 wake-up the system from STANDBY */
00087 EnterSTANDBYMode();
00088
00089 while(1)
00090 {}
00091 }
static void RTC_Config(void)
00099 {
00100 RTC_InitTypeDef RTC_InitStructure;
00101 RTC_TimeTypeDef RTC_TimeStructure;
00102 uint32_t LSIFreq = 0;
00103
00104 /* Enable the PWR clock */
00105 RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
00106
00107 /* Allow access to Backup Domain */
00108 PWR_BackupAccessCmd(ENABLE);
00109
00110 /* Disable wake-up source(ALARM) to guarantee free access to WUT level-OR input */
00111 RTC_ITConfig(RTC_IT_ALRA, DISABLE);
00112
00113 /* Clear Wakeup flag */
00114 PWR_ClearFlag(PWR_FLAG_WU);
00115
00116 /* Enable wake-up source(ALARM) to guarantee free access to WUT level-OR input */
00117 RTC_ITConfig(RTC_IT_ALRA, ENABLE);
00118
00119 /* Enable the LSI OSC */
00120 RCC_LSICmd(ENABLE);
00121
00122 /* Wait till LSI is ready */ 00123 while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
00124 {}